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

[netCDF #RUH-555763]: Query about the NetCDF Classic Format Specification



> Hi
> 
> I have recently joined a team working on some health effects of climate
> change. A part of this work makes use of the output/projections of
> various climate models and, in particular, using IPSL-CM5A models.
> The output comes to us in CF-1.0 "format" in a netCDF classic format
> file structure.
> 
> I've been asked to transform data sets out of this format/file structure
> into other file formats suitable for use in our team's software.
> 
> I have a question about a minor matter in the netCDF Classic Format
> Specification
> [http://www.unidata.ucar.edu/software/netcdf/docs/classic_format_spec.html].
> 
> dim_length is defined to be a non-negative 32-bit two-s complement
> integer and there is a side note to the effect that a zero value
> indicates that the dimension concerned is the record dimension.

Actually, that's only used in the library API when you *define* dimensions.
A dimension created with dimlen of 0 is marked as an unlimited dimension,
but will have its actual dimension length maintained in the netCDF file
when it's written or appended to.  So you can inquire about the current 
length of the unlimited dimension as if it were a fixed dimension, using the
nc_inq_dimlen() function.

> Elsewhere in documentation and in CDLs I have seen or seen reference to
> UNLIMITED  and NC_UNLIMITED as if dim-length were defined to be
> something like = POSITIVE | NC_UNLIMITED.

The CDL keyword "UNLIMITED" or "unlimited" are used to indicate which
dimension is an unlimited dimension, if any.  When you use ncdump to
look at an existing netCDF file, it will have the actual current length
appended in a CDL comment, for example:

  dimensions:
     time = UNLIMITED ; // (4 currently)

The C macro NC_UNLIMITED, defined in the include file netcdf.h, is what
C programs can use to define an unlimited dimension, or they can just
use 0, although that doesn't document why 0 is used as well as using the
macro NC_UNLIMITED instead.

> Since I am working with an old netCDF file format, is there anything in
> the history of dim-length that I should be concerned about?  Were
> UNLIMITED and NC_UNLIMITED ever formalised and, if so, have they now
> been deprecated?

They have different uses (one is a CDL keyword, the other is a C macro).
Neither has ever changed since netCDF was first documented in 1989. They 
are formalized in the current documentation and standard.  Neither is 
deprecated.

--Russ

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



Ticket Details
===================
Ticket ID: RUH-555763
Department: Support netCDF
Priority: Normal
Status: Closed