[ESIP-CF] Esip-cf Digest, Vol 5, Issue 1

Russ Rew russ at unidata.ucar.edu
Thu Feb 2 12:58:15 EST 2012


Hi Ted,

> I agree that User-Defined Types are a potentially very interesting approach
> to adding structure to metadata in granules. One of the challenges is that
> UDTs have been developed as a tool for describing data structures instead
> of attribute structures. In other words, we would need to write metadata
> into variables instead of into attributes. I suspect that this would change
> the mechanisms we use to write and extract this information considerably...

In C-based netCDF-4, attributes of user-defined type are fully
supported.  Also, both ncdump, ncgen, and nccopy utilities support using
the same types for attributes as for variables, including arbitrary
user-defined types.  So if you want to keep metadata in attributes, you
should be able to do that in netCDF-4.

An example of this is in the CDL of Tom Kunicki's example of structuring
observational data, where the "units" attribute for a variable that was
a UDT compound structure is also a UDT of compound structure:

> >  types:
> >    compound observation_t {
> >      int time ;
> >      float temperature ;
> >      float pressure ;
> >    }; // observation_t

> >    compound observation_att_t {
> >      string time ;
> >      string temperature ;
> >      string pressure ;
> >    }; // observation_att_t
  ...
> >  variables:
> >          observation_t  observations(station, observation) ;
> >              observations:coordinates =3D
> >                  "observations.time longitude latitude elevation" ;
> >              observation_att_t  observations:units =3D
> >                  {"days since 1929-1-1 0:0:0", "degF", "hectopascal"} ;
 
> I have discussed the question of arrays of attributes with Mike Folk from
> the HDF group (cc'ed) recently, and plan to follow up on that approach...
> If we could extend the idea of UDT's into the attribute space it would be
> very cool!

HDF5 also supports attributes of user-defined types.  That's what we
use underneath netCDF-4.  The main problem with them is the lack of a
way to assign an attribute to a structure member of a user-defined type,
but we have a fairly natural convention for that:

  http://www.unidata.ucar.edu/netcdf/papers/nc4_conventions.html#Convention_for_Assigning_Attri

--Russ


More information about the Esip-cf mailing list