Re: How to associate attributes with fields in netCDF-4 compound types?


How about a function like this:

nc_def_compound_att(int ncid, nc_type compound_typeid, char *att_name,
                        nc_type att_base_typeid, nc_type

This could construct a new compound type, suitable for use as such an
attribute. For example, after defining come compound type cmp_typeid,
you could create the type for a "units" attribute like this:

nc_def_compound_att(ncid, cmp_typeid, "units", NC_CHAR, units_att_typeid);

If you passed a base type of NC_NAT, the compound attribute type could
use the same type as each field in the compound type. So you could get
a _FillValue type like this:

nc_def_compound_att(ncid, cmp_typeid, "_FillValue", NC_NAT, fill_att_typeid);

This functions could serve both as a convenience to the user and a way
of ensuring that everyone handles the problem the same way.

Any thoughts?


Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx

To unsubscribe netcdf-hdf, visit: