$ NCEP.snapshot.run.sh
======================
NCEP.snapshot.run.sh
======================
#!/bin/sh
exe=NCEP.snapshot.gs
if [ ! -f $exe ]; then
echo Error in $0 : No such file, $exe
exit 1
fi
# Parameters
ifu='NCEP.uwnd.ctl'
ifv='NCEP.vwnd.ctl'
ift='NCEP.air.ctl'
prefix=NCEP1
outdir="Fig"
lev=1000 #950 # Vertical Level
lonw=120
lone=150
lats=22.4
latn=47.6
opt="-lonw $lonw -lone $lone -lats $lats -latn $latn"
var=temp #ept #theta
ci=3 #Contour Interval
time='00Z01MAY2016'
out=${prefix}.${var}.${lev}hPa.$(printf %02d $it).eps
grads -bcp "$exe -ifu $ifu -ifv $ifv -ift $ift \
$opt -time $time -lev $lev -var ${var} \
-ci $ci -outdir $outdir -out $out -q"
exit 0
----------------------
End of NCEP.snapshot.run.sh
----------------------
======================
NCEP.snapshot.gs
======================
function ncep1( args )
*
* Default values
*
ifu='NCEP.uwnd.ctl'
ifv='NCEP.vwnd.ctl'
ift='NCEP.air.ctl'
lonw=122.0 ; lone=134 ;*lone=150
lats=24.5 ; latn=35 ;* latn=47.5
out='ncep.snapshot.test.eps'
quitopt='no'
lev=1000
ci=20
var='temp'
'set rgb 100 153 76 0'
*
* Decode options
*
i = 1
while( 1 )
arg = subwrd( args, i )
i = i + 1;
if( arg = '' ); break; endif
while( 1 )
if( arg = '-ifu');ifu = subwrd(args,i);i=i+1; break;endif
if( arg = '-ifv');ifv = subwrd(args,i);i=i+1; break;endif
if( arg = '-ift');ift = subwrd(args,i);i=i+1; break;endif
if( arg = '-var' ); var = subwrd(args,i);i=i+1; break;endif
if( arg = '-lonw' ); lonw = subwrd(args,i);i=i+1; break;endif
if( arg = '-lone' ); lone = subwrd(args,i);i=i+1; break;endif
if( arg = '-lats' ); lats = subwrd(args,i);i=i+1; break;endif
if( arg = '-latn' ); latn = subwrd(args,i);i=i+1; break;endif
if( arg = '-lev' ); lev = subwrd(args,i) ;i=i+1; break;endif
if( arg = '-time' ); time = subwrd(args,i) ;i=i+1; break;endif
if( arg = '-ci' ); ci = subwrd(args,i) ;i=i+1; break;endif
if( arg = '-outdir' ); outdir = subwrd(args,i) ;i=i+1;break;endif
if( arg = '-out' ); out = subwrd(args,i) ;i=i+1;break;endif
if( arg = '-q' ); quitopt=yes ;i=i+1; break; endif
say 'Syntax error : arg= 'arg
return
endwhile
endwhile
say 'Open 'ifu; 'open 'ifu
say 'Open 'ifv; 'open 'ifv
say 'Open 'ift; 'open 'ift
say
'q ctlinfo 1'
say result
say
'q ctlinfo 2'
say result
say
'q ctlinfo 3'
say result
'set lev 'lev ;#/100
'set time 'time
'q dims'
say result
line=sublin(result,5)
datetime=subwrd(line,6)
#line=sublin(result,4)
#pdb=subwrd(line,6)
pha=lev
say pha
say
say 'lon 'lonw' 'lone
say 'lat 'lats' 'latn
say
'set lon 'lonw' 'lone
'set lat 'lats' 'latn
'cc'
'set mpdset hires'
'set map 1 1 7'
'set xlopts 1 5 0.15'
'set xlint 2'
'set ylopts 1 5 0.15'
'set ylint 2'
'set grid off'
### Color shade
'set gxout shade2'
if (var = "temp" )
'temp=air.3-273.15'
tmin=-4
tmax=26
tint=2
endif
if (var = "ept" )
'temp=air.3'
'es=6.1173*exp(((2.501*pow(10,6))/461.50)*(1/273.16 - 1/temp))'
'ws=621.97*(es/(' pha '-es))'
'w=(rh*ws)/(100*1000)'
'ept=(temp+((2.501*pow(10,6))/1004)*w)*pow((1000/' pha '),287/1004)'
tmin=340
tmax=348
tint=2
endif
if (var = "theta" )
'temp=air.3'
'theta=temp*pow((1000/' pha '),287/1004)'
tmin=280
tmax=300
tint=2
endif
'color ' tmin ' ' tmax ' ' tint ' -kind lightcyan->cyan->mediumspringgreen->lawngreen->moccasin->orange->orangered->red'
'set xlab off'
'set ylab off'
'd 'var
'cbarn'
### contour
'set gxout contour'
'set ccolor 0'
'set cthick 2'
'set cint 'tint
'set clab off'
'set xlab off'
'set ylab off'
'd 'var
### vector
'set gxout vector'
'set ccolor 0'
'set cthick 10'
'set xlab off'
'set ylab off'
'd skip(uwnd.1,1,1);skip(vwnd.2,1,1)'
'set ccolor 1'
'set cthick 1'
'set xlab on'
'set ylab on'
'set xlint 5'
'set ylint 5'
'd skip(uwnd.1,1,1);skip(vwnd.2,1,1)'
# Text
'set strsiz 0.10 0.15'
'set string 1 c 5 0'
'draw string 6.6 1.1 m/s'
'draw title 'datetime' 'pha' hPa'
'gxprint 'outdir '/' out
if ( quitopt = "yes" ); quit; endif
return
----------------------
End of NCEP.snapshot.gs
----------------------
======================
NCEP.uwnd.ctl
======================
DSET /work4/data/NCEP.NCAR.Reanalysis1/Pressure.Level/uwnd.2016.nc
DTYPE netcdf
TITLE Eastward wind comp
UNDEF -9.96921e+36
UNPACK scale_factor add_offset
OPTIONS yrev
XDEF 144 linear 0 2.5
YDEF 73 linear -90 2.5
ZDEF 17 levels 1000 925 850 700 600 500 400 300
250 200 150 100 70 50 30 20 10
tdef 548 linear 00Z01JAN2016 360mn
VARS 1
uwnd=>uwnd 17 t,z,y,x 4xDaily U-wind
ENDVARS
----------------------
End of NCEP.uwnd.ctl
----------------------
======================
NCEP.vwnd.ctl
======================
DSET /work4/data/NCEP.NCAR.Reanalysis1/Pressure.Level/vwnd.2016.nc
DTYPE netcdf
TITLE Northward Wind Comp
UNDEF -9.96921e+36
UNPACK scale_factor add_offset
OPTIONS yrev
XDEF 144 linear 0 2.5
YDEF 73 linear -90 2.5
ZDEF 17 levels 1000 925 850 700 600 500 400 300
250 200 150 100 70 50 30 20 10
tdef 548 linear 00Z01JAN2016 360mn
VARS 1
vwnd=>vwnd 17 t,z,y,x 4xDaily U-wind
ENDVARS
----------------------
End of NCEP.vwnd.ctl
----------------------
======================
NCEP.air.ctl
======================
DSET /work4/data/NCEP.NCAR.Reanalysis1/Pressure.Level/air.2016.nc
DTYPE netcdf
TITLE Air temp
UNDEF -9.96921e+36
UNPACK scale_factor add_offset
OPTIONS yrev
XDEF 144 linear 0 2.5
YDEF 73 linear -90 2.5
ZDEF 17 levels 1000 925 850 700 600 500 400 300
250 200 150 100 70 50 30 20 10
tdef 548 linear 00Z01JAN2016 360mn
VARS 1
air=>air 17 t,z,y,x Temperature
ENDVARS
----------------------
End of NCEP.air.ctl
----------------------