NetCDF Xdfopen problem
Eric Altshuler
ela at COLA.IGES.ORG
Tue Nov 13 19:54:12 EST 2007
Mike,
Apparently the documentation contains conflicting information. The section on data descriptor files never mentions any modifications for XDEF, etc. in the case of netcdf data. However, the section on 'xdfopen' does say the modifications are necessary. I have never actually encountered this situation since all the netcdf datasets I've worked with could be opened directly with 'sdfopen' and a DDF was not needed. In giving you advice, I looked at the documentation on DDFs but not at the documentation on xdfopen, so I apologize if I led you astray.
As for the error in the dtype line, try deleting it from your DDF. The 'dtype netcdf' is perfectly valid (and necessary) if you are using 'open' to open the DDF, but I'm not sure that's the case when using 'xdfopen'.
Best regards,
Eric L. Altshuler
Assistant Research Scientist
Center for Ocean-Land-Atmosphere Studies
4041 Powder Mill Road, Suite 302
Calverton, MD 20705-3106
USA
E-mail: ela at cola.iges.org
Phone: (301) 902-1257
Fax: (301) 595-9793
----- Original Message -----
From: "Mike Johnson" <Mike.W.Johnson at NOAA.GOV>
To: GRADSUSR at LIST.CINECA.IT
Sent: Tuesday, November 13, 2007 6:08:18 PM (GMT-0500) America/New_York
Subject: Re: NetCDF Xdfopen problem
Eric - thanks for response. However, still having some difficulties.
1. Making changes you suggested my .ddf file looks like:
DSET ^20070824_1200.nc
DTYPE netcdf
TITLE Example NetCDF File
UNDEF -99999.
XDEF 200 LINEAR -125.117 2.5
YDEF 200 LINEAR 40.2711 2.5
ZDEF LINEAR 1 1
TDEF 39 LINEAR 12Z24AUG2007 1HR
VARS 2
ws=>ws 1 t,z,y,x Wind Speed
wd=>wd 1 t,z,y,x Wind Direction
ENDVARS
2. Error generated using gradsnc to open grads:
xdfopen 20070824_1200.ddf
Scanning Description File: 20070824_1200.ddf
XDFopen Error: Unknown keyword in description file
--> The invalid description file record is:
--> dtype netcdf
The data file was not opened.
question - Looking at on-line documentation, I thought the XDEF, YDEF, ZDEF, TDEF needed to be
modified for netcdf files to add exact variable name described in ncdump of file. From your suggestion, apparently that's not true?
thanks
Mike Johnson
Senior Forecaster,
Medford OR Weather Forecast Office
National Weather Service, NOAA
(541) 776-4344
Eric Altshuler wrote:
> Mike,
>
> The XDEF, YDEF, ZDEF and TDEF statements should have the following syntax:
>
> xdef 200 linear -125.117 2.5
> ydef 200 linear 40.2711 2.5
> zdef 1 linear 1 1
> tdef 39 linear 12Z24AUG2007 1HR
>
> You probably also need the following line in the data descriptor file:
>
> dtype netcdf
>
> Try opening the dataset after making these changes.
>
> Best regards,
>
>
> Eric L. Altshuler
> Assistant Research Scientist
> Center for Ocean-Land-Atmosphere Studies
> 4041 Powder Mill Road, Suite 302
> Calverton, MD 20705-3106
> USA
>
> E-mail: ela at cola.iges.org
> Phone: (301) 902-1257
> Fax: (301) 595-9793
>
> ----- Original Message -----
> From: "Mike Johnson" <Mike.W.Johnson at NOAA.GOV>
> To: GRADSUSR at LIST.CINECA.IT
> Sent: Thursday, November 8, 2007 9:07:41 PM (GMT-0500) America/New_York
> Subject: NetCDF Xdfopen problem
>
> I've just recently returned to the GRADS community from an extended
> absence and was hoping someone could give some advice on reading a
> netcdf file (of which I have no previous experience). Anyway, I've
> tried a number of things relative to online documentation and examples
> from the users group. So far I've been unsuccessful in opening the
> file. I am using GrADS v1.9b4. thanks in advance...
>
> Mike Johnson
>
> Here's symptoms of what I thought was the most promising methodology.
>
> *1. I created a data descriptor file "20070824_1200.ddf" with following:*
>
> DSET ^20070824_1200.nc
> TITLE Example NetCDF File
> UNDEF -99999.
> XDEF x 200 LINEAR -125.117 2.5
> YDEF y 200 LINEAR 40.2711 2.5
> ZDEF levels_1 LINEAR 1 1
> TDEF n_valtimes 39 LINEAR 12Z24AUG2007 1HR
> VARS 2
> ws=>ws 1 t,z,y,x Wind Speed
> wd=>wd 1 t,z,y,x Wind Direction
> ENDVARS
>
> *2. error produced:*
> xdfopen 20070824_1200.ddf
> Scanning Description File: 20070824_1200.ddf
> XDFopen Error: Missing or invalid dimension size.
> --> The invalid description file record is:
> --> zdef levels_1 linear 1 1
> The data file was not opened.
>
> *3. partial ncdump output of 20070824_1200.nc:*
> netcdf 20070824_1200 {
> dimensions:
> record = UNLIMITED ; // (39 currently)
> n_valtimes = 39 ;
> data_variables = 2 ;
> charsPerLevel = 11 ;
> namelen = 132 ;
> x = 200 ;
> y = 200 ;
> levels_1 = 1 ;
> variables:
> float ws(record, levels_1, y, x)
> ws:long_name = "Wind Speed" ;
> ws:units = "m/s" ;
> ws:udunits = "meter/sec" ;
> ws:uiname = "windSpeed" ;
> ws:valid_range = -150.f, 150.f ;
> ws:_FillValue = -99999.f ;
> ws:_n3d = 1 ;
> ws:levels = "FHAG 10" ;
> char wsLevels(levels_1, charsPerLevel) ;
> char wsInventory(n_valtimes, levels_1) ;
> float wd(record, levels_1, y, x) ;
> wd:long_name = "Wind Direction" ;
> wd:units = "degree_True" ;
> wd:udunits = "degree_True" ;
> wd:uiname = "windDir" ;
> wd:valid_range = 0.f, 360.f ;
> wd:_FillValue = -99999.f ;
> wd:_n3d = 1 ;
> wd:levels = "FHAG 10"
> char wdlevels(levels_1, charsPerLevel) ;
> char wdInventory(n_valtimes, levels_1) ;
> int valtimeMINUSreftime(n_valtimes) ;
> valtimeMINUSreftime:units = "seconds"
> double reftime ;
> reftime:long_name = "reference time" ;
> reftime:units = "seconds since (1970-1-1
> 00:00:00:0)" ;
> char origin(namelen) ;
> char model(namelen) ;
> // global attributes:
> :projIndex = 3 ;
> :projName = "LATLON"
> :centralLat = 42.5392f ;
> :centralLon = -122.1475f ;
> :rotation = 25.f ;
> :lat00 = 40.2711f ;
> :lon00 = -125.117f ;
> :latNxNy = 44.7219f ;
> :lonNxNy = -118.9594f ;
> :dxKm = 2.5f ;
> :dyKm = 2.5f ;
> data:
>
> ws =
> 8., 8.6,...............................
>
More information about the gradsusr
mailing list