error in xdef ctl file

Kevin M Levey klevey at CUSTOMWEATHER.COM
Wed Nov 18 12:51:38 EST 2009


Hi Luis,

You need to describe your variables as such (for example)

alt=>elevation 1 99 Altitude in meters

elevation is the actual name of the variable in my netcdf file, and I map it to a new variable called "alt".

Try something like this for your variable:

temp=>temperature_at_  1 99 Surface Temperature 

Documentation is all in the GRADS user docs (http://grads.iges.org/grads/gadoc/gradcomdxdfopen.html)

DTYPE: 

(GrADS version 1.9) For DTYPE netcdf or hdfsds or hdf5_grid (GrADS version 2.0.a7+) , the units field is a comma-delimited list of the varying dimensions of the variable. Dimensions expressed as x, y, z, or t correspond to the four axes defined by XDEF, YDEF, ZDEF and TDEF. For example, a surface variable such as sea level pressure might look like this:

presSFC=>psfc   0   y,x   Surface Pressure
A time-varying atmospheric variable such as geopotential height might look like this:

Height=>hght   17   t,z,y,x   Geopotential Height (m)
The order of the dimensions listed in the units field does matter. They must describe the shape of the variable as it was written to the SDF data file. For NetCDf files, this information appears in the output from ncdump next to the variable name.

If your data file contains a variable that also varies in a non-world-coordinate dimension (e.g. histogram interval, spectral band, ensemble number) then you can put a non-negative integer in the list of varying dimensions that will become the array index of the extra dimension. For example:

VAR=>hist0   0   0,y,x   First historgram interval for VAR
VAR=>hist1   0   1,y,x   Second historgram interval for VAR
VAR=>hist2   0   2,y,x   Third histogram interval for VAR

Another option in this example would be to fill the unused Z axis with the histogram intervals:

zdef 3 linear 1 1
... 
VAR=>hist   3   z,y,x   VAR Histogram

In this case, it would appear to GrADS that variable 'hist' varies in Z, but the user would have to remember that the Z levels correspond to histogram intervals. The latter technique makes it easier to slice through the data, but is not the most accurate representation. And if you don't have an unsued world-coordinate axis available, then you still have a way to access your data.


Remember to use xdfopen when opening your CTL file and NOT sdfopen.

Cheers
Kevin




On Nov 18, 2009, at 11/18/09 - 6:21 AM, luis blacutt wrote:

> Thanks Kevin,
> 
> I changed the ctl file to:
> dset /home/lucho/Desktop/GlueNC/bolbia.pmg1jul.03236.rr8.reg.nc
> undef 9.999E+20
> title baseline 60-90
> *produced by LFA
> dtype netcdf
> options yrev
> ydef 82 linear -33.640000 0.439000
> xdef 97 linear -84.120000 0.440000
> tdef 1 linear 00Z01jul1961 1mo
> zdef 1 linear 1 1
> vars 1
> temperature_at_ 0 216,1,0  **
> ENDVARS
> 
> now I got another error message
> 
> gancsetup error: Variable temperature_at_ not in netcdf file
> Data Request Error:  Error for variable 'temperature_at_'
>   Error ocurred at column 1
> DISPLAY error:  Invalid expression 
>   Expression = temperature_at_
> 
> Luis
> 
> On Tue, Nov 17, 2009 at 6:27 PM, Kevin M Levey <klevey at customweather.com> wrote:
> Luis,
> 
> the 5th argument is the data resolution, i.e. the incremental value, so if your x grid is 2 degrees, then your line should look like this
> 
>> xdef 97 linear -84.120000 2.00
> 
> 
> 
> Your y increment is set to 2 degrees, so I am assuming your data resolution is 2x2 degrees.
> 
> Here is the documentation: 
> 
> XDEF xnum mapping <additional arguments>
> 
> back to top
> This entry defines the grid point values for the X dimension, or longitude. The first argument, xnum, specifies the number of grid points in the X direction. xnum must be an integer >= 1. mapping defines the method by which longitudes are assigned to X grid points. There are two options for mapping:
> 
> LINEAR    Linear mapping 
> LEVELS    Longitudes specified individually
> The LINEAR mapping method requires two additional arguments: start and increment. start is a floating point value that indicates the longitude at grid point X=1. Negative values indicate western longitudes. increment is the spacing between grid point values, given as a positive floating point value.
> 
> The LEVELS mapping method requires one additional argument, value-list, which explicitly specifies the longitude value for each grid point. value-list should contain xnum floating point values. It may continue into the next record in the descriptor file, but note that records may not have more than 255 characters. There must be at least 2 levels in value-list; otherwise use the LINEAR method.
> 
> Here are some examples:
> 
> XDEF  144     LINEAR  0.0 2.5
> XDEF  72      LINEAR  0.0 5.0
> XDEF  12       LEVELS 0 30 60 90 120 150 180 210 240 270 300 330
> XDEF  12       LEVELS 15 45 75 105 135 165 195 225 255 285 315 345
> 
> 
> Regards,
> 
> Kevin M Levey, MSc in Oceans and Atmospheric Sciences (University of Cape Town)
> Director of Meteorological Operations
> CustomWeather, Inc.
> San Francisco, California, USA
> 
> "Taking the World by Storm!"
> 
> http://www.customweather.com
> http://www.myforecast.com
> http://www.1stweather.com
> 
> cell: 415-794-0411
> work: 415-777-3566
> email: klevey at customweather.com
> 
> On Nov 17, 2009, at 11/17/09 - 2:07 PM, luis blacutt wrote:
> 
>> Dear Grads users
>> I'm doing my first ctl file, it will have two variables, so far I have the following commands:
>> 
>> dset /home/lucho/Desktop/GlueNC/bolbia.pag%x1%mc.%.nc
>> options template
>> undef 9.999E+20
>> title baseline 60-90
>> *produced by LFA
>> dtype netcdf
>> options yrev
>> ydef 82 linear -33.640000 2.0000
>> xdef 97 linear -84.120000 -41.880000
>> tdef 1 linear 00Z01jul1961 1mo
>> zdef 1 linear 1 1
>> vars 2
>> total_precipita 0 216,1,0  **
>> temperature_at_ 0 216,1,0  **
>> ENDVARS
>> 
>> When I try to run it, it gives me the following error message
>> 
>> Scanning description file:  baseline.ctl
>> Open Error:  Missing or invalid dimension increment value
>>   --> The invalid description file record is: 
>>   --> xdef 97 linear -84.120000 -41.880000
>>   The data file was not opened. 
>> 
>> MyI checked by creating a grib file and those are the right numbers, the domain is for Southamerica. What am I missing?
>> Regards
>> Luis
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20091118/d2b9ba41/attachment.html 


More information about the gradsusr mailing list