Re: zero length attrributes...

NOTE: The netcdf-hdf mailing list is no longer active. The list archives are made available for historical reasons.


> Is a zero-length attribute in netCDF the same as a scalar, or is it more 
> like an empty array?  I can't imagine a use for the latter, but if it's 
> needed it's needed.

I'm the one who originally requested a zero-length attribute for
netCDF, so I should explain why I thought it might be useful.

What I had in mind was providing a way to declare that a variable had
a particular characteristic, for example whether it was georeferenced.
In this case, the characteristic is assumed to have a name, and the
variable either has the characteristic or doesn't, so a Boolean
attribute might be used, as in:

  georeferenced = True   or  georeferenced = False

But I thought it would be more elegant to just attach the attribute,
without values, to variables for which the characteristic is true, and
variables for which the characteristic was false or did not apply
would not have the attribute.

This is analogous to the use of C preprocessor macros, which may have
a value, but are often used just to test whether they are defined or
not, without regard for any value.  For example, if you include


on your compile line, it defines the macro "HAS_PROPERTY_X" without a
value, and it can be tested by the C preprocessor using


However, I don't think this is being used much.  Also, ncdump/ncgen
don't support the concept very well, they just use an empty string for
the value of all zero-length attributes, not matter what type:

                var:zlatt = "" ;

We could do the same for the netCDF/HDF representation, converting any
zero-length attribute into an empty string attribute in HDF5.


  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-hdf archives: