[gradsusr] xdfopen netcdf (Jennifer Adams)

Hoop hoop at colorado.edu
Sat Jun 1 22:19:54 EDT 2013


JianHua Qian,

The URL Jennifer gave has a link on it for writing
xdfopen-style DDFs:

http://iges.org/grads/gadoc/gradcomdxdfopen.html

Also, run the sdfopent script on your files.  In
addition to leaving you ready to deal with your
time series of data, it writes a 3-line xdfopen-
style DDF and opens it for you.  So, you can look
at that file for a working example.  To see how
to use sdfopent, just run it once without arguments.

-Hoop

On 05/31/2013 09:45 PM, Qian, JianHua wrote:
> Dear Hoop,
>
> Sorry that I ignored your early email about sdfopent.
> I do not know how to build a 3-line DDF.
>
> My data is the daily u-winds of the NCEP reanalysis:
> uwnd.1979.nc    (365 days)
> uwnd.1980.nc    (366 days,  leap year)
> uwnd.1981.nc    (365 days)
> Š
> uwnd.2008.nc    (366 days, leap year)
>
> How to build the xdfopen-style data descriptor file (DDF) for these
> datasets.
> Please correct my following is my draft:
>
> dset uwnd.%y4.nc
> templ  template
> ntimes 10958           (note: this is the total number of days from 1979
> to 2008)
>
>
> Thanks!
> Joshua
>
>
>
> On 5/31/13 5:37 PM, "Hoop"<hoop at colorado.edu>  wrote:
>
>> All true, however, one needn't go to this much trouble.  First of all,
>> the xdfopen-style data descriptor file (DDF) is only three lines long
>> to accomplish this templating.  Secondly, as I mentioned earlier this
>> week, the GrADS script "sdfopent", in the standard GrADS script library:
>>
>>     http://grads.iges.org/grads/gadoc/library.html
>>     ftp://cola.gmu.edu/grads/scripts/sdfopent.gs
>>
>> not only saves you the bother of writing any DDF, since it replicates
>> the old three argument syntax for doing templating on the sdfopen command,
>> it also gives you a working example of such a three-line DDF, as what the
>> script does is compose the XDFopen-style DDF and then open it for you.
>>
>> Of course, when I mentioned sdfopent earlier this week, I was soundly
>> ignored, and I expect the same will occur this time.
>>
>> -Hoop
>>
>> On 05/31/13 15:20, gradsusr-request at gradsusr.org wrote:
>>> Date: Fri, 31 May 2013 17:20:48 -0400
>>> From: Jennifer Adams<jma at cola.iges.org>
>>> Subject: Re: [gradsusr] xdfopen netcdf
>>> To: GrADS Users Forum<gradsusr at gradsusr.org>
>>> Message-ID:<9387B97A-9537-405A-9F3B-31054B4EEB67 at cola.iges.org>
>>> Content-Type: text/plain; charset="windows-1252"
>>>
>>> The data are packed. See the documentation for the UNPACK keyword
>>> which will need the names of the attributes that contain the
>>> scale factor and add offset.
>>> http://iges.org/grads/gadoc/SDFdescriptorfile.html
>>> --Jennifer
>>>
>>> On May 31, 2013, at 4:13 PM, Qian, JianHua wrote:
>>>
>>>> Jennifer,
>>>>
>>>> Thanks! I got the file opened, but the value of u wind is incorrect.
>>>> When I use sdfopen uwnd.1979.nc,    d uwnd,  I got:
>>>> ga->  sdfopen uwnd.1979.nc
>>>> Scanning self-describing file:  uwnd.1979.nc
>>>> SDF file uwnd.1979.nc is open as file 1
>>>> LON set to 0 360
>>>> LAT set to -90 90
>>>> LEV set to 1000 1000
>>>> Time values set: 1979:1:1:0 1979:1:1:0
>>>> E set to 1 1
>>>> ga->  d uwnd
>>>> Contouring: -15 to 15 interval 5
>>>>
>>>> However, when I use   open uwnd_3d_day_79_08.ctl
>>>> D uwnd,     I got something different:
>>>>
>>>> ga->  open uwnd_3d_day_79_08.ctl
>>>> Scanning description file:  uwnd_3d_day_79_08.ctl
>>>> Data file uwnd.%y4.nc is open as file 1
>>>> LON set to 0 360
>>>> LAT set to -90 90
>>>> LEV set to 1000 1000
>>>> Time values set: 1979:1:1:0 1979:1:1:0
>>>> E set to 1 1
>>>> ga->  d uwnd
>>>> Contouring: -20500 to -17000 interval 500
>>>>
>>>> I tried to add options big_endian or little_endian,  and still got
>>>> unrealistic values such as
>>>> Contouring: -20500 to -17000 interval 500
>>>>
>>>> The following is my ctl file:
>>>>
>>>> dset ^uwnd.%y4.nc
>>>> dtype netcdf
>>>> title 3-D NCEP-DOE uwnd 1jan1979 to 31dec2008
>>>> options little_endian template yrev
>>>> undef  -1.e+34
>>>> xdef  144 linear 0.0 2.5
>>>> ydef   73 linear -90.0 2.5
>>>> zdef 17 levels 1000 925 850 700 600 500 400 300 250 200 150 100 70 50
>>>> 30 20 10
>>>> tdef  10958 linear 00z01jan1979  24hr
>>>> vars 1
>>>> uwnd      17   t,z,y,x    m/s
>>>> Endvars
>>>>
>>>> Could you help to check the problem?
>>>>
>>>> Thanks!
>>>> Joshua
>>>>
>>>> From: Jennifer Adams<jma at cola.iges.org>
>>>> Reply-To: GrADS Users Forum<gradsusr at gradsusr.org>
>>>> Date: Fri, 31 May 2013 13:06:03 -0400
>>>> To: GrADS Users Forum<gradsusr at gradsusr.org>
>>>> Subject: Re: [gradsusr] xdfopen netcdf
>>>>
>>>> You can't have a negative increment.
>>>> ydef 73 linear -90 2.5
>>>>
>>>> You may also need to add:
>>>> options yrev
>>>>
>>>> --Jennifer
>>>>
>>>> On May 31, 2013, at 1:00 PM, Qian, JianHua wrote:
>>>>
>>>>> Jennifer,
>>>>>
>>>>> I used "open", but still have problem:
>>>>>
>>>>> ga->  open uwnd_3d_day_79_08.ctl
>>>>> Scanning description file:  uwnd_3d_day_79_08.ctl
>>>>> Open Error:  Missing or invalid dimension increment value
>>>>>    -->  The invalid description file record is:
>>>>>    -->  ydef   73 linear 90.0 -2.5
>>>>>    The data file was not opened.
>>>>>
>>>>> Thanks!
>>>>> Joshua
>>>>>
>>>>> From: Jennifer Adams<jma at cola.iges.org>
>>>>> Reply-To: GrADS Users Forum<gradsusr at gradsusr.org>
>>>>> Date: Fri, 31 May 2013 07:35:39 -0400
>>>>> To: GrADS Users Forum<gradsusr at gradsusr.org>
>>>>> Subject: Re: [gradsusr] xdfopen netcdf
>>>>>
>>>>> You have written a full descriptor file, so use 'open' instead of
>>>>> 'xdfopen'. --Jennifer
>>>>>
>>>>> On May 31, 2013, at 7:05 AM, Qian, JianHua wrote:
>>>>>
>>>>>> Hui and Grads Users, thanks!
>>>>>> But after I added "options template", I still got the same error
>>>>>> message:
>>>>>>
>>>>>> ga->  xdfopen uwnd_3d_day_79_08.ctl
>>>>>> Scanning Descriptor File:  uwnd_3d_day_79_08.ctl
>>>>>> gadxdf error: Missing or invalid dimension size.
>>>>>>    -->  The invalid description file record is:
>>>>>>    -->  xdef  144 linear 0.0 2.5
>>>>>>    The data file was not opened.
>>>>>>
>>>>>> Now my ctl file is as follows:
>>>>>>
>>>>>> dset ^uwnd.%y4.nc
>>>>>> dtype netcdf
>>>>>> title 3-D NCEP-DOE uwnd 1jan1979 to 31dec2008
>>>>>> options template
>>>>>> undef  -1.e+34
>>>>>> xdef  144 linear 0.0 2.5
>>>>>> ydef   73 linear 90.0 -2.5
>>>>>> zdef 17 levels 1000 925 850 700 600 500 400 300 250 200 150 100 70
>>>>>> 50 30 20 10
>>>>>> tdef  10958 linear 00z01jan1979  24hr
>>>>>> vars 1
>>>>>> uwnd      17   t,z,y,x    m/s
>>>>>> Endvars
>>>>>>
>>>>>> I do not know what is wrong with my grads descriptor file.
>>>>>>
>>>>>> Thanks!
>>>>>> Joshua
>>>>>>
>>>>>> From: Hui Wang - NOAA Affiliate<hui.wang at noaa.gov>
>>>>>> Reply-To: GrADS Users Forum<gradsusr at gradsusr.org>
>>>>>> Date: Thu, 30 May 2013 23:44:24 -0400
>>>>>> To: GrADS Users Forum<gradsusr at gradsusr.org>
>>>>>> Subject: Re: [gradsusr] xdfopen netcdf
>>>>>>
>>>>>> Hi Joshua,
>>>>>>
>>>>>> I think you need to add "options template" in the ctl file.
>>>>>>
>>>>>> Good luck,
>>>>>> Hui
>>>>>>
>>>>>> On Thu, May 30, 2013 at 10:32 PM, Qian, JianHua
>>>>>> <JianHua_Qian at uml.edu>  wrote:
>>>>>> Grads Users,
>>>>>>
>>>>>> I got the following message when doing
>>>>>> xdfopen uwnd_3d_day_79_08.ctl
>>>>>>
>>>>>> ga->  xdfopen uwnd_3d_day_79_08.ctl
>>>>>> Scanning Descriptor File:  uwnd_3d_day_79_08.ctl
>>>>>> gadxdf error: Missing or invalid dimension size.
>>>>>>    -->  The invalid description file record is:
>>>>>>    -->  xdef  144 linear 0.0 2.5
>>>>>>    The data file was not opened.
>>>>>>
>>>>>> The descriptor file uwnd_3d_day_79_08.ctl   is copied below:
>>>>>>
>>>>>> dset ^uwnd.%y4.nc
>>>>>> dtype netcdf
>>>>>> title 3-D NCEP-DOE uwnd 1jan1979 to 31dec2008
>>>>>> undef  -1.e+34
>>>>>> xdef  144 linear 0.0 2.5
>>>>>> ydef   73 linear 90.0 -2.5
>>>>>> zdef 17 levels 1000 925 850 700 600 500 400 300 250 200 150 100 70
>>>>>> 50 30 20 10
>>>>>> tdef  10958 linear 00z01jan1979  24hr
>>>>>> vars 1
>>>>>> uwnd      17   t,z,y,x    m/s
>>>>>> Endvars
>>>>>>
>>>>>> The data files are in the current directory:
>>>>>> uwnd.1979.nc
>>>>>> uwnd.1980.nc
>>>>>> ?
>>>>>> When I do ncdump uwnd.1979.nc , I got:
>>>>>> netcdf uwnd.1979 {
>>>>>> dimensions:
>>>>>> lon = 144 ;
>>>>>> lat = 73 ;
>>>>>> level = 17 ;
>>>>>> time = UNLIMITED ; // (365 currently)
>>>>>> nbnds = 2 ;
>>>>>> variables:
>>>>>> float level(level) ;
>>>>>> level:units = "millibar" ;
>>>>>> level:actual_range = 1000.f, 10.f ;
>>>>>> level:long_name = "Level" ;
>>>>>> level:positive = "down" ;
>>>>>> level:GRIB_id = 100s ;
>>>>>> level:GRIB_name = "hPa" ;
>>>>>> level:axis = "z" ;
>>>>>> level:coordinate_defines = "point" ;
>>>>>> float lat(lat) ;
>>>>>> lat:units = "degrees_north" ;
>>>>>> lat:actual_range = 90.f, -90.f ;
>>>>>> lat:long_name = "Latitude" ;
>>>>>> lat:standard_name = "latitude_north" ;
>>>>>> lat:axis = "y" ;
>>>>>> lat:coordinate_defines = "point" ;
>>>>>> float lon(lon) ;
>>>>>> lon:units = "degrees_east" ;
>>>>>> lon:long_name = "Longitude" ;
>>>>>> lon:actual_range = 0.f, 357.5f ;
>>>>>> lon:standard_name = "longitude_east" ;
>>>>>> lon:axis = "x" ;
>>>>>> lon:coordinate_defines = "point" ;
>>>>>> double time(time) ;
>>>>>> time:units = "hours since 1800-1-1 00:00:0.0" ;
>>>>>> time:long_name = "Time" ;
>>>>>> time:actual_range = 1569072., 1577808. ;
>>>>>> time:delta_t = "0000-00-01 00:00:00" ;
>>>>>> time:standard_name = "time" ;
>>>>>> time:axis = "t" ;
>>>>>> time:coordinate_defines = "start" ;
>>>>>> time:avg_period = "0000-00-01 00:00:00" ;
>>>>>> ?
>>>>>> Could someone give me a clue?
>>>>>>
>>>>>> Thanks!
>>>>>> Joshua
>>>>>>
>>>>>> _______________________________________________
>>>>>> gradsusr mailing list
>>>>>> gradsusr at gradsusr.org
>>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>     gradsusr mailing list gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>> _______________________________________________
>>>>>> 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
>>>>> _______________________________________________
>>>    gradsusr mailing list gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>> _______________________________________________
>>>>> 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
>>>> _______________________________________________
>>>   gradsusr mailing list gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>> _______________________________________________
>>>> 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
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>



More information about the gradsusr mailing list