Add DATE in an exsisting NC file

Dave Allured dave.allured at noaa.gov
Thu May 17 15:13:11 MDT 2007


Simone,

It is unclear what you are asking.  If you want to write a single 
date into a Netcdf file, then I suggest writing a global string 
attribute named "date" with a value of, for example, "2007-May-17" 
or "2007-05-17".  (First form preferred to prevent ambiguity. 
Always use four digit years.)

If your file contains a time series, and you want to add a list of 
dates to identify the time steps, then I strongly recommend that you 
add a numeric time coordinate variable that uses Udunits time 
encoding, and follows certain Netcdf standard conventions:

http://www.unidata.ucar.edu/software/udunits/
http://www.unidata.ucar.edu/software/netcdf/conventions.html

I use parts of the COARDS and CF conventions for time coordinates, 
with good compatibility for graphics software such as Grads and NCL.

For a brief introduction, see the paragraphs on coordinate systems 
and calendar in the Best Practices document:

http://www.unidata.ucar.edu/software/netcdf/docs/BestPractices.html

Here are my minimum recommendations to make a simple time coordinate 
variable:

Add a time coordinate array that is type double and one dimensional. 
  DO NOT use a string array.

Name of time dimension = time
Name of time coordinate variable = time

Minimum attributes:
* units = "days since 1800-1-1 0:0:0"
* calendar = "gregorian"
* long_name = "Time"

It is good to also include the optional actual_range attribute, a 
type double array of dimension (2), containing the first and last 
values from the time coordinate variable.

This is a basic prototype for you.  There are complexities regarding 
  the data type and attributes that I will not go into unless 
needed.  I hope this gets you started.

--Dave A.
CU/CIRES Climate Diagnostics Center (CDC)
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)

Simone Marras wrote:
> Good morning, I am dealing with a set of *.nc files which do not contain any 
> date nor information on the time and, for what I need to do with those files, 
> I actually need to add the DATE as YY-MM-DD in the files.
> 
> Has anyone ever gone through this? 
> 
> I hope someone can help me with this
> 
> Thank you in advance,
> 
> Regards
> 
> Simone 
> 

==============================================================================
To unsubscribe netcdfgroup, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================



More information about the netcdfgroup mailing list