[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20030125: netCDF: question about global attributes?



>To: "'address@hidden'" <address@hidden>
>From: Naveenta Anand <address@hidden>
>Subject: netCDF: question about global attributes?
>Organization: Fisheries and Oceans Canada
>Keywords: 200301242005.h0OK55x03331 netCDF global attributes

Hi Naveenta,

> I have a question. Can a global attribute (string of text) be dynamically 
> read 
> into a netcdf file (with File read and write functions) OR does it have to be 
> statically written by the user?

I don't think I understand the question.  Global attributes are like
any other attributes, in that they are stored in the first section of
a netCDF file, also called the "file header".  The size of this
section is fixed when you first call nc_enddef() (or nf_enddef90 or
the equivalent function in any of the other language interfaces).  If
you want to create a new global attribute or enlarge an existing global
attribute and there is enough space in the header for the attribute, it
can be defined efficiently and written into the header with the usual
attribute function.

If there is not enough space and you try to create a new global
attribute or extend an enlarge attribute, the file will be rewritten,
data and all, on close.  There is more information on this in Chapter
9 of the User's Guide:

  
http://www.unidata.ucar.edu/packages/netcdf/f90/Documentation/f90-html-docs/guide9.html

Something not covered very well in the current versions of the User's
Guide is that it is possible to reserve extra space in a netCDF header
when a file is created so that additional attributes can later be
added or enlarged efficiently, without copying the data.  To do this,
you use the "underbar underbar" functions such as nc__enddef.  Here's
a previous support reply with more information about this:

  http://www.unidata.ucar.edu/cgi-bin/mfs/70/4808

> Also what is the limit on number of a characters (for a string of text) on a 
> global attribute?

There is no practical limit.  The upper limit is about 2.1 Gbytes.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu