[gradsusr] lats4d: 2nd try

Jennifer Adams jma at cola.iges.org
Mon Aug 30 10:18:17 EDT 2010


Matt,
Try using the 'sdfwrite' command to create netcdf files with GrADS  
(version 2.0.a3+). It is simple to use, just define the variable  
subset you want, then invoke sdfwrite with the defined variable name.  
The 'set sdfwrite' command has a bunch of options to control the  
format and size of the netcdf output.
--Jennifer


On Aug 23, 2010, at 2:01 PM, Matt Brewer wrote:

> Folks
> Didn't get any help the first time I tried the gradsusr list with  
> this problem, so I thought I would give it another try. Currently, I  
> have been using grads to convert GRIB to netCDF files using lats4d.  
> Basically, when I convert from GRIB to netCDF, it skews the data. I  
> input something like this in the command line:
>
> lats4d -i narr-a_221_19790101_0000_000.sub -o narr_2005 -ftype ctl - 
> lon -160 -90 -lat 25 65  -time 0z1jan2005 21z31dec2005 -mxtimes 2920  
> -levs 925mb -xvars ugrdprs vgrdprs ugrd10m vgrd10m msletmsl prmslmsl  
> tmp10m tmpprs
>
> That will leaves me with geo height data at 925mb. Notice how I ask  
> for data from 160 to 90W and from 25 to 65N. However, when I run the  
> above code, it ends up giving me data from 160 to 89.6667W and from  
> 25 to 65.333N (The data in the 3 hourly NCEP NARR dataset is every  
> third degree, so it seems to just add on an extra line of  
> gridpoints, so I get a 122x212 matrix rather than 121x211). So on  
> the first latitude line of 25N, all the points are correct, until  
> the very last point at 25N 89.667W. Here, the program takes the  
> value of the point that should be at 25.333N 160W, and sticks it at  
> 25N 89.667W. An thus, on the 25.333N array, all the values are  
> shifted one place to the left from where they should be. And the  
> last 2 grid points of that line are taken from the 2 most left  
> points on the next line up...and so on. I hope that makes sense.  
> Please let me know if you have any ideas or if you know anyone that  
> might know the answer or if there is a better way to convert GRIB to  
> netCDF, though I would really like to make this work with GrADS!  
> Thank you so much for any help. By they way, I am using  version  
> 2.0.a8.oga.1 on a linux machine and I got lats4d from downloading it  
> off surgeforce with the 2.0.a8.oga.1 bundle Here is my ctl file, as  
> I have suspicions that the answer lies in the PDEF part....I just  
> don't know how. I also included below the ctl file what happens when  
> I run lats4d.sh in verbose mode as it shows that I truely am just  
> asking for 160-90W and 25-65N. Thank you!!!
>
> Regards,
> Matt Brewer
>
>
> dset ^narr-a_221_%y4%m2%d2_%h200_000.sub.grb
> index ^narr-a_221_19790101_0000_000.sub.grb.idx
> undef 9.999E+20
> title narr-a_221_19790101_0000_000.sub.grb
> *  produced by grib2ctl v0.9.12.5p46
> dtype grib 221
> options template
> pdef 349 277 lcc 1 -145.5 1 1 50 50 -107 32463 32463
> xdef 1111 linear -250 0.333333
> ydef 247 linear 8 0.333333
> tdef 90584 linear 00Z01jan1979 3hr
> *  z has 3 levels, for prs
> zdef 3 levels
> 925 850 500
> vars 9
> HGTprs 3 7,100,0 ** (profile) Geopotential height [gpm]
> MSLETmsl  0 130,102,0 ** mean-sea level Mean sea level pressure (ETA  
> model) [Pa]
> PRMSLmsl  0 2,102,0 ** mean-sea level Pressure reduced to MSL [Pa]
> TMPprs 3 11,100,0 ** (profile) Temp. [K]
> TMP10m  0 11,105,10 ** 10 m above ground Temp. [K]
> UGRDprs 3 33,100,0 ** (profile) u wind [m/s]
> UGRD10m  0 33,105,10 ** 10 m above ground u wind [m/s]
> VGRDprs 3 34,100,0 ** (profile) v wind [m/s]
> VGRD10m  0 34,105,10 ** 10 m above ground v wind [m/s]
> ENDVARS
>
>
>
> lats4d in verbose mode
>
> 3 drizzle% lats4d.sh -i narr-a_221_19790101_0000_000.sub -o narrtest  
> -ftype ctl -v -lon -160 -90 -lat 25 65  -time 0z1jan2005 21z1jan2005  
> -levs 925mb -xvars ugrdprs vgrdprs ugrd10m vgrd10m msletmsl prmslmsl  
> tmp10m tmpprs
> /bin/ls: cannot access 1.*: No such file or directory
> /opt/opengrads/grads -blc 'run lats4d.gs -q -i narr- 
> a_221_19790101_0000_000.sub -o narrtest -ftype ctl -v -lon -160 -90 - 
> lat 25 65 -time 0z1jan2005 21z1jan2005 -levs 925mb -xvars ugrdprs  
> vgrdprs ugrd10m vgrd10m msletmsl prmslmsl tmp10m tmpprs '
>
>               Welcome to the OpenGrADS Bundle Distribution
>               --------------------------------------------
>
> For additional information enter "grads -h".
>
> Starting "/opt/opengrads/Linux/Versions/2.0.a8.oga.1/i686/grads   - 
> blc 'run lats4d.gs -q -i narr-a_221_19790101_0000_000.sub -o  
> narrtest -ftype ctl -v -lon -160 -90 -lat 25 65 -time 0z1jan2005  
> 21z1jan2005 -levs 925mb -xvars ugrdprs vgrdprs ugrd10m vgrd10m  
> msletmsl prmslmsl tmp10m tmpprs ' " ...
>
>
> Grid Analysis and Display System (GrADS) Version 2.0.a8.oga.1
> Copyright (c) 1988-2010 by Brian Doty and the
> Institute for Global Environment and Society (IGES)
> GrADS comes with ABSOLUTELY NO WARRANTY
> See file COPYRIGHT for more information
>
> Config: v2.0.a8.oga.1 little-endian readline printim grib2 netcdf  
> hdf4-sds hdf5 opendap-grids,stn athena geotiff shapefile
> Issue 'q config' command for more information.
> Loading User Defined Extensions table </opt/opengrads/Linux/Versions/ 
> 2.0.a8.oga.1/i686/gex/udxt> ... ok.
> GX Package Initialization: Size = 11 8.5
> Running in Batch mode
> lats4d: Version 2.1.5 of 28 June 2010
> No hardcopy metafile open
> All files closed; all defined objects released;
> All GrADS attributes have been reinitialized
> Notice: Implied interpolation for file narr- 
> a_221_19790101_0000_000.sub
>  Interpolation will be performed on any data displayed from this file
> lats4d: Data file is
> File 1 : narr-a_221_19790101_0000_000.sub.grb
>   Descriptor: narr-a_221_19790101_0000_000.sub.ctl
>   Binary: narr-a_221_%y4%m2%d2_%h200_000.sub.grb
>   Type = Gridded
>   Xsize = 1111  Ysize = 247  Zsize = 3  Tsize = 90584  Esize = 1
>   Number of Variables = 9
>      hgtprs  3  7  ** (profile) Geopotential height [gpm]
>      msletmsl  0  130  ** mean-sea level Mean sea level pressure  
> (ETA model) [Pa]
>      prmslmsl  0  2  ** mean-sea level Pressure reduced to MSL [Pa]
>      tmpprs  3  11  ** (profile) Temp. [K]
>      tmp10m  0  11  ** 10 m above ground Temp. [K]
>      ugrdprs  3  33  ** (profile) u wind [m/s]
>      ugrd10m  0  33  ** 10 m above ground u wind [m/s]
>      vgrdprs  3  34  ** (profile) v wind [m/s]
>      vgrd10m  0  34  ** 10 m above ground v wind [m/s]
>
> lats4d: Dimension environment file same as data file
> lats4d: excluding variable msletmsl
> lats4d: excluding variable prmslmsl
> lats4d: excluding variable tmpprs
> lats4d: excluding variable tmp10m
> lats4d: excluding variable ugrdprs
> lats4d: excluding variable ugrd10m
> lats4d: excluding variable vgrdprs
> lats4d: excluding variable vgrd10m
> lats4d: creating LATS PARAMETER TABLE file .grads.lats.table
> lats4d: time range: 00Z01JAN2005 21Z01JAN2005 by 1, delta t: 3 hourly
> lats4d: vertical levels:  925mb
> lats4d: using PRESSURE for vertical coordinate
> lats4d: latitudinal  range: 25 65
> lats4d: longitudinal range: -160 -90
> lats4d: upper air variables:  hgtprs
> lats4d: writing to coards file narrtest.nc on 00Z01JAN2005
> lats4d: writing to coards file narrtest.nc on 03Z01JAN2005
> lats4d: writing to coards file narrtest.nc on 06Z01JAN2005
> lats4d: writing to coards file narrtest.nc on 09Z01JAN2005
> lats4d: writing to coards file narrtest.nc on 12Z01JAN2005
> lats4d: writing to coards file narrtest.nc on 15Z01JAN2005
> lats4d: writing to coards file narrtest.nc on 18Z01JAN2005
> lats4d: writing to coards file narrtest.nc on 21Z01JAN2005
> lats4d: created coards file narrtest.nc
> lats4d: exiting from GrADS...
> No hardcopy metafile open
> GX package terminated
>
>
>
>
>
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100830/1deb4530/attachment-0003.html 


More information about the gradsusr mailing list