[gradsusr] GrADS v2.0.a7.oga.3: modifying time axis units

Charles Seman Charles.Seman at noaa.gov
Tue Mar 30 16:45:42 EDT 2010


Thanks, Jennifer,

Your information below for the "xdfopen" dimension axis naming worked!

Thanks,
Chuck

Jennifer Adams wrote:
>
> On Mar 30, 2010, at 12:28 PM, Charles Seman wrote:
>
>> Thanks, Jennifer,
>>
>> I didn't think of using a descriptor file to open the source netCDF file!
>>
>> "open" file: was able to get the "open" file descriptor file to work as
>> desired...
> Great! 
>
>> gadsdf: Lev dimension level is not an SDF dimension.
>> ...
>> the xdf file contains (dset path omitted):
>> dset ...
>> zdef level 1 levels 0
>> tdef time 1 linear 00Z01JAN1998 3hr
>>
>> Is the xdfopen file set up correctly?
>
> The name of the dimension axis has to be one that exists in the file. 
> Since your variable has no Z or T dimension, use the name of the lon 
> or lat axis instead of "level" and "time". It doesn't matter what 
> values those axes contain, since you are overriding them completely 
> with your own metadata. 
>
> --Jennifer
>
>>
>> Thanks for your help!
>> Chuck
>>
>> Jennifer Adams wrote:
>>> Hi, Charles --
>>> Good question! The units of the time axis cannot be changed with the
>>> 'set sdfattr' command. The units attribute will always be written out
>>> as 'minutes since' and the base time will always be the time value of
>>> the first time step in your defined variable. The way to fix this
>>> problem is to assign a time value of 1jan1998 to netcdf variable in
>>> the first place instead of allowing it to default to 1jan0001. Use a
>>> descriptor file (for xdfopen or open) that has a tdef statement with
>>> the time you wish to assign. Then when you define your variable and
>>> write it out with sdfwrite, it will have the correct time value.
>>> --Jennifer
>>>
>>> On Mar 29, 2010, at 7:58 PM, Charles Seman wrote:
>>>>
>>>> I'm unable to modify the time axis units for an sdfwrite netCDF file
>>>> using the following command:
>>>> 'set sdfattr time String units "minutes since 1998-01-01 00:00:00"'
>>>> the units remain at "minutes since 0001-01-01 00:00"
>>>>
>>>> Here are the commands used to generate "nc_file" (the original file had
>>>> only lat/lon axes; no "z" or "t" axes...)
>>>>
>>>> 'set sdfwrite -4d 'nc_file
>>>> 'set sdfattr level String long_name height'
>>>> 'set sdfattr level String units m'
>>>> 'set sdfattr time String units "minutes since 1998-01-01 00:00:00"'
>>>> 'set sdfattr rprecip String long_name regridded precipitation'
>>>> 'set sdfattr rprecip String units mm/h'
>>>> 'set undef 'undef_value ;* change from default -9.99e8 to use source
>>>> netCDF file undef
>>>> say
>>>> 'q sdfwrite'
>>>> say result
>>>> 'sdfwrite rprecip'
>>>> 'c sdfwrite'
>>>>
>>>> Here's the "q sdfwrite" output (except for the SDFwrite file name):
>>>>
>>>> SDFwrite format is NetCDF
>>>> SDFwrite output undef value is set to -9999.900000
>>>> SDFwrite file will have at least 4 dimensions
>>>> SDFwrite attribute metadata:
>>>> level String long_name height
>>>> level String units m
>>>> time String units "minutes since 1998-01-01 00:00:00"
>>>> rprecip String long_name regridded precipitation
>>>> rprecip String units mm/h
>>>>
>>>> Here's output from the "\ncdump -c" on the output "nc_file"... the
>>>> "level" and "rprecip" attributes were modified as desired, but not the
>>>> time units:
>>>>
>>>> dimensions:
>>>>       longitude = 144 ;
>>>>       latitude = 50 ;
>>>>       level = 1 ;
>>>>       time = 1 ;
>>>> variables:
>>>>       double longitude(longitude) ;
>>>>               longitude:units = "degrees_east" ;
>>>>               longitude:long_name = "Longitude" ;
>>>>       double latitude(latitude) ;
>>>>               latitude:units = "degrees_north" ;
>>>>               latitude:long_name = "Latitude" ;
>>>>       double level(level) ;
>>>>               level:units = "m" ;
>>>>               level:long_name = "height" ;
>>>>       double time(time) ;
>>>>               time:long_name = "Time" ;
>>>>               time:units = "minutes since 0001-01-01 00:00" ;
>>>>       double rprecip(time, level, latitude, longitude) ;
>>>>               rprecip:missing_value = -9999.9 ;
>>>>               rprecip:long_name = "regridded precipitation" ;
>>>>               rprecip:units = "mm/h" ;
>>>> data:
>>>>
>>>> longitude = 1.25, 3.75, 6.25, 8.75, 11.25, 13.75, 16.25, 18.75, 21.25,
>>>>   23.75, 26.25, 28.75, 31.25, 33.75, 36.25, 38.75, 41.25, 43.75, 46.25,
>>>>   48.75, 51.25, 53.75, 56.25, 58.75, 61.25, 63.75, 66.25, 68.75, 71.25,
>>>>   73.75, 76.25, 78.75, 81.25, 83.75, 86.25, 88.75, 91.25, 93.75, 96.25,
>>>>   98.75, 101.25, 103.75, 106.25, 108.75, 111.25, 113.75, 116.25, 
>>>> 118.75,
>>>>   121.25, 123.75, 126.25, 128.75, 131.25, 133.75, 136.25, 138.75,
>>>> 141.25,
>>>>   143.75, 146.25, 148.75, 151.25, 153.75, 156.25, 158.75, 161.25,
>>>> 163.75,
>>>>   166.25, 168.75, 171.25, 173.75, 176.25, 178.75, 181.25, 183.75,
>>>> 186.25,
>>>>   188.75, 191.25, 193.75, 196.25, 198.75, 201.25, 203.75, 206.25,
>>>> 208.75,
>>>>   211.25, 213.75, 216.25, 218.75, 221.25, 223.75, 226.25, 228.75,
>>>> 231.25,
>>>>   233.75, 236.25, 238.75, 241.25, 243.75, 246.25, 248.75, 251.25,
>>>> 253.75,
>>>>   256.25, 258.75, 261.25, 263.75, 266.25, 268.75, 271.25, 273.75,
>>>> 276.25,
>>>>   278.75, 281.25, 283.75, 286.25, 288.75, 291.25, 293.75, 296.25,
>>>> 298.75,
>>>>   301.25, 303.75, 306.25, 308.75, 311.25, 313.75, 316.25, 318.75,
>>>> 321.25,
>>>>   323.75, 326.25, 328.75, 331.25, 333.75, 336.25, 338.75, 341.25,
>>>> 343.75,
>>>>   346.25, 348.75, 351.25, 353.75, 356.25, 358.75 ;
>>>>
>>>> latitude = -49, -47, -45, -43, -41, -39, -37, -35, -33, -31, -29, -27,
>>>> -25,
>>>>   -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7,
>>>> 9, 11,
>>>>   13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45,
>>>> 47, 49 ;
>>>>
>>>> level = 0 ;
>>>>
>>>> time = 0 ;
>>>>
>>>> Thanks for your help,
>>>> Chuck
>>>>
>>>> -- 
>>>>
>>>> Please note that Charles.Seman at noaa.gov 
>>>> <mailto:Charles.Seman at noaa.gov>
>>>> <mailto:Charles.Seman at noaa.gov> should be considered my NOAA
>>>> email address, not cjs at gfdl.noaa.gov <mailto:cjs at gfdl.noaa.gov>.
>>>>
>>>> ********************************************************************
>>>> Charles Seman                                Charles.Seman at noaa.gov 
>>>> <mailto:Charles.Seman at noaa.gov>
>>>> <mailto:Charles.Seman at noaa.gov>
>>>> U.S. Department of Commerce / NOAA / OAR
>>>> Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
>>>> 201 Forrestal Road                              fax: (609) 987-5063
>>>> Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/ 
>>>> <http://www.gfdl.noaa.gov/%7Ecjs/>
>>>> <http://www.gfdl.noaa.gov/%7Ecjs/>
>>>> ********************************************************************
>>>>
>>>> "The contents of this message are mine personally and do not 
>>>> necessarily
>>>> reflect any position of the Government or NOAA."
>>>>
>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org <mailto: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 <mailto:jma at cola.iges.org>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>
>> -- 
>>
>> Please note that Charles.Seman at noaa.gov 
>> <mailto:Charles.Seman at noaa.gov> should be considered my NOAA
>> email address, not cjs at gfdl.noaa.gov <mailto:cjs at gfdl.noaa.gov>.
>>
>> ********************************************************************
>> Charles Seman                                Charles.Seman at noaa.gov 
>> <mailto:Charles.Seman at noaa.gov>
>> U.S. Department of Commerce / NOAA / OAR
>> Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
>> 201 Forrestal Road                              fax: (609) 987-5063
>> Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/ 
>> <http://www.gfdl.noaa.gov/%7Ecjs/>
>> ********************************************************************
>>
>> "The contents of this message are mine personally and do not necessarily
>> reflect any position of the Government or NOAA."
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org <mailto: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 <mailto:jma at cola.iges.org>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>   

-- 

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
 Charles Seman                                Charles.Seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not necessarily
reflect any position of the Government or NOAA."




More information about the gradsusr mailing list