GFS-maps & meteograms

You are welcome :slight_smile:

seems your nordic.gs is set to generate all the files online on the web server of nordicweather, the paths for the output files will not work for you, if I find some time I can edit the script to work for you and your local drive.

I do not have a single script for all variables…I use my own scripts, one script = one variable, running about 30 scripts automatically after each GFS run, and posting them with TurboFTP to my web site.
Hope I will have a separate dedicated Linux box for GFS and my own WRF runs soon :slight_smile:

Here another example to calc Temperature 2m :

function main(args)

  • Parse the arguments: date, hour
    if (args = ‘’)
    prompt 'Enter forecast date (example, 20110717) → ’
    pull date
    prompt 'Enter forecast hour (example, 00 or 06 or 12 or 18) → ’
    pull hour
    else
    date = subwrd(args,1)
    hour = subwrd(args,2)
    endif

‘reinit’
‘sdfopen http://nomads.ncep.noaa.gov:9090/dods/gfs_hd/gfs_hd’date’/gfs_hd_'hour’z

  • Get info from the descriptor file
    ‘q ctlinfo’
    _ctl = result
    _undef = getctl(undef)
    _tdef = getctl(tdef)
    _zdef = getctl(zdef)

maps = 61

  • Get the Time axis info
    tsize = subwrd(_tdef,2)
    _t1 = 1 ;* 2nd half of timeseries
    _t2 = 45
    tsize = _t2 - _t1 + 1
    'set t ‘_t1’ ‘_t2
    ‘q dims’
    times = sublin(result,5)
    _time1 = subwrd(times,6)
    _time2 = subwrd(times,8)
    _tdim = _time1’ '_time2

tincr = subwrd(_tdef,5)
_tdef = 'tdef ‘tsize’ linear ‘_time1’ 'tincr

huh = subwrd(_tdef,4)

‘clear’


  • TEMPERATURE + RH 850hPa

i = 1
while ( i<maps )

  • Set up a few preliminary characteristics
    setmap(1)
    *setTeOsPtcols(1)

'set t 'i

‘define t2m=tmp2m-273.16’

*‘set gxout shaded’
‘set csmooth on’
*‘set clevs -20 -18 -16 -14 -12 -10 -8 -6 -4 -2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28’
*‘set ccols 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83’

‘color -gxout shaded -40 40 0.4 -kind maroon->white->fuchsia->navy->aqua->mediumspringgreen->yellow->red->violet -xcbar 10.1 10.3 0.7 7.74 -fs 10’

‘d t2m’

*‘cbarn’

‘set gxout grid’
‘set gridln off’
‘set cthick 5’
‘set ccolor 1’

‘d skip(t2m,2,2)’

‘set line 1 1 20’
‘draw shp SVK_adm0’

‘q dims’
times = sublin(result,5)
hub = subwrd(times,6)

‘set strsiz 0.12’
‘set string 1 r 3 90’ ; ‘draw string 9.9 4.6 T2m (st.C)’

‘set strsiz 0.10’
‘set string 1 r 3 0’ ; ‘draw string 9.35 0.75 Mapa (c) AMS EmsiWx Bytca, www.pocasie-bytca.sk’

‘set strsiz 0.12’
‘set string 1 r 3 0’ ; 'draw string 9.45 0.4 Plati pre: 'hub
‘set string 1 l 3 0’ ; 'draw string 0.15 0.2 Data: Model GFS, Beh modelu z 'huh

  • Draw Labels at the top of the page
    ‘set string 1 r 11 0’
    ‘set strsiz 0.14’
    ‘set string 1 l 6 0’ ; ‘draw string 0.15 0.4 Teplota v 2 metroch’

‘printim Mapy/sync/t2meu/gfs_eu_t2m’i+10’.png x900 y675’

i = i+1
endwhile


  • END OF MAIN SCRIPT

function setmap(args)
‘set mproj nps’
‘set mpvals 0 38 37 61’
‘set lon -15 53’
‘set lat 5 90’
‘set mpdset newmap’

‘set rgb 98 238 238 238’
‘set display color white’
‘set map 1 1 5’
‘set background 98’
‘c’
‘set grid off’
‘set grads off’

‘set parea 0.02 9.54 0.8 8.50’
‘set rgb 99 1 1 1’
‘set line 99 1 6’
*‘draw rec 0.02 0.02 9.54 0.81’
*‘draw rec 9.54 0.02 10.99 8.48’

return

function setcols(args)

‘set rgb 175 73 172 255’
‘set rgb 176 82 176 255’
‘set rgb 177 91 180 255’
‘set rgb 178 100 184 255’
‘set rgb 179 109 188 255’
‘set rgb 180 118 192 255’
‘set rgb 181 127 196 255’
‘set rgb 182 136 200 255’
‘set rgb 183 145 204 255’
‘set rgb 184 154 208 255’
‘set rgb 185 163 212 255’
‘set rgb 186 172 216 255’
‘set rgb 187 181 220 255’
‘set rgb 188 190 224 255’
‘set rgb 189 199 228 255’
‘set rgb 190 208 232 255’
‘set rgb 191 217 236 255’
‘set rgb 192 226 240 255’
‘set rgb 193 235 244 255’
‘set rgb 194 244 248 255’
‘set rgb 195 253 252 255’
*Light blue

‘set rgb 20 234 245 234’
‘set rgb 21 200 215 200’
‘set rgb 22 160 205 160’
‘set rgb 23 120 215 120’
‘set rgb 24 80 235 80’
‘set rgb 25 0 255 0’
‘set rgb 26 0 195 0’
‘set rgb 27 0 160 0’
‘set rgb 28 0 125 0’

‘set rgb 30 255 160 120’
‘set rgb 31 160 120 255’
‘set rgb 32 160 180 205’

‘set rgb 42 32 208 32’
‘set rgb 43 208 32 208’
‘set rgb 44 64 64 255’
‘set rgb 45 255 120 32’
‘set rgb 46 32 208 208’
‘set rgb 47 240 240 0’

‘set rgb 96 139 115 85’
‘set rgb 97 100 100 100’
‘set rgb 98 64 64 96’
‘set rgb 99 254 254 254’

  • farby pre geopotencialny rozdiel
    ‘set rgb 100 0 180 255’
    ‘set rgb 101 0 200 200’
    ‘set rgb 102 0 205 170’
    ‘set rgb 103 0 210 140’
    ‘set rgb 104 0 215 70’
    ‘set rgb 105 0 220 0’
    ‘set rgb 106 80 225 25’
    ‘set rgb 107 160 230 50’
    ‘set rgb 108 195 225 50’
    ‘set rgb 109 230 220 50’
    ‘set rgb 110 230 195 47’
    ‘set rgb 111 230 175 45’
    ‘set rgb 112 235 155 42’
    ‘set rgb 113 240 130 40’
    ‘set rgb 114 248 65 20’
    ‘set rgb 115 255 0 0’
    ‘set rgb 116 255 30 30’
    ‘set rgb 117 250 60 60’
    ‘set rgb 118 245 30 95’
    ‘set rgb 119 240 0 130’
    ‘set rgb 120 235 0 150’
    ‘set rgb 121 230 0 160’
    ‘set rgb 122 225 0 170’

  • farby pre zmenu teploty
    ‘set rgb 130 80 130 120’
    ‘set rgb 131 120 110 150’
    ‘set rgb 132 180 160 180’
    ‘set rgb 133 160 0 200’
    ‘set rgb 134 135 0 210’
    ‘set rgb 135 110 0 220’
    ‘set rgb 136 70 30 238’
    ‘set rgb 137 30 60 255’
    ‘set rgb 138 15 110 255’
    ‘set rgb 139 0 160 255’
    ‘set rgb 140 54 180 255’
    ‘set rgb 141 60 200 200’
    ‘set rgb 142 144 212 205’
    ‘set rgb 143 185 238 215’
    ‘set rgb 144 224 254 250’
    ‘set rgb 145 255 255 255’
    ‘set rgb 146 246 254 215’
    ‘set rgb 147 240 245 170’
    ‘set rgb 148 232 232 130’
    ‘set rgb 149 230 225 70’
    ‘set rgb 150 230 200 50’
    ‘set rgb 151 230 175 45’
    ‘set rgb 152 235 152 42’
    ‘set rgb 153 240 130 40’
    ‘set rgb 154 245 95 50’
    ‘set rgb 155 250 60 60’
    ‘set rgb 156 245 30 95’
    ‘set rgb 157 240 0 130’
    ‘set rgb 158 235 0 150’
    ‘set rgb 159 220 0 180’
    ‘set rgb 160 200 0 200’

return

function setTeOsPtcols(args)

‘set rgb 33 248 50 60’
‘set rgb 34 255 50 89’
‘set rgb 35 255 50 185’
‘set rgb 36 248 50 255’
‘set rgb 37 224 50 255’
‘set rgb 38 195 50 255’
‘set rgb 39 175 50 255’
‘set rgb 40 161 50 255’
‘set rgb 41 137 50 255’
‘set rgb 42 118 74 255’
‘set rgb 43 98 74 255’
‘set rgb 44 79 50 255’
‘set rgb 45 50 50 255’
‘set rgb 46 50 74 255’
‘set rgb 47 50 89 255’
‘set rgb 48 50 113 255’
‘set rgb 49 50 146 255’
‘set rgb 50 50 175 255’
‘set rgb 51 50 204 255’
‘set rgb 52 50 224 255’
‘set rgb 53 50 255 253’
‘set rgb 54 50 255 228’
‘set rgb 55 50 255 200’
‘set rgb 56 50 255 161’
‘set rgb 57 50 255 132’
‘set rgb 58 50 255 103’
‘set rgb 59 50 255 79’
‘set rgb 60 50 255 60’
‘set rgb 61 79 255 50’
‘set rgb 62 132 255 50’
‘set rgb 63 171 255 50’
‘set rgb 64 204 255 50’
‘set rgb 65 224 255 50’
‘set rgb 66 253 255 50’
‘set rgb 67 255 233 50’
‘set rgb 68 255 224 50’
‘set rgb 69 255 209 50’
‘set rgb 70 255 204 50’
‘set rgb 71 255 185 50’
‘set rgb 72 255 161 50’
‘set rgb 73 255 146 50’
‘set rgb 74 255 127 50’
‘set rgb 75 255 118 50’
‘set rgb 76 255 93 50’
‘set rgb 77 255 74 50’
‘set rgb 78 255 60 50’
‘set rgb 79 255 33 33’
‘set rgb 80 255 0 0’
‘set rgb 81 235 10 0’
‘set rgb 82 215 20 0’
‘set rgb 83 195 30 0’
‘set rgb 84 175 40 0’
‘set rgb 85 165 45 0’
‘set rgb 86 155 50 0’
‘set rgb 87 145 55 0’
‘set rgb 88 135 60 0’
‘set rgb 89 120 60 0’
‘set rgb 90 100 60 0’
‘set rgb 91 80 60 0’
‘set rgb 20 250 240 230’
‘set rgb 21 240 220 210’
‘set rgb 22 225 190 180’
‘set rgb 23 200 160 150’
‘set rgb 24 180 140 130’
‘set rgb 25 160 120 110’
‘set rgb 26 140 100 90’

return


function vrng(f1,f2)
‘set gxout stat’
'd 'f1
data = sublin(result,8)
ymx = subwrd(data,5)
ymn = subwrd(data,4)
'd 'f2
data = sublin(result,8)
zmx = subwrd(data,5)
zmn = subwrd(data,4)
if (zmx > ymx) ; ymx = zmx ; endif
if (zmn < ymn) ; ymn = zmn ; endif
dy = ymx-ymn
ymx = ymx + 0.08 * dy
ymn = ymn - 0.08 * dy
if ((ymx-ymn)/2.2 < 1)
incr = (ymx-ymn)/4
incr = 0.01 * (math_nint(100*incr))
else
incr = math_nint((ymx-ymn)/4)
endif
'set vrange ‘ymn’ 'ymx
'set ylint 'incr
if (ymn=0 & ymx=0 & incr=0)
‘set vrange -.9 .9’
‘set ylint 1’
endif
‘set gxout line’
return


function rh2vrng(f1)
‘set gxout stat’
'd 'f1
data = sublin(result,8)
ymn = subwrd(data,4)
ymx = subwrd(data,5)
if (ymn < 20)
miny = 0
‘set ylevs 20 40 60 80’
endif
if (ymn >= 20 & ymn < 30)
miny = 20
‘set ylevs 30 50 70 90’
endif
if (ymn >= 30 & ymn < 40)
miny = 30
‘set ylevs 40 50 60 70 80 90’
endif
if (ymn >= 40 & ymn < 50)
miny = 40
‘set ylevs 50 60 70 80 90’
endif
if (ymn >= 50 & ymn < 60)
miny = 50
‘set ylevs 60 70 80 90’
endif
if (ymn >= 60)
miny = 60
‘set ylevs 70 80 90’
endif
'set vrange ‘miny’ 'ymx+3
return


function getctl(handle)
line = 1
found = 0
while (!found)
info = sublin(_ctl,line)
if (subwrd(info,1)=handle)
_handle = info
found = 1
endif
line = line + 1
endwhile
return _handle


function getgrid(dodsvar,myvar)

'set lon '_xdim
'set lat '_ydim
'set lev '_zgrd
'set time '_tdim

  • Write the variable to a file
    ‘set gxout fwrite’
    ‘set fwrite dummy.dat’
    'd 'dodsvar
    ‘disable fwrite’

  • Write a descriptor file
    rc = write(dummy.ctl,‘dset ^dummy.dat’)
    rc = write(dummy.ctl,_undef,append)
    rc = write(dummy.ctl,‘xdef 1 linear 1 1’,append)
    rc = write(dummy.ctl,‘ydef 1 linear 1 1’,append)
    rc = write(dummy.ctl,_zdef,append)
    rc = write(dummy.ctl,_tdef,append)
    rc = write(dummy.ctl,‘vars 1’,append)
    rc = write(dummy.ctl,‘dummy ‘_newzsize’ -999 dummy’,append)
    rc = write(dummy.ctl,‘endvars’,append)
    rc = close (dummy.ctl)

  • Open the dummy file, define variable, close dummy file
    ‘open dummy.ctl’
    line = sublin(result,2)
    dummyfile = subwrd(line,8)
    'set dfile 'dummyfile
    ‘set lon 1’
    ‘set lat 1’
    'set lev ‘_zbot’ '_ztop
    'set time ‘_time1’ '_time2
    'define ‘myvar’ = dummy.'dummyfile
    'close 'dummyfile
    ‘set dfile 1’
    return


function getetarh(dodsvar,myvar)

  • swap out original pressure vars
    tmpzgrd = _zgrd
    tmpzdef = _zdef
    tmpzbot = _zbot
    tmpztop = _ztop
    tmpzsize = _newzsize

  • retrieve rh data over the rh pressure range
    _zgrd = _rhzgrd
    _zdef = _trhzdef
    _ztop = _rhztop
    _zbot = _rhzbot
    _newzsize = _trhzsize
    getgrid(dodsvar,tmprh)

  • swap in original pressure vars
    _zgrd = tmpzgrd
    _zdef = tmpzdef
    _zbot = tmpzbot
    _ztop = tmpztop
    _newzsize = tmpzsize

'set lon '_xdim
'set lat '_ydim
'set lev '_rhzgrd
'set time '_tdim

  • Write the variable to a file
    ‘set gxout fwrite’
    ‘set fwrite dummy.dat’
    t = _t1
    while (t <= _t2)
    'set t 't
    z = 1
    while (z <= _newrhzsize)
    level = subwrd(_rhlevs,z)
    'set lev 'level
    ‘d tmprh’
    z = z + 1
    endwhile
    t = t + 1
    endwhile
    ‘disable fwrite’

  • Write a descriptor file
    rc = write(dummy.ctl,‘dset ^dummy.dat’)
    rc = write(dummy.ctl,_undef,append)
    rc = write(dummy.ctl,‘xdef 1 linear 1 1’,append)
    rc = write(dummy.ctl,‘ydef 1 linear 1 1’,append)
    rc = write(dummy.ctl,_rhzdef,append)
    rc = write(dummy.ctl,_tdef,append)
    rc = write(dummy.ctl,‘vars 1’,append)
    rc = write(dummy.ctl,‘dummy ‘_newrhzsize’ -999 dummy’,append)
    rc = write(dummy.ctl,‘endvars’,append)
    rc = close (dummy.ctl)

  • Open the dummy file, define variable, close dummy file
    ‘open dummy.ctl’
    line = sublin(result,2)
    dummyfile = subwrd(line,8)
    'set dfile 'dummyfile
    ‘set lon 1’
    ‘set lat 1’
    'set lev ‘_rhzbot’ '_rhztop
    'set time ‘_time1’ '_time2
    ‘q dims’
    'define ‘myvar’ = dummy.'dummyfile
    'close 'dummyfile
    ‘set dfile 1’

return


function getseries(dodsvar,myvar,level)

'set lon '_xdim
'set lat '_ydim
'set lev ‘level’ 'level
'set time '_tdim

  • Write the variable to a file
    ‘set fwrite dummy.dat’
    ‘set gxout fwrite’
    'd 'dodsvar
    ‘disable fwrite’

  • Write a descriptor file
    rc = write(dummy.ctl,‘dset ^dummy.dat’)
    rc = write(dummy.ctl,_undef,append)
    rc = write(dummy.ctl,‘xdef 1 linear 1 1’,append)
    rc = write(dummy.ctl,‘ydef 1 linear 1 1’,append)
    rc = write(dummy.ctl,‘zdef 1 linear 1 1’,append)
    rc = write(dummy.ctl,_tdef,append)
    rc = write(dummy.ctl,‘vars 1’,append)
    rc = write(dummy.ctl,‘dummy 0 -999 dummy’,append)
    rc = write(dummy.ctl,‘endvars’,append)
    rc = close(dummy.ctl)

  • Open the dummy file, define variable, close dummy file
    ‘open dummy.ctl’
    line = sublin(result,2)
    dummyfile = subwrd(line,8)
    'set dfile 'dummyfile
    ‘set lon 1’
    ‘set lat 1’
    'set lev 'level
    'set time ‘_time1’ '_time2
    'define ‘myvar’ = dummy.'dummyfile
    'close 'dummyfile
    ‘set dfile 1’
    ‘set gxout contour’

return

Really great!
Last question (for today :smiley: ):

If i would run opengrads automatically and upload all maps on my webspace.
I could use systemscheduler to open the program but after that, who will write run pcptype.gs with latest gfs run?
And how to upload all map images extract to my webhost?

Thank you very much,

Alessandro

Yes you can use the WIN built in scheduler and you as batch file like e.g. pcptype.bat

@ECHO OFF
set FileDate=%date:~9,4%%date:~6,2%%date:~3,2%
set FileTime=%time:~0,2%

if /i %FileTime% gtr 00 (
set T=12
set /a FD=%FileDate% - 1
)
if /i %FileTime% gtr 01 (
set T=18
set /a FD=%FileDate% - 1
)
if /i %FileTime% gtr 05 (
set T=00
set FD=%FileDate%
)
if /i %FileTime% gtr 11 (set T=06)
if /i %FileTime% gtr 17 (set T=12)
@echo Year = %FD%
@echo Time = %FileTime%
echo %T%

opengrads -lbxc ‘pcptype.gs %FD% %T%’


It auto detects the time when you run it and use it for the latest GFS run (Now I have the runs set to 6,12,18,02 hours CET)

Then I also auto run the programm TurboFTP which uploads all the new files to my web page.

Great!
Thank you very much!
You have opened myself a new world :slight_smile:
Regards,

Alessandro

Anytime, ur welcome :slight_smile:

Would you have any questions, just ask.

Have a good night :slight_smile:

EmsiWx

Hi EmsniWx,
finally i’ve made nordic.gs workable :smiley: :smiley:
Only one problem.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* END OF MAIN SCRIPT
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

function setmap(args)
'set mproj nps'
'set mpvals 15 52 54 71'
'set lon -60 80'
'set lat 10 80'
'set mpdset hires'

Is it possible to zoom map near my country (Italy)?

Edit: I’ve tried to load .bat file but i’ve this error:

http://imgur.com/3x2QGG2
Any idea?

Regards,

Alessandro


nordic.gs.txt (37.7 KB)

Glad you got it sorted. :slight_smile:

Do you happen to have a linky with info on the WRF stuff?

/Chris

Edit: I had to remove the :9090 part in My script for it to work.

Hi,

you need to run the bat file at times 6,12,18,02 CET, otherwise you get that error msg, because it is trying to do the new forecast, but the data file is not ready on the server.

I will try to workout the Italy rgion for you…

EmsiWx

Many thanks Emnsi!
What about zoom?

I’ve noticed that on nordic.gs script there aren’t 500hpa/850hpa temperature and 700hpa vertikalbew.
Is there anyone has these “functions”?
Regards,

Alessandro

Hi guys,
any help about my last questions?
I’ve this error on temperature 850hpa:

http://imgur.com/Zw5mBcC

Thanks in advance,

Alessandro

Hi I have noticed that since 12z 27/May that the noaa server has been having issues and as a result opengrads scripts are not updating.

1: if for example you look at http://nomads.ncep.noaa.gov:9090/dods/gfs_0p25/gfs20180528/gfs_0p25_18z.das it may display the correct data, though if you refresh browser it will result in:

Error {
    code = 0;
    message = "extraction failed; not enough lat data in /tomcat_cache/gds/grads/dods/gfs_0p25/gfs20180528/gfs_0p25_18z.lat.output";
};

Then do the same again again : may result in:

Error {
    code = 0;
    message = "/gfs_0p25/gfs20180528/gfs_0p25_18z is not an available dataset";
};

I assume when opengrads script hit these issues they crash.

I also wonder if this impact any of the WxSim data imports. prior to Chris/Sam’s process’s

I see that other sites not just mine are showing old maps : https://silveracorn.nz/weather/wxgfs_slp10mw.php and http://www.leavening.org/gfs/ as a couple of examples.

Any one know anything about this ?

Kind regards,

So, after all the pain in getting these scripts working, I noticed last week that it all stopped and my images are now out of date.

A quick look at the Nomads site appears to say that they moved to a secure server so it

Hi,

if you are using OpenGrADS under WIN, you have to wait for the new version, which supports ssl (https) communication.

They are working on it.

Marian

Ah! I am using windoze. Thank you. How annoying, I wonder how long it will take?

I tried grabbing the files with wget so I could process them locally without having to use https in OpenGrads but that also failed. I wonder if I

The new OpenGrADS is out:

https://sourceforge.net/projects/opengrads/files/grads2/2.2.1.oga.1/Windows/

Marian

Hi Marian,
Long Speak no Time.
Would I be Correct/Wrong in assuming that the new version of OpenGrads would require Minor/Major changes to our existing .gs scripts.
Kind Regards,
Hope you are well, Tony

Thnx. I saw this yesterday but am having problems updating GrADS.

Both the .gz and the Windows Superpack are missing the grads.exe executable.

Obviously it

I downloaded the new Superpack this morning and installed it. My modified version of Nordic.gs works but the background and legend colours are not right yet. I will have a further play today.

Chris

Hi Chris,

Did you install over existing install? I definitely have no exes in my install?

Regards, Simon

Simon,
I simply saved my scripts (and cbarm - in OpenGrADS/Contents/Resources), uninstalled OpenGrADS and then downloaded the superpack from Sourceforge using the link from Marian. I then reinstalled the missing files and all seemed to work.

I do have issues - the legends are all in white as opposed the original black. I will edit my Nordic.gs script to correct them, but I suspect that there must me a simpler solution.

Chris