<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Andale Mono";
panose-1:2 11 5 9 0 0 0 0 0 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi, Fabio – <o:p></o:p></p>
<p class="MsoNormal">The meteogram script is outdated, and I am not going to post any revisions. I recommend you use
<a href="http://wxmaps.org/meteogram_custom.php">http://wxmaps.org/meteogram_custom.php</a> to draw your meteograms – it is faster and it saves you the trouble of downloading any data. I use the GrADS script code copied below to create a new binary file that
has 3-hourly precip accumulations along with the categorical variables. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono"">* Write out the 3-hr precip variables<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> '!/bin/rm -f 'dir'/precip3hr.dat'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'set fwrite -ap 'dir'/precip3hr.dat'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'set t 1'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'set z 1'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd p'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd pc'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd crain'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd cfrzr'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd cicep'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd csnow'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> t=2<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> while (t<=tmax)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono"">* these are 3-hourly accumulations<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'set t 't<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd p-p(t-1) '<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd pc-pc(t-1)'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd crain'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd cfrzr'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd cicep'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'd csnow'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> t=t+1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> endwhile<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Andale Mono""> 'disable fwrite'<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt">-- <span style="color:black"><br>
Jennifer Miletta Adams<br>
ADNET Systems, Inc.<br>
NASA/GSFC, Code 610.2</span><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black">Building 32, Room S159<br>
(301) 614-6070<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">gradsusr <gradsusr-bounces@gradsusr.org> on behalf of "Fabio F. Gervasi" <fabio.gervasi70@gmail.com><br>
<b>Reply-To: </b>GrADS Users Forum <gradsusr@gradsusr.org><br>
<b>Date: </b>Sunday, June 9, 2019 at 9:41 AM<br>
<b>To: </b>"gradsusr@gradsusr.org" <gradsusr@gradsusr.org><br>
<b>Subject: </b>[gradsusr] Plotting the new precipitation GFS-FV3 model into my gfs_meteogram.gs script<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Hi all, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">until now, I used succesfully the following grads script in order to plot some GFS model meteograms.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The problem is that using the new GFS-FV3 model new total precipitation and convective precipitation, are with continuous accumulation.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">How can I modify the script in order to plot prec correctly, like before?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you very much,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Fabio.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
* <a href="http://gfs_meteogram.gs" target="_blank">gfs_meteogram.gs</a><br>
*<br>
* This script draws a meteogram based on NCEP forecast data.<br>
* The data is available through the GrADS-DODS Server at COLA.<br>
* You MUST be using a DODS-enabled version of GrADS.<br>
*<br>
* Usage: <script> <name> <yyyymmddhh> <lon> <lat> <e><br>
* Example: <script> Boston 2003031300 -71 42 e <br>
*<br>
* The GFS forecasts are global. Check the GDS URL <br>
* <a href="http://nomads.ncep.noaa.gov:9090/dods/gens/gensyyyymmdd/gep_all_$hhz" target="_blank">
http://nomads.ncep.noaa.gov:9090/dods/gens/gensyyyymmdd/gep_all_$hhz</a><br>
* for a complete listing of all available forecast times. <br>
*<br>
* The 'e' argument is for British units. Default is metric.<br>
*<br>
* Note: This script must be run in a directory in which <br>
* you have write permission because intermediate files <br>
* are written out to disk in order to speed up the display<br>
* and minimize the number of hits to the data server. <br>
* <br>
* Originally written by Paul Dirmeyer<br>
* Modification History:<br>
* J.M. Adams Oct 2001<br>
* Jim Kinter Oct 2001<br>
* J.M. Adams Dec 2001<br>
* Joe Wielgosz Jan 2002<br>
* J.M. Adams Jul 2002<br>
* J.M. Adams Mar 2003 <br>
* J.M. Adams Jul 2005<br>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
function main(args)<br>
<br>
* Make sure GrADS is in portrait mode<br>
'q gxinfo'<br>
pagesize = sublin(result,2)<br>
xsize = subwrd(pagesize,4)<br>
ysize = subwrd(pagesize,6)<br>
if (xsize != 8.5 & ysize != 11)<br>
say 'You must be in PORTRAIT MODE to draw a meteogram'<br>
return<br>
endif<br>
<br>
* Parse the arguments: name, date, longitude, latitude, domain, units<br>
name = subwrd(args,1)<br>
date = subwrd(args,2)<br>
hilon = subwrd(args,3)<br>
hilat = subwrd(args,4)<br>
WORKDIR = subwrd(args,5)<br>
units = subwrd(args,6)<br>
<br>
* Open the data file<br>
'reinit'<br>
_basefolder = WORKDIR'/gfs_tot.ctl'<br>
'open '_basefolder<br>
if (rc) ; return ; endif<br>
<br>
* Get info from the descriptor file<br>
'q ctlinfo'<br>
_ctl = result<br>
_undef = getctl(undef)<br>
_tdef = getctl(tdef)<br>
_zdef = getctl(zdef)<br>
<br>
* Get the Time axis info<br>
tsize = subwrd(_tdef,2)<br>
_t1 = 1<br>
*_t2 = tsize - 1;* Not until 16gg but, for example, 10gg...<br>
_t2 = tsize<br>
'set t '_t1' '_t2<br>
'q dims'<br>
times = sublin(result,5)<br>
_time1 = subwrd(times,6) <br>
_time2 = subwrd(times,8)<br>
_tdim = _time1' '_time2<br>
<br>
tincr = subwrd(_tdef,5)<br>
_tdef = 'tdef 'tsize' linear '_time1' 'tincr<br>
<br>
* Get Vertical grid info <br>
zsize = subwrd(_zdef,2)<br>
z = 1<br>
zlevs = ''<br>
rhzlevs = ''<br>
while (z <= zsize)<br>
'set z 'z<br>
lev = subwrd(result,4)<br>
if lev = 500 ; z500 = z ; endif<br>
zlevs = zlevs%lev%' '<br>
z = z + 1<br>
endwhile<br>
<br>
* Find the grid point closest to requested location<br>
'set lon 'hilon<br>
hilon = subwrd(result,4)<br>
'set lat 'hilat<br>
hilat = subwrd(result,4)<br>
_xdim = hilon' 'hilon <br>
_ydim = hilat' 'hilat<br>
<br>
* Determine pressure range for hovmoellers<br>
getseries(PRESsfc,pshov,1000)<br>
'set lon 'hilon<br>
'set lat 'hilat<br>
'd ave(pshov,t='_t1',t='_t2')*0.01-15.0'<br>
<br>
data = sublin(result,2)<br>
mmm = subwrd(data,4)<br>
meanps = math_nint(mmm)<br>
cnt = 1<br>
while (cnt<zsize)<br>
el1 = subwrd(zlevs,cnt)<br>
el2 = subwrd(zlevs,cnt+1)<br>
if (meanps > el2)<br>
elb = el1<br>
elt = subwrd(zlevs,z500+cnt-1)<br>
break<br>
endif<br>
cnt=cnt+1<br>
endwhile<br>
if (elt < 500) ; elt = 500 ; endif<br>
_zbot = elb<br>
_ztop = elt<br>
_zgrd = _zbot' '_ztop<br>
<br>
* Get number of pressure levels between _zbot and _ztop<br>
n = 1<br>
p = subwrd(zlevs,n)<br>
while (p != _zbot)<br>
n = n + 1<br>
p = subwrd(zlevs,n)<br>
endwhile<br>
levs = p<br>
nlevs = 1<br>
while (p > _ztop)<br>
n = n + 1<br>
p = subwrd(zlevs,n)<br>
levs = levs%' 'p<br>
nlevs = nlevs + 1<br>
endwhile<br>
_newzsize = nlevs<br>
_zdef = 'zdef '_newzsize' levels 'levs<br>
<br>
* Get the Z,T grids for the upper air variables<br>
getgrid(RHprs,rhum)<br>
getgrid(TMPprs,t)<br>
getgrid(UGRDprs,u)<br>
getgrid(VGRDprs,v) <br>
getgrid(HGTprs,hgt) <br>
<br>
* Set up a few preliminary characteristics<br>
setcols(1)<br>
'set display color white'<br>
'c'<br>
'set xlopts 1 8 0.20'<br>
'set ylopts 1 2 0.09'<br>
<br>
* Determine the plot areas for each panel<br>
npanels = 10<br>
x1 = 1.20<br>
x2 = 8.15<br>
y1 = 7.50<br>
y2 = 10.30<br>
panel.npanels = x1' 'x2' 'y1' 'y2 ;* hovmoeller panel<br>
ytop = 7.5 ;* y boundaries for rest of panels except precip<br>
ybot = 1.5<br>
int = (ytop-ybot)/(npanels-2) ;* get height of middle panels<br>
int = 0.001 * (math_nint(1000*int))<br>
n=npanels-1<br>
y2 = ytop<br>
while (n >= 2)<br>
y2 = ytop - (npanels-n-1)*int<br>
y1 = ytop - (npanels-n)*int<br>
panel.n = x1' 'x2' 'y1' 'y2 ;* coords of middle panels<br>
n = n - 1<br>
endwhile<br>
xincr = (8.15 - 1.2)/tsize ;* size of one time step<br>
xincr = 0.01 * math_nint(100*xincr)<br>
panel.1 = x1+xincr' 'x2' 0.4 'y1 ;* coords of precip panel<br>
<br>
* Indent the soil panel too<br>
*w2 = subwrd(panel.2,2)<br>
*w3 = subwrd(panel.2,3)<br>
*w4 = subwrd(panel.2,4)<br>
*panel.2 = x1+xincr' 'w2' 'w3' 'w4<br>
<br>
* Set the Plot Area for the Upper Air Panel<br>
p = npanels<br>
'set parea 'panel.p<br>
'set vpage off'<br>
'set grads off'<br>
'set grid on'<br>
<br>
* Draw the Relative Humidity Shading<br>
'set gxout shaded'<br>
'set csmooth on'<br>
'set clevs 30 50 60 70 80 90 100'<br>
'set ccols 0 20 21 23 25 26 33 34'<br>
'set xlopts 1 2 0.09'<br>
'set xlpos 0 t'<br>
*'set ylab `1%g'<br>
'set ylab %g'<br>
'set ylint 100'<br>
if (units = 'e')<br>
'define temp = (t-273.16)*1.8+32'<br>
'define uwnd = u*2.2374'<br>
'define vwnd = v*2.2374'<br>
else<br>
'define temp = (t-273.16)'<br>
'define uwnd = u'<br>
'define vwnd = v'<br>
endif<br>
'set t '_t1' '_t2<br>
'set lev '_zbot+50' '_ztop-50<br>
'd rhum'<br>
'set gxout contour'<br>
'set grid off'<br>
'set ccolor 15'<br>
'set clab off'<br>
'set clevs 30 50 60 70 80 90 100'<br>
'd rhum'<br>
'set ccolor 0'<br>
'set clab on'<br>
'set cstyle 5'<br>
'set clopts 15'<br>
'set clevs 30 50 60 70 80 90 100'<br>
'd rhum'<br>
<br>
* Draw the Temperature Contours<br>
'set clopts -1'<br>
'set cstyle 1'<br>
'set ccolor rainbow'<br>
'set rbcols 9 14 4 11 5 13 12 8 2 6'<br>
if (units = 'e')<br>
'set cint 10'<br>
'set cthick 6'<br>
'd temp'<br>
'set clevs 32'<br>
'set cthick 12'<br>
'set ccolor 1'<br>
'set clab off'<br>
'd temp'<br>
'set background 1'<br>
'set ccolor 20'<br>
'set clevs 32'<br>
'set cthick 4'<br>
'set clab on'<br>
'set clab `4FR'<br>
else<br>
'set cint 5'<br>
'set cthick 6'<br>
'd temp'<br>
'set clevs 0'<br>
'set cthick 12'<br>
'set ccolor 1'<br>
'set clab off'<br>
'd temp'<br>
'set background 1'<br>
'set ccolor 20'<br>
'set clevs 0'<br>
'set cthick 4'<br>
'set clab on'<br>
endif<br>
'd temp'<br>
<br>
* Draw the Wind Vectors<br>
'set background 0'<br>
'set gxout vector'<br>
'set ccolor 1'<br>
'set xlab off'<br>
'set ylab off'<br>
'set arrlab off'<br>
'd uwnd;vwnd'<br>
<br>
* Draw a rectangle over the year to clear the area for a title<br>
'set line 0'<br>
'draw recf 0.5 10.6 2.1 11.0'<br>
<br>
* Define Thickness<br>
'set lev 1000'<br>
'set t '_t1' '_t2<br>
*getseries(hgtprs,hgt,1000)<br>
getseries(hgtprs,z5,500)<br>
getseries(hgtprs,z10,1000)<br>
'define thk1 = (z5-z10)/10'<br>
<br>
* Next Panel: 1000-500 thickness<br>
p = p - 1<br>
'set parea 'panel.p<br>
'set gxout line'<br>
'set vpage off'<br>
'set grads off'<br>
'set grid on'<br>
'set xlab on'<br>
'set ylab on'<br>
vrng(thk1, thk1)<br>
'set ccolor 5'<br>
'set cmark 4'<br>
'set t '_t1' '_t2<br>
'd thk1'<br>
<br>
* Draw a rectangle over the x-axis labels<br>
xlo = subwrd(panel.p,1)<br>
xhi = subwrd(panel.p,2)<br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
'set line 0'<br>
'draw recf 'xlo-0.4' 'ylo-0.8' 'xhi+0.4' 'ylo-0.02<br>
<br>
* Next Panel: Stability Indices<br>
p = p - 1<br>
'set parea 'panel.p<br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
ymid = ylo + (yhi-ylo)/2<br>
<br>
'set t '_t1' '_t2<br>
'set lev 1000'<br>
'define rh8 = rhum(lev=850)'<br>
'define t8 = t(lev=850)'<br>
'define t5 = t(lev=500)'<br>
'set vpage off'<br>
'set grads off'<br>
'set grid on'<br>
'set xlab on'<br>
'set gxout bar'<br>
'set barbase 40'<br>
'set bargap 50'<br>
'define toto = 1/(1/t8-log(rh8*0.01)*461/2.5e6)-t5*2+t8'<br>
'set axlim 11 69'<br>
'set yaxis 11 69 10'<br>
'set ccolor 8'<br>
'set t '_t1' '_t2<br>
'set grid on'<br>
'd (toto-40+abs(toto-40))*0.5+40'<br>
'set grid off'<br>
'set ccolor 7'<br>
'd (toto-40-abs(toto-40))*0.5+40'<br>
<br>
* draw a rectangle over 'toto' yaxis labels<br>
'set line 0'<br>
'draw recf 0.2 'ylo' 1.175 'yhi-0.07<br>
<br>
* Lifted Index<br>
getseries(no4LFTXsfc,li,1000)<br>
'set gxout line'<br>
'set grid off'<br>
'set vrange 6 -6'<br>
'set yaxis 7 -7 2'<br>
'set ccolor 2'<br>
'set cstyle 3'<br>
'set cmark 7'<br>
'set cmax 0'<br>
'set datawarn off'<br>
'd li'<br>
<br>
* draw a zero line<br>
'set ccolor 15'<br>
'set cmark 0'<br>
'set cstyle 3'<br>
'd const(li,0)'<br>
<br>
* Draw a rectangle over the x-axis labels<br>
xlo = subwrd(panel.p,1)<br>
xhi = subwrd(panel.p,2)<br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
'set line 0'<br>
'draw recf 'xlo-0.4' 'ylo-0.8' 'xhi+0.4' 'ylo-0.02<br>
<br>
* Next Panel: SLP<br>
getseries(prmslmsl,slp,1000)<br>
'define slp = slp*0.01'<br>
p = p - 1<br>
'set parea 'panel.p<br>
'set vpage off'<br>
'set lon 'hilon<br>
'set lat 'hilat<br>
'set grid on'<br>
'set gxout contour'<br>
vrng(slp,slp)<br>
'set ccolor 11'<br>
'set cmark 0'<br>
'set t '_t1' '_t2<br>
'd slp'<br>
<br>
* Draw a rectangle over the x-axis labels<br>
xlo = subwrd(panel.p,1)<br>
xhi = subwrd(panel.p,2)<br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
'set line 0'<br>
'draw recf 'xlo-0.4' 'ylo-0.8' 'xhi+0.4' 'ylo-0.02<br>
<br>
* Next Panel: Surface Wind Speed<br>
p = p - 1<br>
getseries(ugrd10m,ubot,1000)<br>
getseries(vgrd10m,vbot,1000)<br>
'set parea 'panel.p<br>
'set vpage off'<br>
'set grads off'<br>
if (units = 'e')<br>
'define ubot = 2.2374*ubot'<br>
'define vbot = 2.2374*vbot'<br>
endif<br>
'define wind = mag(ubot,vbot)'<br>
vrng(wind,wind)<br>
'set ccolor 26'<br>
'set cmark 7'<br>
'set grid on'<br>
'set t '_t1' '_t2<br>
'set gxout contour'<br>
'd wind'<br>
<br>
* Draw a rectangle over the x-axis labels<br>
xlo = subwrd(panel.p,1)<br>
xhi = subwrd(panel.p,2)<br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
'set line 0'<br>
'draw recf 'xlo-0.4' 'ylo-0.8' 'xhi+0.4' 'ylo-0.02<br>
<br>
* Next Panel: 2m Temperatures and Indices<br>
getseries(tmp2m,t2m,1000)<br>
getseries(rh2m,rh2m,1000)<br>
p = p - 1<br>
'set parea 'panel.p<br>
'set vpage off'<br>
'set frame on'<br>
'set grads off'<br>
'set ylab on'<br>
'set gxout line'<br>
'set grid off'<br>
if (units = 'e')<br>
'define t2mc = const((t2m-273.16),0,-u)'<br>
'define t2m = const((t2m-273.16)*9/5+32,0,-u)'<br>
'define dewpt = t2mc-((14.55+0.114*t2mc)*(1-0.01*rh2m)+pow((2.5+0.007*t2mc)*(1-0.01*rh2m),3)+(15.9+0.117*t2mc)*pow((1-0.01*rh2m),14))'<br>
'define dewpt = dewpt*9/5+32'<br>
else<br>
'define t2mf = const((t2m-273.16)*1.8+32,0,-u)'<br>
'define t2m = const((t2m-273.16),0,-u)'<br>
'define dewpt = t2m-((14.55+0.114*t2m)*(1-0.01*rh2m)+pow((2.5+0.007*t2m)*(1-0.01*rh2m),3)+(15.9+0.117*t2m)*pow((1-0.01*rh2m),14))'<br>
<br>
endif<br>
vrng(t2m,dewpt)<br>
'set t '_t1' '_t2<br>
if (units = 'e')<br>
'set ylint 10'<br>
'set gxout linefill'<br>
expr = 't2m;const(t2m'<br>
'set lfcols 9 0' ; 'd 'expr',-60,-a)'<br>
'set lfcols 9 0' ; 'd 'expr',-60,-a)'<br>
'set lfcols 14 0' ; 'd 'expr',-10,-a)'<br>
'set lfcols 4 0' ; 'd 'expr',0,-a)'<br>
'set lfcols 11 0' ; 'd 'expr',10,-a)'<br>
'set lfcols 5 0' ; 'd 'expr',20,-a)'<br>
'set lfcols 13 0' ; 'd 'expr',30,-a)'<br>
'set lfcols 3 0' ; 'd 'expr',40,-a)'<br>
'set lfcols 10 0' ; 'd 'expr',50,-a)'<br>
'set lfcols 7 0' ; 'd 'expr',60,-a)'<br>
'set lfcols 12 0' ; 'd 'expr',70,-a)'<br>
'set lfcols 8 0' ; 'd 'expr',80,-a)'<br>
'set lfcols 2 0' ; 'd 'expr',90,-a)'<br>
'set lfcols 6 0' ; 'd 'expr',100,-a)'<br>
'set gxout line'<br>
'set ccolor 15'<br>
'set cstyle 3'<br>
'set cmark 0'<br>
'd t2m'<br>
else<br>
'set ylint 5'<br>
'set gxout linefill'<br>
expr = 't2m;const(t2m'<br>
'set lfcols 9 0' ; 'd 'expr',-60,-a)'<br>
'set lfcols 14 0' ; 'd 'expr',-25,-a)'<br>
'set lfcols 4 0' ; 'd 'expr',-20,-a)'<br>
'set lfcols 11 0' ; 'd 'expr',-15,-a)'<br>
'set lfcols 5 0' ; 'd 'expr',-10,-a)'<br>
'set lfcols 13 0' ; 'd 'expr',-5,-a)'<br>
'set lfcols 3 0' ; 'd 'expr',0,-a)'<br>
'set lfcols 10 0' ; 'd 'expr',5,-a)'<br>
'set lfcols 7 0' ; 'd 'expr',10,-a)'<br>
'set lfcols 12 0' ; 'd 'expr',15,-a)'<br>
'set lfcols 8 0' ; 'd 'expr',20,-a)'<br>
'set lfcols 2 0' ; 'd 'expr',25,-a)'<br>
'set lfcols 6 0' ; 'd 'expr',30,-a)'<br>
'set gxout line'<br>
'set ccolor 15'<br>
'set cstyle 3'<br>
'set cmark 0'<br>
'd t2m'<br>
endif<br>
'set grid on'<br>
'set cmark 8'<br>
'set ccolor 2'<br>
'd t2m'<br>
'set ccolor 97'<br>
'set cmark 9'<br>
'd dewpt'<br>
<br>
* Draw a rectangle over the x-axis labels<br>
xlo = subwrd(panel.p,1)<br>
xhi = subwrd(panel.p,2)<br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
'set line 0'<br>
'draw recf 'xlo-0.4' 'ylo-0.8' 'xhi+0.4' 'ylo-0.02<br>
<br>
* Back up to Previous Panel: 10m Wind Vectors<br>
p = p + 1<br>
'set parea 'panel.p<br>
'set ccolor 1'<br>
lap1 = hilat + 0.1<br>
lam1 = hilat - 0.1<br>
'set lon 'hilon ;* ??<br>
'set lat 'lam1' 'lap1<br>
'set frame off'<br>
'set grid off'<br>
'set gxout vector'<br>
'set xyrev on'<br>
'set xlab off'<br>
'set ylab off'<br>
if (units = 'e')<br>
'd 2.2374*ugrd10m.1;2.2374*vgrd10m.1'<br>
else<br>
'd ugrd10m.1;vgrd10m.1'<br>
endif<br>
<br>
* Reset dimension and graphics parameters<br>
'set lat 'hilat<br>
'set lon 'hilon<br>
'set vpage off'<br>
'set frame on'<br>
'set grads off'<br>
'set ylab on'<br>
'set xlab on'<br>
'set gxout line'<br>
'set grid off'<br>
<br>
* Skip to Next Panel: 2m Relative Humidity<br>
p = p - 2<br>
'set parea 'panel.p<br>
*'set vpage off'<br>
*'set grads off'<br>
rh2vrng(rh2m)<br>
'set gxout linefill'<br>
'set lfcols 20 0' ; 'd rh2m;const(rh2m,00.01,-a)'<br>
'set lfcols 21 0' ; 'd rh2m;const(rh2m,20.01,-a)'<br>
'set lfcols 22 0' ; 'd rh2m;const(rh2m,30.01,-a)'<br>
'set lfcols 23 0' ; 'd rh2m;const(rh2m,40.01,-a)'<br>
'set lfcols 24 0' ; 'd rh2m;const(rh2m,50.01,-a)'<br>
'set lfcols 25 0' ; 'd rh2m;const(rh2m,60.01,-a)'<br>
'set lfcols 26 0' ; 'd rh2m;const(rh2m,70.01,-a)'<br>
'set lfcols 27 0' ; 'd rh2m;const(rh2m,80.01,-a)'<br>
'set lfcols 28 0' ; 'd rh2m;const(rh2m,90.01,-a)'<br>
'set ccolor 28'<br>
'set gxout line'<br>
'set grid on'<br>
'set cmark 2'<br>
'd rh2m'<br>
<br>
* Draw a rectangle over the x-axis labels<br>
xlo = subwrd(panel.p,1)<br>
xhi = subwrd(panel.p,2)<br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
'set line 0'<br>
'draw recf 'xlo-0.4' 'ylo-0.8' 'xhi+0.4' 'ylo-0.02<br>
<br>
* Next Panel: 850hPa Temperature<br>
getseries(tmpprs,T850,850)<br>
'define T850 = T850-273.15'<br>
p = p - 1<br>
'set parea 'panel.p<br>
'set vpage off'<br>
'set lon 'hilon<br>
'set lat 'hilat<br>
'set grid on'<br>
'set gxout contour'<br>
vrng(T850,T850)<br>
'set ccolor 9'<br>
'set cmark 3'<br>
'set t '_t1' '_t2<br>
'd T850'<br>
<br>
* Draw a rectangle over the x-axis labels<br>
xlo = subwrd(panel.p,1)<br>
xhi = subwrd(panel.p,2)<br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
'set line 0'<br>
'draw recf 'xlo-0.4' 'ylo-0.8' 'xhi+0.4' 'ylo-0.02<br>
<br>
* Next Panel: 0°C<br>
getseries(HGT0C,zero,1000)<br>
*'define zero = zero'<br>
p = p - 1<br>
'set parea 'panel.p<br>
'set vpage off'<br>
'set lon 'hilon<br>
'set lat 'hilat<br>
'set grid on'<br>
'set gxout contour'<br>
vrng(zero,zero)<br>
'set ccolor 4'<br>
'set cmark 5'<br>
'set t '_t1' '_t2<br>
'd zero'<br>
<br>
* Draw a rectangle over the x-axis labels<br>
*xlo = subwrd(panel.p,1)<br>
*xhi = subwrd(panel.p,2)<br>
*ylo = subwrd(panel.p,3)<br>
*yhi = subwrd(panel.p,4)<br>
*'set line 0'<br>
*'draw recf 'xlo-0.4' 'ylo-0.8' 'xhi+0.4' 'ylo-0.02<br>
<br>
* Next Panel: Soil Moisture<br>
*p = p - 1<br>
*'set parea 'panel.p<br>
*getseries(watrsfc,runoff,1000)<br>
*getseries(soilw100_200cm,sm,1000)<br>
<br>
*'define sm = const(sm,0,-u)'<br>
*'set t 1'<br>
*'d sm(t=1)'<br>
*sm1 = subwrd(result,4)<br>
*'set t '_t1' '_t2<br>
*'define ss = sm(t-1)/4 + sm/2 + sm(t+1)/4'<br>
*if (units = 'e')<br>
* 'define runoff = const(runoff,0,-u)/25.4'<br>
* 'define dsoilm = (ss-ss(t-1))*39.37*1.9'<br>
*else<br>
* 'define runoff = const(runoff,0,-u)'<br>
* 'define dsoilm = (ss-ss(t-1))*1000*1.9'<br>
*endif<br>
*'set vpage off'<br>
*vrng(runoff,dsoilm)<br>
*'set t '_t1+0.5' '_t2+0.5<br>
*'set gxout bar'<br>
*'set barbase 0'<br>
*'set bargap 20'<br>
*'set ccolor 5'<br>
*'set grid on'<br>
*'d runoff'<br>
*'set grid on'<br>
*'set ccolor 96'<br>
*'set bargap 60'<br>
*'d dsoilm'<br>
<br>
* Draw a rectangle over the x-axis labels<br>
xlo = subwrd(panel.p,1)<br>
xhi = subwrd(panel.p,2)<br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
'set line 0'<br>
'draw recf 'xlo-0.4' 'ylo-0.8' 'xhi+0.4' 'ylo-0.02<br>
<br>
* Final Panel: Precipitation<br>
getseries(apcpsfc,pt,1000)<br>
getseries(acpcpsfc,pc,1000)<br>
getseries(csnowsfc,csnow,1000)<br>
getseries(cfrzrsfc,cfrzr,1000)<br>
getseries(cicepsfc,cicep,1000)<br>
p = p - 1<br>
'set parea 'panel.p<br>
'set vpage off'<br>
'set grid on'<br>
'set grads off'<br>
'define ptot = 0.5*(pt+abs(pt))'<br>
'define pconv = 0.5*(pc+abs(pc))'<br>
if (units = 'e')<br>
'define ptot = const(ptot,0,-u)/25.4'<br>
'define pconv = const(pconv,0,-u)/25.4'<br>
else<br>
'define ptot = const(ptot,0,-u)'<br>
'define pconv = const(pconv,0,-u)'<br>
endif<br>
<br>
* Get Total Precipitation Range<br>
'set gxout stat'<br>
'd ptot'<br>
data = sublin(result,8)<br>
pmx = subwrd(data,5)<br>
if (units = 'e')<br>
if (pmx < 0.05) <br>
pmx = 0.0499<br>
else<br>
pmx = pmx + (0.05*pmx)<br>
endif<br>
else<br>
if (pmx < 1.0) <br>
pmx = 0.99<br>
else<br>
pmx = pmx + (0.05*pmx)<br>
endif<br>
endif<br>
'set vrange 0 'pmx<br>
incr = 0.01 * (math_nint(100*pmx/5))<br>
'set ylint 'incr<br>
'set t '_t1+0.5' '_t2+0.5<br>
<br>
* Rain (Total Precipitation)<br>
'set gxout bar'<br>
'set barbase 0'<br>
'set bargap 50'<br>
'set ccolor 42'<br>
'd ptot'<br>
<br>
* Snow<br>
'set ccolor 44'<br>
'd ptot*csnow'<br>
<br>
* Sleet (Freezing Rain)<br>
'set ccolor 45'<br>
'd ptot*cfrzr'<br>
<br>
* Ice Pellets<br>
'set ccolor 46'<br>
'd ptot*cicep'<br>
<br>
* Convective Precipitation<br>
'set gxout bar'<br>
'set bargap 80'<br>
'set ccolor 2'<br>
'd pconv'<br>
<br>
* Draw all the Y-axis labels<br>
<br>
* First panel<br>
'set line 21' ; 'draw recf 0.4 7.65 0.62 8.18'<br>
'set line 22' ; 'draw recf 0.4 7.65 0.59 8.18'<br>
'set line 23' ; 'draw recf 0.4 7.65 0.56 8.18'<br>
'set line 25' ; 'draw recf 0.4 7.65 0.53 8.18'<br>
'set line 26' ; 'draw recf 0.4 7.65 0.50 8.18'<br>
'set line 33' ; 'draw recf 0.4 7.65 0.47 8.18'<br>
'set line 34' ; 'draw recf 0.4 7.65 0.44 8.18'<br>
'set strsiz 0.07 0.10'<br>
'set string 0 c 3 90' ; 'draw string 0.5 7.93 RH (%)'<br>
'set string 2 l 3 90' ; 'draw string 0.5 8.36 T'<br>
'set string 8 l 3 90' ; 'draw string 0.5 8.43 e'<br>
'set string 5 l 3 90' ; 'draw string 0.5 8.50 m'<br>
'set string 4 l 3 90' ; 'draw string 0.5 8.62 p'<br>
'set string 9 l 3 90' ; 'draw string 0.5 8.69 .'<br>
if (units = 'e')<br>
'set strsiz 0.07 0.10'<br>
'set string 2 l 3 90' ; 'draw string 0.5 8.79 (F)'<br>
'set string 1 c 3 90' ; 'draw string 0.5 9.53 Wind (mph)'<br>
else<br>
'set strsiz 0.07 0.10'<br>
'set string 2 l 3 90' ; 'draw string 0.5 8.79 (C)'<br>
'set string 1 c 3 90' ; 'draw string 0.5 9.53 Wind (m/s)'<br>
endif<br>
'set strsiz 0.07 0.10'<br>
'draw string 0.75 8.63 `1 (hPa)'<br>
<br>
* Next Panel<br>
'set strsiz 0.07 0.10'<br>
p = npanels - 1 <br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
ymid = ylo + (yhi-ylo)/2<br>
'set string 5 c 3 90' <br>
'draw string 0.5 'ymid' Thickness'<br>
'draw string 0.3 'ymid' 1000-500mb'<br>
'set string 1 c 3 90' <br>
'draw string 0.74 'ymid' (dm)'<br>
<br>
* Next Panel<br>
p = p - 1 <br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
ymid = ylo + (yhi-ylo)/2<br>
'set string 8 c 3 90' ; 'draw string 0.15 'ymid' Total-totals'<br>
<br>
* Total-Totals Y-axis Legend<br>
'set strsiz 0.07 0.10'<br>
'set string 15 r 3 0' ; 'draw string 0.45 'ymid' 40'<br>
'set string 7 r 3 0' ; 'draw string 0.45 'ymid-0.133' 30'<br>
'set string 7 r 3 0' ; 'draw string 0.45 'ymid-0.266' 20'<br>
'set string 8 r 3 0' ; 'draw string 0.45 'ymid+0.133' 50'<br>
'set string 8 r 3 0' ; 'draw string 0.45 'ymid+0.266' 60'<br>
'set strsiz 0.07 0.10'<br>
'set string 2 c 3 90' ; 'draw string 0.69 'ymid' Lifted Index'<br>
<br>
* Next Panel<br>
p = p - 1 <br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
ymid = ylo + (yhi-ylo)/2<br>
'set string 11 c 3 90' ; 'draw string 0.3 'ymid' SLP'<br>
'set string 1 c 3 90' ; 'draw string 0.6 'ymid' (hPa)'<br>
<br>
* Next Panel<br>
p = p - 1 <br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
ymid = ylo + (yhi-ylo)/2<br>
'set string 26 c 3 90' ; 'draw string 0.15 'ymid' 10m Wind'<br>
'set string 26 c 3 90' ; 'draw string 0.35 'ymid' Speed'<br>
'set string 1 c 3 90' ; 'draw string 0.55 'ymid' & Vectors'<br>
if (units = 'e')<br>
'draw string 0.75 'ymid' (mph)'<br>
else<br>
'draw string 0.75 'ymid' (m/s)'<br>
endif<br>
<br>
* Next Panel<br>
p = p - 1 <br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
ymid = ylo + (yhi-ylo)/2<br>
'set string 2 c 3 90' ; 'draw string 0.15 'ymid' 2m Temp '<br>
'set string 97 c 3 90' ; 'draw string 0.35 'ymid' 2m DewPt '<br>
*'set string 31 c 3 90' ; 'draw string 0.35 'ymid' Wind Chill'<br>
*'set string 30 c 3 90' ; 'draw string 0.55 'ymid' Heat Index'<br>
if (units = 'e')<br>
'set string 1 c 3 90'<br>
'draw string 0.75 'ymid' (F)'<br>
else<br>
'set string 1 c 3 90'<br>
'draw string 0.75 'ymid' (C)'<br>
endif<br>
<br>
* Next Panel<br>
p = p - 1 <br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
ymid = ylo + (yhi-ylo)/2<br>
'set string 26 c 3 90' ; 'draw string 0.35 'ymid' 2m RH'<br>
'set string 1 c 3 90' ; 'draw string 0.75 'ymid' (%)'<br>
<br>
* Next Panel<br>
p = p - 1 <br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
ymid = ylo + (yhi-ylo)/2<br>
'set string 9 c 3 90' ; 'draw string 0.35 'ymid' 850hPa Temp'<br>
'set string 1 c 3 90' ; 'draw string 0.75 'ymid' (C)'<br>
<br>
* Next Panel<br>
p = p - 1 <br>
ylo = subwrd(panel.p,3)<br>
yhi = subwrd(panel.p,4)<br>
ymid = ylo + (yhi-ylo)/2<br>
'set string 4 c 3 90' ; 'draw string 0.3 'ymid' 0C isotherm'<br>
'set string 1 c 3 90' ; 'draw string 0.6 'ymid' (m)'<br>
<br>
* Next Panel<br>
*p = p - 1<br>
*ylo = subwrd(panel.p,3)<br>
*yhi = subwrd(panel.p,4)<br>
*ymid = ylo + (yhi-ylo)/2<br>
*'set string 5 c 3 90' ; 'draw string 0.35 'ymid' Runoff'<br>
*'set string 96 c 3 90' ; 'draw string 0.55 'ymid' `3d`0[Soil Moist]'<br>
*if (units = 'e')<br>
* 'set string 1 c 3 90' ; 'draw string 0.75 'ymid' (in)'<br>
*else<br>
* 'set string 1 c 3 90' ; 'draw string 0.75 'ymid' (mm)'<br>
*endif<br>
<br>
* Bottom Panel<br>
dt = 6<br>
if (units = 'e')<br>
'set string 1 l 3 90' ; 'draw string .85 0.4 'dt'hr Precip (in)'<br>
else<br>
'set string 1 l 3 90' ; 'draw string .85 0.4 'dt'hr Precip (mm)'<br>
endif<br>
<br>
'set string 42 r 3 0' ; 'draw string 0.7 1.3 Total/Rain'<br>
'set string 2 r 3 0' ; 'draw string 0.7 1.1 Convective'<br>
'set string 45 r 3 0' ; 'draw string 0.7 0.9 Frzg. Rain'<br>
'set string 44 r 3 0' ; 'draw string 0.7 0.7 Snow'<br>
'set string 46 r 3 0' ; 'draw string 0.7 0.5 Ice Pellets'<br>
<br>
* Draw Labels at the top of the page<br>
'set string 4 r 1 0'<br>
'set strsiz 0.10 .10'<br>
label = 'GFS 0-240hr Forecast Meteogram for ('<br>
if (hilon < 0) ; label = label%hilon*(-1.0)'W, ' ; endif<br>
if (hilon >= 0) ; label = label%hilon'E, ' ; endif<br>
if (hilat < 0) ; label = label%hilat*(-1.0)'S)'; endif<br>
if (hilat >= 0) ; label = label%hilat'N)' ; endif<br>
'draw string 6.7 10.90 'label<br>
'set string 15 r 1 0'<br>
'draw string 5.50 10.70 (C) <a href="http://www.centrometeo.com" target="_blank">
www.centrometeo.com</a>'<br>
<br>
'set line 0'<br>
'draw recf 0.5 0 3.95 0.08'<br>
<br>
* Draw the station label<br>
'set strsiz 0.12 0.18'<br>
'set string 21 l 12 0' ; 'draw string 0.12 10.79 `1'name<br>
'set string 1 l 8 0' ; 'draw string 0.10 10.81 `1'name<br>
<br>
* Remove the dummy files<br>
'!rm -f dummy.ctl'<br>
'!rm -f dummy.dat'<br>
<br>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
* END OF MAIN SCRIPT<br>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
<br>
function setcols(args)<br>
'set rgb 20 234 245 234'<br>
'set rgb 21 200 215 200'<br>
'set rgb 22 160 205 160'<br>
'set rgb 23 120 215 120'<br>
'set rgb 24 80 235 80'<br>
'set rgb 25 0 255 0'<br>
'set rgb 26 0 195 0'<br>
'set rgb 27 0 160 0'<br>
'set rgb 28 0 125 0'<br>
<br>
'set rgb 30 255 160 120'<br>
'set rgb 31 160 120 255'<br>
'set rgb 32 160 180 205'<br>
<br>
'set rgb 33 0 200 255'<br>
'set rgb 34 0 100 255'<br>
<br>
'set rgb 42 32 208 32'<br>
'set rgb 43 208 32 208'<br>
'set rgb 44 64 64 255'<br>
'set rgb 45 255 120 32'<br>
'set rgb 46 32 208 208'<br>
'set rgb 47 240 240 0'<br>
<br>
'set rgb 96 139 115 85'<br>
'set rgb 97 100 100 100'<br>
'set rgb 98 64 64 96'<br>
'set rgb 99 254 254 254'<br>
return<br>
<br>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
function vrng(f1,f2)<br>
'set gxout stat'<br>
'd 'f1<br>
data = sublin(result,8)<br>
ymx = subwrd(data,5)<br>
ymn = subwrd(data,4)<br>
'd 'f2<br>
data = sublin(result,8)<br>
zmx = subwrd(data,5)<br>
zmn = subwrd(data,4)<br>
if (zmx > ymx) ; ymx = zmx ; endif<br>
if (zmn < ymn) ; ymn = zmn ; endif<br>
dy = ymx-ymn<br>
ymx = ymx + 0.08 * dy<br>
ymn = ymn - 0.08 * dy<br>
if ((ymx-ymn)/2.2 < 1)<br>
incr = (ymx-ymn)/4<br>
incr = 0.01 * (math_nint(100*incr))<br>
else<br>
incr = math_nint((ymx-ymn)/4)<br>
endif<br>
'set vrange 'ymn' 'ymx<br>
'set ylint 'incr<br>
*say 'vrng: 'ymn' 'ymx' 'incr<br>
if (ymn=0 & ymx=0 & incr=0)<br>
* say 'vrng: resetting zeros to -.9 .9 1'<br>
'set vrange -.9 .9'<br>
'set ylint 1'<br>
endif<br>
'set gxout line'<br>
return<br>
<br>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
function rh2vrng(f1)<br>
'set gxout stat'<br>
'd 'f1<br>
data = sublin(result,8)<br>
ymn = subwrd(data,4)<br>
ymx = subwrd(data,5)<br>
if (ymn < 20) <br>
miny = 0 <br>
'set ylevs 20 40 60 80'<br>
endif<br>
if (ymn >= 20 & ymn < 30) <br>
miny = 20 <br>
'set ylevs 30 50 70 90'<br>
endif<br>
if (ymn >= 30 & ymn < 40) <br>
miny = 30 <br>
'set ylevs 40 50 60 70 80 90'<br>
endif<br>
if (ymn >= 40 & ymn < 50) <br>
miny = 40 <br>
'set ylevs 50 60 70 80 90'<br>
endif<br>
if (ymn >= 50 & ymn < 60) <br>
miny = 50<br>
'set ylevs 60 70 80 90'<br>
endif<br>
if (ymn >= 60) <br>
miny = 60<br>
'set ylevs 70 80 90'<br>
endif<br>
'set vrange 'miny' 'ymx+3<br>
return<br>
<br>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
function getctl(handle)<br>
line = 1<br>
found = 0<br>
while (!found)<br>
info = sublin(_ctl,line)<br>
if (subwrd(info,1)=handle)<br>
_handle = info<br>
found = 1<br>
endif<br>
line = line + 1<br>
endwhile<br>
return _handle<br>
<br>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
function getgrid(dodsvar,myvar)<br>
<br>
'set lon '_xdim<br>
'set lat '_ydim<br>
'set lev '_zgrd<br>
'set time '_tdim<br>
<br>
* Write the variable to a file<br>
'set gxout fwrite'<br>
'set fwrite dummy.dat'<br>
'd 'dodsvar<br>
'disable fwrite'<br>
<br>
* Write a descriptor file <br>
rc = write(dummy.ctl,'dset ^dummy.dat')<br>
rc = write(dummy.ctl,_undef,append)<br>
rc = write(dummy.ctl,'xdef 1 linear 1 1',append)<br>
rc = write(dummy.ctl,'ydef 1 linear 1 1',append)<br>
rc = write(dummy.ctl,_zdef,append)<br>
rc = write(dummy.ctl,_tdef,append)<br>
rc = write(dummy.ctl,'vars 1',append)<br>
rc = write(dummy.ctl,'dummy '_newzsize' -999 dummy',append)<br>
rc = write(dummy.ctl,'endvars',append)<br>
rc = close (dummy.ctl)<br>
<br>
* Open the dummy file, define variable, close dummy file<br>
'open dummy.ctl'<br>
line = sublin(result,2)<br>
dummyfile = subwrd(line,8)<br>
'set dfile 'dummyfile<br>
'set lon 1'<br>
'set lat 1'<br>
'set lev '_zbot' '_ztop<br>
'set time '_time1' '_time2<br>
'define 'myvar' = dummy.'dummyfile<br>
'close 'dummyfile<br>
'set dfile 1'<br>
return<br>
<br>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
function getetarh(dodsvar,myvar)<br>
<br>
* swap out original pressure vars<br>
tmpzgrd = _zgrd<br>
tmpzdef = _zdef<br>
tmpzbot = _zbot<br>
tmpztop = _ztop<br>
tmpzsize = _newzsize<br>
<br>
* retrieve rh data over the rh pressure range<br>
_zgrd = _rhzgrd<br>
_zdef = _trhzdef<br>
_ztop = _rhztop<br>
_zbot = _rhzbot<br>
_newzsize = _trhzsize<br>
getgrid(dodsvar,tmprh)<br>
<br>
* swap in original pressure vars<br>
_zgrd = tmpzgrd<br>
_zdef = tmpzdef<br>
_zbot = tmpzbot<br>
_ztop = tmpztop<br>
_newzsize = tmpzsize<br>
<br>
'set lon '_xdim<br>
'set lat '_ydim<br>
'set lev '_rhzgrd<br>
'set time '_tdim<br>
<br>
* Write the variable to a file<br>
'set gxout fwrite'<br>
'set fwrite dummy.dat'<br>
t = _t1<br>
while (t <= _t2)<br>
'set t 't<br>
z = 1<br>
while (z <= _newrhzsize)<br>
level = subwrd(_rhlevs,z) <br>
'set lev 'level<br>
'd tmprh'<br>
z = z + 1<br>
endwhile<br>
t = t + 1<br>
endwhile<br>
'disable fwrite'<br>
<br>
* Write a descriptor file <br>
rc = write(dummy.ctl,'dset ^dummy.dat')<br>
rc = write(dummy.ctl,_undef,append)<br>
rc = write(dummy.ctl,'xdef 1 linear 1 1',append)<br>
rc = write(dummy.ctl,'ydef 1 linear 1 1',append)<br>
rc = write(dummy.ctl,_rhzdef,append)<br>
rc = write(dummy.ctl,_tdef,append)<br>
rc = write(dummy.ctl,'vars 1',append)<br>
rc = write(dummy.ctl,'dummy '_newrhzsize' -999 dummy',append)<br>
rc = write(dummy.ctl,'endvars',append)<br>
rc = close (dummy.ctl)<br>
<br>
* Open the dummy file, define variable, close dummy file<br>
'open dummy.ctl'<br>
line = sublin(result,2)<br>
dummyfile = subwrd(line,8)<br>
'set dfile 'dummyfile<br>
'set lon 1'<br>
'set lat 1'<br>
'set lev '_rhzbot' '_rhztop<br>
'set time '_time1' '_time2<br>
'q dims'<br>
'define 'myvar' = dummy.'dummyfile<br>
'close 'dummyfile<br>
'set dfile 1'<br>
<br>
return<br>
<br>
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <br>
function getseries(dodsvar,myvar,level)<br>
<br>
'set lon '_xdim<br>
'set lat '_ydim<br>
'set lev 'level' 'level<br>
'set time '_tdim<br>
<br>
* Write the variable to a file<br>
'set fwrite dummy.dat'<br>
'set gxout fwrite'<br>
'd 'dodsvar<br>
'disable fwrite'<br>
<br>
* Write a descriptor file <br>
rc = write(dummy.ctl,'dset ^dummy.dat')<br>
rc = write(dummy.ctl,_undef,append)<br>
rc = write(dummy.ctl,'xdef 1 linear 1 1',append)<br>
rc = write(dummy.ctl,'ydef 1 linear 1 1',append)<br>
rc = write(dummy.ctl,'zdef 1 linear 1 1',append)<br>
rc = write(dummy.ctl,_tdef,append)<br>
rc = write(dummy.ctl,'vars 1',append)<br>
rc = write(dummy.ctl,'dummy 0 -999 dummy',append)<br>
rc = write(dummy.ctl,'endvars',append)<br>
rc = close(dummy.ctl)<br>
<br>
* Open the dummy file, define variable, close dummy file<br>
'open dummy.ctl'<br>
line = sublin(result,2)<br>
dummyfile = subwrd(line,8)<br>
'set dfile 'dummyfile<br>
'set lon 1'<br>
'set lat 1'<br>
'set lev 'level<br>
'set time '_time1' '_time2<br>
'define 'myvar' = dummy.'dummyfile<br>
'close 'dummyfile<br>
'set dfile 1'<br>
'set gxout contour'<br>
<br>
return<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>