[gradsusr] meteogram prec

Matthias Malik Matthias.Malik at arcor.de
Sun Nov 28 09:39:23 EST 2010


Hi... O.k. you are picking single grid points...

try this:
(i tried, you can see the result at the attached picture,
green line is with mask, white line is without the mask)

(...)
say 'calculating meteogram 1...'  

'set string 1'
'set strsiz 0.10'
'draw string 3.0 0.3 (green flat line: indicative snow/rain treshold of
528 gpdam)'
'draw string 3.0 0.1 Source data: NCEP - maps (c) Karim Hamid'

****
'set t 2 'n''
'mask=sumg(1,t=1,t-0,2)-sumg(1,t=1,t-1,2)'

* you can use the mask as following (also with other time settings)
'd tloop(apcpsfc-mask*const(apcpsfc(t-1),0,-u))'

* for convective precip
'd tloop(acpcpsfc-mask*const(acpcpsfc(t-1),0,-u))'

****

(...)

Am Sonntag, den 28.11.2010, 11:05 +0100 schrieb eric delaere:
> It seems not to work with me, the resulting precipitation is the same
> as the original apcpsfc values and are too high...
> see http://users.fulladsl.be/~spb4195/gfs/meteogram/t2m.png for lat:
> 51 lon 4 and compare with READY
> (http://users.fulladsl.be/spb4195//89054419_metgram.gif)
> I'm not a specialist of Grads thus perhaps I do something stupid :-) ?
> 
> 
> function main( args )
> 'reinit'
> 
> date= subwrd( args, 2 )
> datum= substr( date, 7, 4 )
> mon= substr( date, 1, 2 )
> day= substr( date, 4, 2 )
> 
> run=  subwrd( args, 1)
> run=  substr( run, 1, 2)
> 
> 'set display color white'
> 'clear'
> 'set display color white'
> 
> 'sdfopen
> http://nomads.ncep.noaa.gov:9090/dods/gfs_hd/gfs_hd'datum''mon''day'/gfs_hd_'run'z'
> 
> 'q time'
> res = subwrd(result,3)
> datum2 = substr(res,4,9)
> 
> 'clear'
> 'set display color white'
> 
> say 'calculating pre-data  ==> Ok!'  
> 
> lus = 0
> 'define prectemp = 0'
> 
> 'q time'
> res = subwrd(result,3)
> datum2 = substr(res,4,9)
> 
> 'set mpt * 1'
> 'set mpdset hires'
> 'set grid off'
> 
> 'q time'
> res = subwrd(result,3)
> datum2 = substr(res,4,9)
> 
> 
> ***lus welke controleert of er een file is en dat voor 2.5 uur (13.650
> tellen)****
> while (datum2 = n & lus<13650)
> 'sdfopen
> http://nomads.ncep.noaa.gov:9090/dods/gfs_hd/gfs_hd'datum''mon''day'/gfs_hd_'run'z'
> 'q time'
> res = subwrd(result,3)
> datum2 = substr(res,4,9)
> say 'file not open yet, waiting for correct file... 'lus' of 13.650
> attempts'
> lus=lus+1
> endwhile
> 
> ***script wordt enkel uitgevoerd als er een file is en zo wordt
> deleten alle kaarten vermeden***
> if (datum2 != n)
> 
> *termijn (norm: 65)
> n = 65
> 
> 'clear'
> 'set display color white'
> 
> 'q time'
> res = subwrd(result,3)
> datum2 = substr(res,4,9)
> uur =  substr(res,1,2)
> dag = subwrd(result,6)
> fff = substr(dag,1,2)
> 
> say 'calculating meteogram 1...'  
> 
> 'set string 1'
> 'set strsiz 0.10'
> 'draw string 3.0 0.3 (green flat line: indicative snow/rain treshold
> of 528 gpdam)'
> 'draw string 3.0 0.1 Source data: NCEP - maps (c) Karim Hamid'
> 
> 'set dfile 'args
> 'mask=sumg(1,t=1,t-0,2)-sumg(1,t=1,t-1,2)'
> _trr = 'tloop(apcpsfc-mask*const(apcpsfc(t-1),0,-u))'
> _trrc = 'tloop(apcpsfc-mask*const(apcpsfc(t-1),0,-u))'
> 
> 'set t 1 'n''
> 
> 'define z500= hgtprs(lev=500)'
> 'define z850= hgtprs(lev=850)'
> 'define z1000= hgtprs(lev=1000)'
> 'define th500a = (z500-z1000)/10'
> 'define th500av = 528'
> 
> 'set grid on 5 15'
> 
> 'set clopts -1 -1 0.12'
> 
> 'set ccolor 2'
> 'set lat 51'
> 'set lon 4'
> 'set ccolor 4'
> 'set axlim 510 550'
> 'set yaxis 510 550 5'
> 'display th500a'
> 
> 'set ylab off'
> 'set cmark 0'
> 'set ccolor 3'
> 'set cthick 6'
> 'set axlim 510 550'
> 'set yaxis 510 550 5'
> 'display th500av'
> 
> 'draw title 1000-500 thickness (gpdam) -  Brussels\'dag'
> 'datum2' (run: GFS'run'z)'
> 'printim c:\model\upload\meteogram\th1000500.png'
> 
> 'set t 1 'n''
> 
> clear
> 'set display color white'
> clear
> 
> say 'calculating meteogram 2...'  
> 
> 'set string 1'
> 'set strsiz 0.10'
> 'draw string 3.0 0.3 (green flat line: indicative snow/rain treshold
> of 129 gpdam)'
> 'draw string 3.0 0.1 Source data: NCEP - maps (c) Karim Hamid'
> 'set ylab on'
> 'set grid on 5 1'
> 
> 'define th850a = (z850-z1000)/10'
> 'define th850av = 129'
> 
> 'set ccolor 2'
> 'set lat 51'
> 'set lon 4'
> 'set ccolor 4'
> 'set axlim 124 138 2'
> 'set yaxis 124 138 2'
> 'display th850a'
> 
> 'set ylab off'
> 'set cmark 0'
> 'set ccolor 3'
> 'set cthick 6'
> 'set axlim 124 138 2'
> 'set yaxis 124 138 2'
> 'display th850av'
> 
> 'draw title 1000-850 thickness (gpdam) -  Brussels\'dag'
> 'datum2' (run: GFS'run'z)'
> 'printim c:\model\upload\meteogram\th1000850.png'
> 
> clear
> 'set display color white'
> clear
> 
> say 'calculating meteogram 3...'  
> 
> 'set string 1'
> 'set strsiz 0.10'
> 'draw string 3.0 0.3 (blue flat line: hypothermia possible/purple flat
> line: frosbit possible)'
> 'draw string 3.0 0.1 Source data: NCEP - maps (c) Karim Hamid'
> 
> 'set t 1 'n''
> 
> 'define td=(tmp2m-273.15)-((14.55
> +0.114*(tmp2m-273.15))*(1-0.01*rh2m)+pow((2.5
> +0.007*(tmp2m-273.15))*(1-0.01*rh2m),3)+(15.9
> +0.117*(tmp2m-273.15))*pow((1-0.01*rh2m),14))'
> 'define dewp2m = td+273.15'
> 'define t2m = tmp2m-273.15'
> 
> ********************TWmsl*********************
> 'define tw = ((-5.806+(0.672*t2m))-(0.006*(t2m*t2m))+((0.061
> +(0.004*t2m)+(0.000099*(t2m*t2m)))*rh2m)+(((-0.000033-(0.000005*t2m)-(0.0000001*(t2m*t2m))))*(rh2m*rh2m)))'
> ********************TWmsl*********************
> 
> 'define wind = mag(ugrd10m,vgrd10m)'
> 'define W =  mag(ugrd10m,vgrd10m)*2.2369363'
> 'define T =  (9/5)*(tmp2m-273.15)+32'
> 'define chillf=  35.74
> +(0.6215*T)-(35.75*pow(W,0.16))+(0.4275*T*pow(W,0.16))'
> 'define chill =  (chillf-32)*(5/9)'
> 
> 'define t2m0 = 0'
> 'define chilla = -10'
> 'define chillb = -18'
> 
> 'set t 1 'n''
> 
> 'define tw0 = 0'
> 
> 'set ylab on'
> 'set ccolor 2'
> 'set lat 50.5'
> 'set lon 4.5'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'display t2m'
> 
> 'set cmark 0'
> 'set ylab off'
> 'set cthick 6'
> 'set ccolor 1'
> 'display t2m0'
> 
> 'set ylab on'
> 'set ccolor 4'
> 'set lat 51'
> 'set lon 4'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'set cthick 3'
> 'display chill'
> 
> 'set cmark 0'
> 'set ylab off'
> 'set cthick 6'
> 'set ccolor 4'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'display chilla'
> 
> 'set cmark 0'
> 'set ylab off'
> 'set cthick 6'
> 'set ccolor 14'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'display chillb'
> 
> 'draw title T2m & Windchill (JAG/TI) (°C) - Brussels\'dag'
> 'datum2' (run: GFS'run'z)'
> 'printim c:\model\upload\meteogram\tw.png'
> 
> clear
> 'set display color white'
> clear
> 
> say 'calculating meteogram 4...'  
> 
> 'set string 1'
> 'set strsiz 0.10'
> 'draw string 3.0 0.1 Source data: NCEP - maps (c) Karim Hamid'
> 
> 'set t 1 'n''
> 
> 'q time'
> res = subwrd(result,3)
> datum2 = substr(res,4,9)
> uur =  substr(res,1,2)
> dag = subwrd(result,6)
> fff = substr(dag,1,2)
> 
> 'define t2m0 = 0'
> 
> 'set xlab on'
> 'set ylab on'
> 'set ccolor 2'
> 'set lat 51'
> 'set lon 4'
> 'set axlim -15 15'
> 'set yaxis -15 15 2'
> 'display tmp2m-273.15'
> 
> 'set cmark 0'
> 'set ylab off'
> 'set ccolor 4'
> 'set cthick 6'
> 'set axlim -15 15'
> 'set yaxis -15 15 2'
> 'display t2m0'
> 
> 'set ccolor 7'
> 'set ccolor 4'
> 'set axlim -15 15'
> 'set yaxis -15 15 2'
> 'set cthick 4'
> 'display tw'
> 
> 'set ylpos 0 r'
> 'set xlab on'
> 'set ylab on'
> 'set axlim 0 5'
> 'set yaxis 0 5 1'
> 'set gxout bar'
> 'set barbase 0'
> 'set bargap 50'
> 'set ccolor 11'
> 'set grid off'
> 'd '_trr
> 
> 'draw title T2m temperature (red) & Tw2m (blue) -  Brussels\'dag'
> 'datum2' (run: GFS'run'z)'
> 'printim c:\model\upload\meteogram\t2m.png'
> 
> clear
> 'set display color white'
> clear
> 
> say 'calculating meteogram 5...'  
> 
> 'set gxout line'
> 
> 'set string 1'
> 'set strsiz 0.10'
> 'draw string 3.0 0.3 (blue flat line: hypothermia possible/purple flat
> line: frosbit possible)'
> 'draw string 3.0 0.1 Source data: NCEP - maps (c) Karim Hamid'
> 
> 'set t 1 'n''
> 'set lat 51'
> 'set lon 3'
> 
> 'define wind = mag(ugrd10m,vgrd10m)'
> 'define W =  mag(ugrd10m,vgrd10m)*2.2369363'
> 'define T =  (9/5)*(tmp2m-273.15)+32'
> 'define chillf=  35.74
> +(0.6215*T)-(35.75*pow(W,0.16))+(0.4275*T*pow(W,0.16))'
> 'define chill1 =  (chillf-32)*(5/9)'
> 
> 'set ylab on'
> 'set cmark 3'
> 
> 'set ccolor 2'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'set cthick 3'
> 'display chill1'
> 'printim c:\model\upload\meteogram\chilltemp1.png'
> 
> 'set t 1 'n''
> 'set lat 50.5'
> 'set lon 4.5'
> 
> 'define wind = mag(ugrd10m,vgrd10m)'
> 'define W =  mag(ugrd10m,vgrd10m)*2.2369363'
> 'define T =  (9/5)*(tmp2m-273.15)+32'
> 'define chillf=  35.74
> +(0.6215*T)-(35.75*pow(W,0.16))+(0.4275*T*pow(W,0.16))'
> 'define chill2 =  (chillf-32)*(5/9)'
> 
> 'set ylab on'
> 'set cmark 3'
> 'set ccolor 1'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'set cthick 3'
> 'display chill2'
> 'printim c:\model\upload\meteogram\chilltemp2.png'
> 
> 'set t 1 'n''
> 'set lat 50.5'
> 'set lon 6.5'
> 
> 'define wind = mag(ugrd10m,vgrd10m)'
> 'define W =  mag(ugrd10m,vgrd10m)*2.2369363'
> 'define T =  (9/5)*(tmp2m-273.15)+32'
> 'define chillf=  35.74
> +(0.6215*T)-(35.75*pow(W,0.16))+(0.4275*T*pow(W,0.16))'
> 'define chill3 =  (chillf-32)*(5/9)'
> 
> 'define chill0 = 0'
> 'define chilla = -10'
> 'define chillb = -18'
> 
> 'set ylab on'
> 'set cmark 3'
> 'set ccolor 4'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'set cthick 3'
> 'display chill3'
> 
> 'set cmark 0'
> 'set ylab off'
> 'set cthick 6'
> 'set ccolor 1'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'display chill0'
> 
> 'set cmark 0'
> 'set ylab off'
> 'set cthick 6'
> 'set ccolor 4'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'display chilla'
> 
> 'set cmark 0'
> 'set ylab off'
> 'set cthick 6'
> 'set ccolor 14'
> 'set axlim -25 15'
> 'set yaxis -25 15 5'
> 'display chillb'
> 
> 'draw title Windchill (Belgium) for Westhoek (red), center (black) &
> Ardens (blue) (C)\'dag' 'datum2' (run: GFS'run'z)'
> 'printim c:\model\upload\meteogram\chillall.png'
> 'printim c:\model\upload\meteogram\chilltemp3.png'
> 
> else
> say '****   no files open yet!   ****'
> endif
> 
> clear
> 
> 'quit'
> 
> 
> > From: Matthias.Malik at arcor.de
> > To: gradsusr at gradsusr.org
> > Date: Sat, 27 Nov 2010 15:12:17 +0100
> > Subject: Re: [gradsusr] meteogram prec
> > 
> > Hi,
> > 
> > you can do that using maskout function.
> > 
> > Here is an example how i do this with the
> > NCEP GFS Precipitation:
> > 
> > (...)
> > *
> > * global mask for precipitation (3hr interval)
> > * * 
> > 'set dfile 'args
> > 'set lat -90 90'
> > 'set lon -180 180'
> > 'set lev 1000'
> > 'set t 2 65'
> > 
> > 'mask=sumg(1,t=1,t-0,2)-sumg(1,t=1,t-1,2)'
> > _trr = 'tloop(apcp-mask*const(apcp(t-1),0,-u))'
> > _trrc = 'tloop(acpcp-mask*const(acpcp(t-1),0,-u))'
> > 
> > (...)
> > 
> > after that procedure (inside a grads script function) you
> > can use the defined global variable as following:
> > 
> > 'd '_trr
> > 'd '_trrc
> > 
> > 
> > Best regards,
> > Matthias
> > 
> > Am Samstag, den 27.11.2010, 13:53 +0100 schrieb eric delaere:
> > > hi
> > > 
> > > I have a problem to reproduce the precipitation barbs on a
> meteogram
> > > from http://nomads.ncep.noaa.gov:9090/dods/gfs_hd/
> > > I can draw the barbs (3 hourly) but it seems to be not the correct
> > > values.
> > > 
> > > I already knew that there was a problem with this data, since the
> 3,
> > > 9, 15, 21...timesteps gives the precipitation in the last 3 hours,
> but
> > > the 6, 12, 18,... timestems gives the prec in the last 6 hours !!
> > > 
> > > For the maps, I could resolve this by use a small code:
> > > 
> > > if ((uur = '03') | (uur = '09') | (uur = '15') | (uur = '21') |
> (uur =
> > > '27') | (uur = '33') | (uur = '39') | (uur = '45') | (uur = '51')
> |
> > > (uur = '57') | (uur = '63') | (uur = '69') | (uur = '75') | (uur =
> > > '81') | (uur = '87') | (uur = '93'))
> > > 'define prectemp = apcpsfc'
> > > 'define prec = apcpsfc'
> > > endif
> > > 
> > > if ((uur = '00') | (uur = '06') | (uur = '12') | (uur = '18') |
> (uur =
> > > '24') | (uur = '30') | (uur = '36') | (uur = '42') | (uur = '48')
> |
> > > (uur = '54') | (uur = '60') | (uur = '66') | (uur = '72') | (uur =
> > > '78') | (uur = '84') | (uur = '90') | (uur = '96'))
> > > 'define prec = apcpsfc-prectemp'
> > > 
> > > But for meteograms, this trick doesn't work.
> > > 
> > > hereafter the source for the meteogram, but with the incorrect
> > > precipitation values...
> > > 
> > > 'set t 1 'n''
> > > 
> > > 'q time'
> > > res = subwrd(result,3)
> > > datum2 = substr(res,4,9)
> > > uur = substr(res,1,2)
> > > dag = subwrd(result,6)
> > > fff = substr(dag,1,2)
> > > 
> > > 'define t2m0 = 0'
> > > 
> > > 'set xlab on'
> > > 'set ylab on'
> > > 'set ccolor 2'
> > > 'set lat 51'
> > > 'set lon 4'
> > > 'set axlim -15 15'
> > > 'set yaxis -15 15 2'
> > > 'display tmp2m-273.15'
> > > 
> > > 'set cmark 0'
> > > 'set ylab off'
> > > 'set ccolor 4'
> > > 'set cthick 6'
> > > 'set axlim -15 15'
> > > 'set yaxis -15 15 2'
> > > 'display t2m0'
> > > 
> > > 'set ccolor 7'
> > > 'set ccolor 4'
> > > 'set axlim -15 15'
> > > 'set yaxis -15 15 2'
> > > 'set cthick 4'
> > > 'display tw'
> > > 
> > > *'set ylpos 0 r'
> > > *'set xlab on'
> > > *'set ylab on'
> > > *'set axlim 0 10'
> > > *'set yaxis 0 10 1'
> > > *'set gxout bar'
> > > *'set barbase 0'
> > > *'set bargap 50'
> > > *'set ccolor 11'
> > > *'set grid off'
> > > *'display prec'
> > > 
> > > The results are uploaded to
> http://users.fulladsl.be/spb4195/gfs.htm
> > > 
> > > Someone has a solution to have the correct precipitation (so, to
> > > subtract the last 3h prec value from the 6h values)?
> > > 
> > > Thx! 
> > > _______________________________________________
> > > gradsusr mailing list
> > > gradsusr at gradsusr.org
> > > http://gradsusr.org/mailman/listinfo/gradsusr
> > 
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gradsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mask_prec.png
Type: image/png
Size: 11372 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20101128/648f0c31/attachment-0003.png 


More information about the gradsusr mailing list