Some GrADS Scripts

If you want additional plots, it's not too difficult to generate them yourself.

You need GrADS. The Linux i686 and Ubuntu x86_64 executables should work for most distributions; they are big static executables that don't depend much on your system. Besides the executable you need the data files, containing fonts and geographical maps.

Building from source is badly documented; you'll need supplemental Libraries in specific versions (the executables contain them). The latest Windows version is old; I don't know if my scripts will work with it.

Data are available at NOMADS DODS Servers (here, here, here, here and here). You don't need to download them; they will be accessed online. High resolution GFS data (0.5 lat/lon grid) are contained in directories named gfs_master. The info files of the DODS servers describe the available data and are readable with a normal web browser.

Some variables are "hidden" and prepended by an o. You can use them as well, but be aware that these are averages, sums, maxima or minima that refer to varying time spans. Generally, forecast times at 3, 9, 15, 21, … hours ahead refer to the 3 hours before, while forecast times at 6, 12, 18, 24, … hours ahead refer to the 6 hours before. This is documented in the description of the original GRIB files. The hidden variables just don't appear at the online plot scripts; some of them are redefined to uniform timespans there.

Note that the 0.5 grid is interpolated from the original GFS resolution. Surface data are calculated in a 1152576 point Gaussian grid (0.3125 zonal resolution). Atmospherical data are calculated using a T382 spherical harmonics model, roughly equivalent in resolution to a 0.5 grid near the equator.

Running the scripts

The scripts are run by commands like gradsdap -lbc "run tmp2m.gs 2008-07-15 06z 24" where tmp2m.gs is the script name, 2008-07-15 06z the initialization date and time (00z, 06z, 12z or 18z; data typically available on DODS servers 6 hours later) of the specific model run and 24 the forecast offset in hours (must be multiples of 3, for correct averages or sums 6; maximum is 180, minimum 0 or 24 for 24 hour values). The scripts aren't very tolerant for input errors.

For older versions of GrADS, use gradsdods instead of gradsdap; if you want to see what's going on, use -lc instead of -lbc. You will get PNG images in the current directory.

Refer to the GrADS documentation if you want to change the scripts. The scripts are in the public domain.

ice.gs, ice concentration

function main( args )

base= 'nomad1.ncep.noaa.gov:9090/dods'
*base= 'nomads6.ncdc.noaa.gov:9090/dods'
*base= 'nomad5.ncep.noaa.gov:9090/dods/nomad1-raid1'
*base= 'nomad3.ncep.noaa.gov:9090/dods'

date= subwrd( args, 1 )
hour= subwrd( args, 2 )
valid= subwrd( args, 3 )

year= substr( date, 1, 4 )
mon= substr( date, 6, 2 )
day= substr( date, 9, 2 )
date= year mon day
hour= substr( hour, 1, 2 )

offs= valid / 3
if ( valid < 100 ); if ( valid < 10 ); valid= '0' valid; endif; valid= '0' valid; endif

'reinit'
'set display color white'
'c'

'set rgb 16 128 128 128'
'set rgb 17 64 64 64'

'set rgb 48 0 0 192'
'set rgb 49 0 60 200'
'set rgb 50 0 88 208'
'set rgb 51 0 116 216'
'set rgb 52 0 144 224'
'set rgb 53 0 172 232'
'set rgb 54 0 200 240'
'set rgb 55 0 228 248'
'set rgb 56 0 255 255'
'set rgb 57 0 255 176'
'set rgb 58 128 255 64'
'set rgb 59 192 255 0'
'set rgb 60 255 255 0'
'set rgb 61 255 236 0'
'set rgb 62 255 216 0'
'set rgb 63 255 196 0'
'set rgb 64 255 176 0'
'set rgb 65 255 156 0'
'set rgb 66 255 136 0'
'set rgb 67 255 112 0'
'set rgb 68 255 80 0'
'set rgb 69 255 0 0'
'set rgb 70 240 0 48'
'set rgb 71 224 0 72'
'set rgb 72 208 0 96'
'set rgb 73 192 0 120'

'sdfopen http://' base '/gfs_master/gfs' date '/gfs_master_' hour 'z'
if ( rc ); return; endif

'set t ' 1 + offs
'set lat 60 90'
'set lon -225 135'
'set grads off'
'set parea 1.5 9.5 .1 8.1'
'set frame circle'
'set mpdset hires'
'set mpt * 16'
'set mproj nps'
'set grid on 5 16'
'set cterp off'

'set gxout shaded'
'set clevs .000001 .01 .025 .05 .1 .15 .2 .25 .3 .35 .4 .45 .5 .55 .6 .65 .7 .75 .8 .85 .9 .925 .95 .975 .99 .999999'
'set ccols 0 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73'
*'d maskout(icecsfc,icecsfc-0.000001)'
'd icecsfc'

'set string 1 bc 6'
'set strsiz .15 .18'
'draw string 5.5 8.2 GFS ' year '-' mon '-' day ' ' hour 'Z, Ice Concentration, Valid +' valid 'h'

'set parea 9.7 9.9 .3 7.9'
'set frame on'
'set gxout contour'
'set t 1 2'
'set lon 0'
'set lat 0 105'
'set xyrev on'
'set gxout shaded'
'set clevs .000001 .01 .025 .05 .1 .15 .2 .25 .3 .35 .4 .45 .5 .55 .6 .65 .7 .75 .8 .85 .9 .925 .95 .975 .99 .999999'
'set ccols 0 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73'
'set ylpos 0 r'
'set ylint 10'
'set ylab %3.0f'
'set xlab off'
'set grid horizontal 1 16'
'd lat/100'

'set string 1 bl 5'
'set strsiz .1 .12'
'draw string 10 8.1 %'

'printim ice.' year '-' mon '-' day '.' hour 'z+' valid '.png x1100 y850'

'quit'

icetk.gs, ice thickness

function main( args )

base= 'nomad1.ncep.noaa.gov:9090/dods'
*base= 'nomads6.ncdc.noaa.gov:9090/dods'
*base= 'nomad5.ncep.noaa.gov:9090/dods/nomad1-raid1'
*base= 'nomad3.ncep.noaa.gov:9090/dods'

date= subwrd( args, 1 )
hour= subwrd( args, 2 )
valid= subwrd( args, 3 )

year= substr( date, 1, 4 )
mon= substr( date, 6, 2 )
day= substr( date, 9, 2 )
date= year mon day
hour= substr( hour, 1, 2 )

offs= valid / 3
if ( valid < 100 ); if ( valid < 10 ); valid= '0' valid; endif; valid= '0' valid; endif

'reinit'
'set display color white'
'c'

'set rgb 16 128 128 128'
'set rgb 17 64 64 64'

'set rgb 48 0 0 192'
'set rgb 49 0 60 200'
'set rgb 50 0 88 208'
'set rgb 51 0 116 216'
'set rgb 52 0 144 224'
'set rgb 53 0 172 232'
'set rgb 54 0 200 240'
'set rgb 55 0 228 248'
'set rgb 56 0 255 255'
'set rgb 57 0 255 176'
'set rgb 58 128 255 64'
'set rgb 59 192 255 0'
'set rgb 60 255 255 0'
'set rgb 61 255 236 0'
'set rgb 62 255 216 0'
'set rgb 63 255 196 0'
'set rgb 64 255 176 0'
'set rgb 65 255 156 0'
'set rgb 66 255 136 0'
'set rgb 67 255 112 0'
'set rgb 68 255 80 0'
'set rgb 69 255 0 0'
'set rgb 70 240 0 48'
'set rgb 71 224 0 72'
'set rgb 72 208 0 96'
'set rgb 73 192 0 120'
'set rgb 74 208 0 144'
'set rgb 75 224 0 168'
'set rgb 76 240 0 192'
'set rgb 77 255 0 216'
'set rgb 78 255 64 255'
'set rgb 79 255 104 255'

'sdfopen http://' base '/gfs_master/gfs' date '/gfs_master_' hour 'z'
if ( rc ); return; endif

'set t ' 1 + offs
'set lat 60 90'
'set lon -225 135'
'set grads off'
'set parea 1.5 9.5 .1 8.1'
'set frame circle'
'set mpdset hires'
'set mpt * 16'
'set mproj nps'
'set grid on 5 16'
'set cterp off'

'set gxout shaded'
'set clevs .000001 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.15 1.3 1.5 1.75 2 2.25 2.5 2.75 3 3.25 3.5 3.75 4 4.25 4.5 4.75 5 5.25 5.5 5.75 6'
'set ccols 0 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
*'d icetksfc'
'd const(icetksfc,0,-u)'

'set string 1 bc 6'
'set strsiz .15 .18'
'draw string 5.5 8.2 GFS ' year '-' mon '-' day ' ' hour 'Z, Ice Thickness, Valid +' valid 'h'

'set parea 9.7 9.9 .3 7.9'
'set frame on'
'set gxout contour'
'set t 1 2'
'set lon 0'
'set lat 0 6.25'
'set xyrev on'
'set gxout shaded'
'set clevs .000001 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.15 1.3 1.5 1.75 2 2.25 2.5 2.75 3 3.25 3.5 3.75 4 4.25 4.5 4.75 5 5.25 5.5 5.75 6'
'set ccols 0 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
'set ylpos 0 r'
'set ylint .5'
'set ylab %3.1f'
'set xlab off'
'set grid horizontal 1 16'
'd lat'

'set string 1 bl 5'
'set strsiz .1 .12'
'draw string 10 8.1 m'

'printim icetk.' year '-' mon '-' day '.' hour 'z+' valid '.png x1100 y850'

'quit'

icechg.gs, ice thickness change

function main( args )

base= 'nomad1.ncep.noaa.gov:9090/dods'
*base= 'nomads6.ncdc.noaa.gov:9090/dods'
*base= 'nomad5.ncep.noaa.gov:9090/dods/nomad1-raid1'
*base= 'nomad3.ncep.noaa.gov:9090/dods'

date= subwrd( args, 1 )
hour= subwrd( args, 2 )
valid= subwrd( args, 3 )

year= substr( date, 1, 4 )
mon= substr( date, 6, 2 )
day= substr( date, 9, 2 )
date= year mon day
hour= substr( hour, 1, 2 )

offs= valid / 3
if ( valid < 100 ); if ( valid < 10 ); valid= '0' valid; endif; valid= '0' valid; endif

'reinit'
'set display color white'
'c'

'set rgb 16 128 128 128'
'set rgb 17 64 64 64'

'set rgb 40 128 0 160'
'set rgb 41 128 0 184'
'set rgb 42 128 0 208'
'set rgb 43 128 0 232'
'set rgb 44 128 0 255'
'set rgb 45 112 0 240'
'set rgb 46 96 0 224'
'set rgb 47 80 0 208'
'set rgb 48 0 0 192'
'set rgb 49 0 60 200'
'set rgb 50 0 88 208'
'set rgb 51 0 116 216'
'set rgb 52 0 144 224'
'set rgb 53 0 172 232'
'set rgb 54 0 200 240'
'set rgb 55 0 228 248'
'set rgb 56 0 255 255'
'set rgb 57 0 255 176'
'set rgb 58 128 255 64'
'set rgb 59 192 255 0'
'set rgb 60 255 255 0'
'set rgb 61 255 236 0'
'set rgb 62 255 216 0'
'set rgb 63 255 196 0'
'set rgb 64 255 176 0'
'set rgb 65 255 156 0'
'set rgb 66 255 136 0'
'set rgb 67 255 112 0'
'set rgb 68 255 80 0'
'set rgb 69 255 0 0'
'set rgb 70 240 0 48'
'set rgb 71 224 0 72'
'set rgb 72 208 0 96'
'set rgb 73 192 0 120'
'set rgb 74 208 0 144'
'set rgb 75 224 0 168'
'set rgb 76 240 0 192'
'set rgb 77 255 0 216'
'set rgb 78 255 64 255'
'set rgb 79 255 104 255'

'sdfopen http://' base '/gfs_master/gfs' date '/gfs_master_' hour 'z'
if ( rc ); return; endif

'set t 1'
'set lat 60 90'
'set lon -225 135'
'set grads off'
'set parea 1.5 9.5 .1 8.1'
'set frame circle'
'set mpdset hires'
'set mpt * 16'
'set mproj nps'
'set grid on 5 16'
'set cterp off'

'define chg= (const(icetksfc(t=' offs + 1 '),0,-u) - const(icetksfc(t=' offs - 7 '),0,-u)) * -100'

'set gxout shaded'
'set clevs -12 -11 -10 -9 -8 -7 -6 -5 -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -.5 -.2 -.1 -.000001 .000001 .1 .2 .5 1 1.5 2 2.5 3 3.5 4 4.5 5 6 7 8 9 10 11 12'
'set ccols 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 0 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
'd chg'

'set string 1 bc 6'
'set strsiz .15 .18'
'draw string 5.5 8.2 GFS ' year '-' mon '-' day ' ' hour 'Z, Daily Ice Thickness Change, Valid +' valid 'h'

'set parea 9.7 9.9 .3 7.9'
'set frame on'
'set gxout contour'
'set t 1 2'
'set lon 0'
'set lat -13 13'
'set xyrev on'
'set gxout shaded'
'set clevs -12 -11 -10 -9 -8 -7 -6 -5 -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -.5 -.2 -.1 -.000001 .000001 .1 .2 .5 1 1.5 2 2.5 3 3.5 4 4.5 5 6 7 8 9 10 11 12'
'set ccols 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 0 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
'set ylpos 0 r'
'set ylint 2'
'set ylab %+3.0f'
'set xlab off'
'set grid horizontal 1 16'
'd -lat'

'set string 1 bl 5'
'set strsiz .1 .12'
'draw string 10 8.1 cm'

'printim icetk.' year '-' mon '-' day '.' hour 'z+' valid '.png x1100 y850'

'quit'

tmp2m.gs, 2 m temperature

function main( args )

base= 'nomad1.ncep.noaa.gov:9090/dods'
*base= 'nomads6.ncdc.noaa.gov:9090/dods'
*base= 'nomad5.ncep.noaa.gov:9090/dods/nomad1-raid1'
*base= 'nomad3.ncep.noaa.gov:9090/dods'

date= subwrd( args, 1 )
hour= subwrd( args, 2 )
valid= subwrd( args, 3 )

year= substr( date, 1, 4 )
mon= substr( date, 6, 2 )
day= substr( date, 9, 2 )
date= year mon day
hour= substr( hour, 1, 2 )

offs= valid / 3
if ( valid < 100 ); if ( valid < 10 ); valid= '0' valid; endif; valid= '0' valid; endif

'reinit'
'set display color white'
'c'

'set rgb 16 128 128 128'
'set rgb 17 64 64 64'

'set rgb 40 128 0 160'
'set rgb 41 128 0 184'
'set rgb 42 128 0 208'
'set rgb 43 128 0 232'
'set rgb 44 128 0 255'
'set rgb 45 112 0 240'
'set rgb 46 96 0 224'
'set rgb 47 80 0 208'
'set rgb 48 0 0 192'
'set rgb 49 0 60 200'
'set rgb 50 0 88 208'
'set rgb 51 0 116 216'
'set rgb 52 0 144 224'
'set rgb 53 0 172 232'
'set rgb 54 0 200 240'
'set rgb 55 0 228 248'
'set rgb 56 0 255 255'
'set rgb 57 0 255 176'
'set rgb 58 128 255 64'
'set rgb 59 192 255 0'
'set rgb 60 255 255 0'
'set rgb 61 255 236 0'
'set rgb 62 255 216 0'
'set rgb 63 255 196 0'
'set rgb 64 255 176 0'
'set rgb 65 255 156 0'
'set rgb 66 255 136 0'
'set rgb 67 255 112 0'
'set rgb 68 255 80 0'
'set rgb 69 255 0 0'
'set rgb 70 240 0 48'
'set rgb 71 224 0 72'
'set rgb 72 208 0 96'
'set rgb 73 192 0 120'
'set rgb 74 208 0 144'
'set rgb 75 224 0 168'
'set rgb 76 240 0 192'
'set rgb 77 255 0 216'
'set rgb 78 255 64 255'
'set rgb 79 255 104 255'

'sdfopen http://' base '/gfs_master/gfs' date '/gfs_master_' hour 'z'
if ( rc ); return; endif

'set t 1'
'set lat 60 90'
'set lon -225 135'
'set grads off'
'set parea 1.5 9.5 .1 8.1'
'set frame circle'
'set mpdset hires'
'set mpt * 16'
'set mproj nps'
'set grid on 5 16'
'set cterp off'

'define t2m= ave(tmp2m,t=' offs - 6 ',t=' offs + 1 ')-273.15'

'set gxout shaded'
'set clevs -34 -32 -30 -28 -26 -24 -22 -20 -18 -16 -14 -12 -10 -8 -6 -4 -2 -1 -.5 0 .5 1 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34'
'set ccols 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
'd t2m'
*'set gxout contour'
*'set cint 10'
*'set clab off'
*'set cstyle 1'
*'set ccolor 17'
*'d t2m'

'set string 1 bc 6'
'set strsiz .15 .18'
'draw string 5.5 8.2 GFS ' year '-' mon '-' day ' ' hour 'Z, 2m Temperature, Daily Mean, Valid +' valid 'h'

'set parea 9.7 9.9 .3 7.9'
'set frame on'
'set gxout contour'
'set t 1 2'
'set lon 0'
'set lat -35.999999 35.999999'
'set xyrev on'
'set gxout shaded'
'set clevs -34 -32 -30 -28 -26 -24 -22 -20 -18 -16 -14 -12 -10 -8 -6 -4 -2 -1 -.5 0 .5 1 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34'
'set ccols 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
'set ylpos 0 r'
'set ylint 2'
'set ylab %+3.0f'
'set xlab off'
'set grid horizontal 1 16'
'd lat'

'set string 1 bl 5'
'set strsiz .1 .12'
'draw string 10 8.1 `3.`0C'

'printim tmp2m.' year '-' mon '-' day '.' hour 'z+' valid '.png x1100 y850'

'quit'

wind.gs, 10 m wind

function main( args )

base= 'nomad1.ncep.noaa.gov:9090/dods'
*base= 'nomads6.ncdc.noaa.gov:9090/dods'
*base= 'nomad5.ncep.noaa.gov:9090/dods/nomad1-raid1'
*base= 'nomad3.ncep.noaa.gov:9090/dods'

date= subwrd( args, 1 )
hour= subwrd( args, 2 )
valid= subwrd( args, 3 )

year= substr( date, 1, 4 )
mon= substr( date, 6, 2 )
day= substr( date, 9, 2 )
date= year mon day
hour= substr( hour, 1, 2 )

offs= valid / 3
if ( valid < 100 ); if ( valid < 10 ); valid= '0' valid; endif; valid= '0' valid; endif

'reinit'
'set display color white'
'c'

'set rgb 16 128 128 128'
'set rgb 17 64 64 64'
'set rgb 18 80 80 80'

'set rgb 48 0 0 192'
'set rgb 49 0 60 200'
'set rgb 50 0 88 208'
'set rgb 51 0 116 216'
'set rgb 52 0 144 224'
'set rgb 53 0 172 232'
'set rgb 54 0 200 240'
'set rgb 55 0 228 248'
'set rgb 56 0 255 255'
'set rgb 57 0 255 176'
'set rgb 58 128 255 64'
'set rgb 59 192 255 0'
'set rgb 60 255 255 0'
'set rgb 61 255 236 0'
'set rgb 62 255 216 0'
'set rgb 63 255 196 0'
'set rgb 64 255 176 0'
'set rgb 65 255 156 0'
'set rgb 66 255 136 0'
'set rgb 67 255 112 0'
'set rgb 68 255 80 0'
'set rgb 69 255 0 0'
'set rgb 70 240 0 48'
'set rgb 71 224 0 72'
'set rgb 72 208 0 96'
'set rgb 73 192 0 120'
'set rgb 74 208 0 144'
'set rgb 75 224 0 168'
'set rgb 76 240 0 192'
'set rgb 77 255 0 216'
'set rgb 78 255 64 255'
'set rgb 79 255 104 255'

'sdfopen http://' base '/gfs_master/gfs' date '/gfs_master_' hour 'z'
if ( rc ); return; endif

'set t ' 1 + offs
'set lat 60 90'
'set lon -225 135'
'set grads off'
'set parea 1.5 9.5 .1 8.1'
'set frame circle'
'set mpdset hires'
'set mpt * 17'
'set mproj nps'
'set grid on 5 16'
'set cterp off'

'set gxout shaded'
'set clevs .1 .2 .5 1 1.5 2 2.5 3 3.5 4 4.5 5 6 7 8 9 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38'
'set ccols 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
'd mag(ugrd10m,vgrd10m)'
'set gxout stream'
'set strmden 1'
'set ccolor 18'
'd ugrd10m; vgrd10m'

'set string 1 bc 6'
'set strsiz .15 .18'
'draw string 5.5 8.2 GFS ' year '-' mon '-' day ' ' hour 'Z, 10m Wind, Valid +' valid 'h'

'set parea 9.7 9.9 .3 7.9'
'set frame on'
'set gxout contour'
'set t 1 2'
'set lon 0'
'set lat 0 39.999999'
'set xyrev on'
'set gxout shaded'
'set clevs .1 .2 .5 1 1.5 2 2.5 3 3.5 4 4.5 5 6 7 8 9 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38'
'set ccols 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
'set ylpos 0 r'
'set ylint 2'
'set ylab %2.0f'
'set xlab off'
'set grid horizontal 1 16'
'd lat'

'set string 1 bl 5'
'set strsiz .1 .12'
'draw string 9.8 8.1 m/s'

'printim wind.' year '-' mon '-' day '.' hour 'z+' valid '.png x1100 y850'

'quit'

precip.gs, precipitation

function main( args )

base= 'nomad1.ncep.noaa.gov:9090/dods'
*base= 'nomads6.ncdc.noaa.gov:9090/dods'
*base= 'nomad5.ncep.noaa.gov:9090/dods/nomad1-raid1'
*base= 'nomad3.ncep.noaa.gov:9090/dods'

date= subwrd( args, 1 )
hour= subwrd( args, 2 )
valid= subwrd( args, 3 )

year= substr( date, 1, 4 )
mon= substr( date, 6, 2 )
day= substr( date, 9, 2 )
date= year mon day
hour= substr( hour, 1, 2 )

offs= valid / 3
if ( valid < 100 ); if ( valid < 10 ); valid= '0' valid; endif; valid= '0' valid; endif

'reinit'
'set display color white'
'c'

'set rgb 16 128 128 128'
'set rgb 17 64 64 64'

'set rgb 40 128 0 160'
'set rgb 41 128 0 184'
'set rgb 42 128 0 208'
'set rgb 43 128 0 232'
'set rgb 44 128 0 255'
'set rgb 45 112 0 240'
'set rgb 46 96 0 224'
'set rgb 47 80 0 208'
'set rgb 48 0 0 192'
'set rgb 49 0 60 200'
'set rgb 50 0 88 208'
'set rgb 51 0 116 216'
'set rgb 52 0 144 224'
'set rgb 53 0 172 232'
'set rgb 54 0 200 240'
'set rgb 55 0 228 248'
'set rgb 56 0 255 255'
'set rgb 57 0 255 176'
'set rgb 58 128 255 64'
'set rgb 59 192 255 0'

'sdfopen http://' base '/gfs_master/gfs' date '/gfs_master_' hour 'z'
if ( rc ); return; endif

'set t 1'
'set lat 60 90'
'set lon -225 135'
'set grads off'
'set parea 1.5 9.5 .1 8.1'
'set frame circle'
'set mpdset hires'
'set mpt * 16'
'set mproj nps'
'set grid on 5 16'
'set cterp off'

'define precip= sum(const(oapcpsfc,0,-u),t=' offs - 5 ',t=' offs + 1 ',2)'

'set gxout shaded'
'set clevs 0 .1 .2 .5 1 2 3 4 5 7 10 15 20 25 30 40 50 60 70 80'
'set ccols 0 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40'
'd precip'

'set string 1 bc 6'
'set strsiz .15 .18'
'draw string 5.5 8.2 GFS ' year '-' mon '-' day ' ' hour 'Z, Daily Precipitation, Valid +' valid 'h'

'set parea 9.7 9.9 .3 7.9'
'set frame on'
'set gxout contour'
'set t 1 2'
'set lon 0'
'set lat 0 84.999999'
'set xyrev on'
'set gxout shaded'
'set clevs 0 .1 .2 .5 1 2 3 4 5 7 10 15 20 25 30 40 50 60 70 80'
'set ccols 0 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40'
'set ylpos 0 r'
'set ylint 5'
'set ylab %2.0f'
'set xlab off'
'set grid horizontal 1 16'
'd lat'

'set string 1 bl 5'
'set strsiz .1 .12'
'draw string 10 8.1 mm'

'printim precip.' year '-' mon '-' day '.' hour 'z+' valid '.png x1100 y850'

'quit'

cld.gs, clouds

function main( args )

base= 'nomad1.ncep.noaa.gov:9090/dods'
*base= 'nomads6.ncdc.noaa.gov:9090/dods'
*base= 'nomad5.ncep.noaa.gov:9090/dods/nomad1-raid1'
*base= 'nomad3.ncep.noaa.gov:9090/dods'

date= subwrd( args, 1 )
hour= subwrd( args, 2 )
valid= subwrd( args, 3 )

year= substr( date, 1, 4 )
mon= substr( date, 6, 2 )
day= substr( date, 9, 2 )
date= year mon day
hour= substr( hour, 1, 2 )

offs= valid / 3
if ( valid < 100 ); if ( valid < 10 ); valid= '0' valid; endif; valid= '0' valid; endif

'reinit'
'set display color white'
'c'

'set rgb 16 128 128 128'
'set rgb 17 64 64 64'

*'set rgb 32 0 0 0'
'set rgb 33 8 8 8'
'set rgb 34 16 16 16'
'set rgb 35 24 24 24'
'set rgb 36 32 32 32'
'set rgb 37 40 40 40'
'set rgb 38 48 48 48'
'set rgb 39 56 56 56'
*'set rgb 40 64 64 64'
'set rgb 41 72 72 72'
'set rgb 42 80 80 80'
'set rgb 43 88 88 88'
'set rgb 44 96 96 96'
'set rgb 45 104 104 104'
'set rgb 46 112 112 112'
'set rgb 47 120 120 120'
*'set rgb 48 128 128 128'
'set rgb 49 136 136 136'
'set rgb 50 144 144 144'
'set rgb 51 152 152 152'
'set rgb 52 160 160 160'
'set rgb 53 168 168 168'
'set rgb 54 176 176 176'
'set rgb 55 184 184 184'
'set rgb 56 192 192 192'
'set rgb 57 200 200 200'
'set rgb 58 208 208 208'
'set rgb 59 216 216 216'
'set rgb 60 224 224 224'
'set rgb 61 232 232 232'
'set rgb 62 240 240 240'
'set rgb 63 248 248 248'
*'set rgb 64 255 255 255'

'sdfopen http://' base '/gfs_master/gfs' date '/gfs_master_' hour 'z'
if ( rc ); return; endif

'set t 1'
'set lat 60 90'
'set lon -225 135'
'set grads off'
'set parea 1.5 9.5 .1 8.1'
'set frame circle'
'set mpdset hires'
'set mpt * 16'
'set mproj nps'
'set grid on 5 16'
'set cterp off'

'define cld= ave(otcdcclm,t=' offs - 5 ',t=' offs + 1 ',2)'

'set gxout shaded'
'set clevs 3.125 6.25 9.375 12.5 15.625 18.75 21.875 25 28.125 31.25 34.375 37.5 40.625 43.75 46.875 50 53.125 56.25 59.375 62.5 65.625 68.75 71.875 75 78.125 81.25 84.375 87.5 90.625 93.75 96.875 99.999999'
'set ccols 1 33 34 35 36 37 38 39 17 41 42 43 44 45 46 47 16 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 0'
'd cld'

'set string 1 bc 6'
'set strsiz .15 .18'
'draw string 5.5 8.2 GFS ' year '-' mon '-' day ' ' hour 'Z, Total Clouds, Daily Mean, Valid +' valid 'h'

'set parea 9.7 9.9 .3 7.9'
'set frame on'
'set gxout contour'
'set t 1 2'
'set lon 0'
'set lat 0 105'
'set xyrev on'
'set gxout shaded'
'set clevs 3.125 6.25 9.375 12.5 15.625 18.75 21.875 25 28.125 31.25 34.375 37.5 40.625 43.75 46.875 50 53.125 56.25 59.375 62.5 65.625 68.75 71.875 75 78.125 81.25 84.375 87.5 90.625 93.75 96.875 99.999999'
'set ccols 1 33 34 35 36 37 38 39 17 41 42 43 44 45 46 47 16 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 0'
'set ylpos 0 r'
'set ylint 10'
'set ylab %3.0f'
'set xlab off'
'set grid horizontal 1 16'
'd lat'

'set string 1 bl 5'
'set strsiz .1 .12'
'draw string 10 8.1 %'

'printim cld.' year '-' mon '-' day '.' hour 'z+' valid '.png x1100 y850'

'quit'

flux.gs, ground heat flux

function main( args )

base= 'nomad1.ncep.noaa.gov:9090/dods'
*base= 'nomads6.ncdc.noaa.gov:9090/dods'
*base= 'nomad5.ncep.noaa.gov:9090/dods/nomad1-raid1'
*base= 'nomad3.ncep.noaa.gov:9090/dods'

date= subwrd( args, 1 )
hour= subwrd( args, 2 )
valid= subwrd( args, 3 )

year= substr( date, 1, 4 )
mon= substr( date, 6, 2 )
day= substr( date, 9, 2 )
date= year mon day
hour= substr( hour, 1, 2 )

offs= valid / 3
if ( valid < 100 ); if ( valid < 10 ); valid= '0' valid; endif; valid= '0' valid; endif

'reinit'
'set display color white'
'c'

'set rgb 16 128 128 128'
'set rgb 17 64 64 64'

'set rgb 40 128 0 160'
'set rgb 41 128 0 184'
'set rgb 42 128 0 208'
'set rgb 43 128 0 232'
'set rgb 44 128 0 255'
'set rgb 45 112 0 240'
'set rgb 46 96 0 224'
'set rgb 47 80 0 208'
'set rgb 48 0 0 192'
'set rgb 49 0 60 200'
'set rgb 50 0 88 208'
'set rgb 51 0 116 216'
'set rgb 52 0 144 224'
'set rgb 53 0 172 232'
'set rgb 54 0 200 240'
'set rgb 55 0 228 248'
'set rgb 56 0 255 255'
'set rgb 57 0 255 176'
'set rgb 58 128 255 64'
'set rgb 59 192 255 0'
'set rgb 60 255 255 0'
'set rgb 61 255 236 0'
'set rgb 62 255 216 0'
'set rgb 63 255 196 0'
'set rgb 64 255 176 0'
'set rgb 65 255 156 0'
'set rgb 66 255 136 0'
'set rgb 67 255 112 0'
'set rgb 68 255 80 0'
'set rgb 69 255 0 0'
'set rgb 70 240 0 48'
'set rgb 71 224 0 72'
'set rgb 72 208 0 96'
'set rgb 73 192 0 120'
'set rgb 74 208 0 144'
'set rgb 75 224 0 168'
'set rgb 76 240 0 192'
'set rgb 77 255 0 216'
'set rgb 78 255 64 255'
'set rgb 79 255 104 255'

'sdfopen http://' base '/gfs_master/gfs' date '/gfs_master_' hour 'z'
if ( rc ); return; endif

'set t 1'
'set lat 60 90'
'set lon -225 135'
'set grads off'
'set parea 1.5 9.5 .1 8.1'
'set frame circle'
'set mpdset hires'
'set mpt * 16'
'set mproj nps'
'set grid on 5 16'
'set cterp off'

'define flux= ave(const(ogfluxsfc,0,-u),t=' offs - 5 ',t=' offs + 1 ',2) * -0.0864'

'set gxout shaded'
'set clevs -10 -9 -8 -7 -6.5 -6 -5.5 -5 -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -.5 -.2 -.1 -.000001 .000001 .1 .2 .5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 8 9 10'
'set ccols 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 0 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
'd flux'

'set string 1 bc 6'
'set strsiz .15 .18'
'draw string 5.5 8.2 GFS ' year '-' mon '-' day ' ' hour 'Z, Daily Ground Heat Flux, Valid +' valid 'h'

'set parea 9.7 9.9 .3 7.9'
'set frame on'
'set gxout contour'
'set t 1 2'
'set lon 0'
'set lat -10.5 10.5'
'set xyrev on'
'set gxout shaded'
'set clevs -10 -9 -8 -7 -6.5 -6 -5.5 -5 -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -.5 -.2 -.1 0 .1 .2 .5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 8 9 10'
'set ccols 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79'
'set ylpos 0 r'
'set ylint 1'
'set ylab %+3.0f'
'set xlab off'
'set grid horizontal 1 16'
'd lat'

'set string 1 bl 5'
'set strsiz .1 .12'
'draw string 9.8 8.1 MJ/m`a2'

'printim flux.' year '-' mon '-' day '.' hour 'z+' valid '.png x1100 y850'

'quit'