[gradsusr] Global Control File Issue

L.B. bcbass2989 at gmail.com
Tue Mar 12 16:14:57 EDT 2019


Correct, that is a typo. I noticed that after I sent the email. It
should say 1 though.
*-------*
William (L.B.) LaForce IV
Meteorologist


On Tue, Mar 12, 2019 at 4:13 PM James T. Potemra <jimp at hawaii.edu> wrote:

> Hi LB,
>
> Likely a typo, but I note that your descriptor file has "vars 2", but only
> includes one variable:
>
> dset ^500HGT_Climo.dat
>
> title ERA5 500 hPa Height Climatology 1979 to 2018
> undef 9.999E+20
>
> ydef 721 linear -90.00 0.25
> xdef 1440 linear 0.00 0.25
> tdef 1464 linear 00Z01JAN1980 6hr
> zdef 1 linear 1 1
> vars 2
>  hgt500mean         1  99  500 hPa Mean Geopotential Height [gpm]
> ENDVARS
>
> Jim
>
> On 3/11/19 2:18 PM, L.B. wrote:
>
> I'm having an issue with a pesky control file that I created for a binary
> file that I wrote out with GrADS using the fwrite function.
>
> I have a large dataset of multiple grib2 files containing 500mb
> Geopotential by year. I used templating in the control file to run through
> all the grib files. Here is the control file for that data:
>
> dset ^ERA5_500GEO_%y4.grb2
> index ^ERA5_500GEO_Climo.grb2.idx
> undef 9.999E+20
> options template
> title ERA5_500GEO_Climo
> * produced by g2ctl v0.1.4
> * griddef=1:0:(1440 x 721):grid_template=0:winds(N/S): lat-lon grid:(1440
> x 721) units 1e-06 input WE:NS output WE:SN res 48 lat 90.000000 to
> -90.000000 by 0.250000 lon 0.000000 to 359.750000 by 0.250000
> #points=1038240:winds(N/S)
>
> dtype grib2
> ydef 721 linear -90.00 0.25
> xdef 1440 linear 0.00 0.25
> tdef 58440 linear 00Z01JAN1979 6hr
> zdef 1 linear 1 1
> vars 1
> GP500mb   0,100,50000   0,3,4 ** 500 mb Geopotential [m^2/s^2]
> ENDVARS
>
> From here, I created a script to further reduce the size fo the
> climatology file by writing out to a binary file the average 500mb
> geopotential height every 6 hours for one year (data starts in 1979, but I
> started the script in 1980 to include a leap year to get Feb 29th - hence
> why I used 1461 for the first timestep).
>
> The script that outputs the 6hour average is here:
>
> 'reinit'
> 'open ERA5_500GEO.ctl'
> 'set gxout fwrite'
> 'set fwrite 500HGT_Climo.dat'
>
> tt=1461
>
>  while (tt<=2924)
>      'set t 'tt
>      'q dims'
>      rec=sublin(result,5)
>      vdate=subwrd(rec,6)
>      vday=substr(vdate,1,8)
>      say vday
>
>      if (vday=00Z29FEB | vday=06Z29FEB | vday=12Z29FEB | vday=18Z29FEB)
>
>  'mean=(GP500mb(time='vday'1980)+GP500mb(time='vday'1984)+GP500mb(time='vday'1988)+GP500mb(time='vday'1992)+GP500mb(time='vday'1996)+GP500mb(time='vday'2000)+GP500mb(time='vday'2004)+GP500mb(time='vday'2008)+GP500mb(time='vday'2012)+GP500mb(time='vday'2016))/10'
>
>      else
>
>
>  'mean=(GP500mb(time='vday'1979)+GP500mb(time='vday'1980)+GP500mb(time='vday'1981)+GP500mb(time='vday'1982)+GP500mb(time='vday'1983)+GP500mb(time='vday'1984)+GP500mb(time='vday'1985)+GP500mb(time='vday'1986)+GP500mb(time='vday'1987)+GP500mb(time='vday'1988)+GP500mb(time='vday'1989)+GP500mb(time='vday'1990)+GP500mb(time='vday'1991)+GP500mb(time='vday'1992)+GP500mb(time='vday'1993)+GP500mb(time='vday'1994)+GP500mb(time='vday'1995)+GP500mb(time='vday'1996)+GP500mb(time='vday'1997)+GP500mb(time='vday'1998)+GP500mb(time='vday'1999)+GP500mb(time='vday'2000)+GP500mb(time='vday'2001)+GP500mb(time='vday'2002)+GP500mb(time='vday'2003)+GP500mb(time='vday'2004)+GP500mb(time='vday'2005)+GP500mb(time='vday'2006)+GP500mb(time='vday'2007)+GP500mb(time='vday'2008)+GP500mb(time='vday'2009)+GP500mb(time='vday'2010)+GP500mb(time='vday'2011)+GP500mb(time='vday'2012)+GP500mb(time='vday'2013)+GP500mb(time='vday'2014)+GP500mb(time='vday'2015)+GP500mb(time='vday'2016)+GP500mb(time='vday'2017)+GP500mb(time='vday'2018))/40'
>
>      endif
>
>       'd mean/9.80665'
>
>   tt=tt+1
>  endwhile
>
> 'disable fwrite'
>
> The control file for this binary file named: 500HGT_Climo.dat is where I
> am having the issue. The control file is below:
>
> dset ^500HGT_Climo.dat
>
> title ERA5 500 hPa Height Climatology 1979 to 2018
> undef 9.999E+20
>
> ydef 721 linear -90.00 0.25
> xdef 1440 linear 0.00 0.25
> tdef 1464 linear 00Z01JAN1980 6hr
> zdef 1 linear 1 1
> vars 2
>  hgt500mean         1  99  500 hPa Mean Geopotential Height [gpm]
> ENDVARS
>
> If I were to just plot the first timestep from this binary file, I would
> get the first image attached named: 'fromdatfile.png'. This image is wrong,
> however. The correct one (attached) is named: 'fromscript.png'. I can run
> that same 6 hour average script but change it to output a contoured image,
> and it is correct (the output is the 'fromscript.png' image). However, that
> same exact code, when written to binary format and then plotted is wrong.
> Somehow the control file is messing up, but I cannot figure out where.
>
> I have tested the 6hour average script using a smaller domain than global
> (just the US) and adjusted the control file accordingly and it works fine,
> but the full global domain doesn't want to plot correctly with that control
> file. Any ideas on what might be going on? Thanks!
> *-------*
> William (L.B.) LaForce IV
> Meteorologist
>
> _______________________________________________
> gradsusr mailing listgradsusr at gradsusr.orghttp://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20190312/76926ada/attachment-0001.html>


More information about the gradsusr mailing list