[gradsusr] How to set time attribute in sdfwrite

Charles Seman Charles.Seman at noaa.gov
Wed Jan 19 13:38:45 EST 2011


Dear Zablone,

It would be very helpful to see the output from "ncdump -h gcpcr.nc"... 
can you provide this?  Without the ncdump output, the following is given 
assuming certain things: 1) please see 
http://grads.iges.org/grads/gadoc/descriptorfile.html#VARS and note that 
with the "dtype netcdf" option, change the "1 99" in the "r=>r" line to 
"0 t,y,x" (assuming gcpcr.nc has x,y,t dimensions in it; if it does have 
a "z" dimension, try "1 t,z,y,x"), 2) try removing the "longitude", 
"latitude", "z", and "t" characters in the xdef, ydef, zdef, and tdef 
lines, respectively (these are not used by the "open" command but are 
used by the "xdfopen" command: please see item #2 at 
http://grads.iges.org/grads/gadoc/gradcomdxdfopen.html).  Again, these 
suggestions are given assuming certain things about gcpcr.nc; if you can 
provide the output from "ncdump -h gcpcr.nc" or "ncdump -c gcpcr.nc" 
that would be very helpful.

Hope this helps,
Chuck

Zablone Owiti wrote:
> Dear Charles,
> Thanks for the explanation and the earlier emails. I wrote a .ctl 
> file(see bellow) to read the original data (via xdfopen command), but 
> I get the following error (on the z dimension) which I have failed to 
> figure out how to correct :  
>  *Scanning Descriptor File:  gcpcr.ctl
> gadsdf: Lev dimension z is not an SDF dimension.
> SDF Descriptor file gcpcr.ctl was not successfully opened & parsed.
> *
> The gcpcr.ctl is:
> dset ^gcpcr.nc
> dtype netcdf
> title Test File
> undef 1e+20
> xdef longitude 360 linear 0.5 1.0
> ydef latitude 180 linear -89.5 1.0
> zdef z 1 levels 0
> tdef t 674 linear 0Z1jan1948 1mo
> vars 1
> r=>r 1 99 Precipitation (mm/day)
> endvars
>
> Further, the *q dims* results for the original data file (gcpcr.nc) 
> when opened with sdfopen command  are:
> Default file number is: 1
> X is varying   Lon = 0 to 360   X = 0.5 to 360.5
> Y is varying   Lat = -89.5 to 89.5   Y = 1 to 180
> Z is fixed     Lev = 0  Z = 1
> T is fixed     Time = 00Z01JAN1948  T = 1
> E is fixed     Ens = 1  E = 1
>
> Thanks
> */===================================================/*
> */ZABLONE OWITI
> GRADUATE STUDENT
> Nanjing University of Information, Science and Technology
> College of International Education
> Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China
> /*Tel: +86-25-58731402
> Fax: +86-25-58731456
> */Mob. 15077895632/*
> */Website: www.nuist.edu.cn <http://www.nuist.edu.cn/>
> /*/*====================================================
> *
> /"The real art of conversation is not only to say the right thing at 
> the right time, but also to leave unsaid the wrong thing at the 
> tempting moment."///
>  
> /
>
> *From:* Charles Seman <Charles.Seman at noaa.gov>
> *To:* Zablone Owiti <zablonowiti at yahoo.com>; GrADS Users Forum 
> <gradsusr at gradsusr.org>
> *Cc:*
> *Sent:* Wednesday, 19 January 2011 1:29 AM
> *Subject:* Re: [gradsusr] How to set time attribute in sdfwrite
>
> Zablone,
>
> I'll forward a couple of emails from Jennifer Adams who helped me put 
> a time axis on a GrADS sdfwrite netCDF output file (the input netCDF 
> file had no Z or T dimension...).  In essence, the solution involved 
> defining a data descriptor file to open the input netCDF file to 
> define the time axis... I'm not sure what your input dataset 
> attributes look like, so I'm guessing here...  If you have questions 
> or want sample code from a script, feel free to email me.
>
> Hope this helps,
> Chuck
>
> Zablone Owiti wrote:
> > Dear users,
> >
> > I am writting out monthly data from a .nc file using the sdfwrite 
> command. When I open the data I get the following warning:
> > *SDF file has no discernable time coordinate -- using default values.
> > *and when I q dims  Time = 00z01Jan001 instead of the time for the 
> data extracted i.e  00z01Jul1960. How can I use the *sdfattr* command 
> to force the time attribute. Below is the script I am using to extract 
> the data:
> > 'reinit'
> > 'sdfopen gcpcr.nc'
> > 'set x 0.5 360.5'
> > 'set y 1 180'
> > 'set time 00z01jul1960'
> > 'set sdfwrite r1.nc'
> > 'define pcp=r'
> > 'sdfwrite pcp'
> > 'clear sdfwrite'
> >
> > Thanks
> > */===================================================/*
> > */ZABLONE OWITI
> > GRADUATE STUDENT
> > Nanjing University of Information, Science and Technology
> > College of International Education
> > Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China
> > /*Tel: +86-25-58731402
> > Fax: +86-25-58731456
> > */Mob. 15077895632/*
> > */Website: www.nuist.edu.cn <http://www.nuist.edu.cn/>
> > /*/*====================================================
> > *
> > /"The real art of conversation is not only to say the right thing at 
> the right time, but also to leave unsaid the wrong thing at the 
> tempting moment."///
> >  /
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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 reflect any
> official or unofficial position of the United States Federal Government,
> the United States Department of Commerce, or NOAA."
>
>
>
>

-- 

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 reflect any
official or unofficial position of the United States Federal Government,
the United States Department of Commerce, or NOAA."




More information about the gradsusr mailing list