A Tuesday 16 March 2010 23:56:38 Anton Kulchitsky escrigué:
> I would like to specify physical units and long names for every field of
> a compound object. I have an array of particles. Each particle is
> specified as a C structure with many fields associated with it. I would
> like to have an attribute for every field. However, when I create a
> compound object, I am not able to specify an attribute for a
> field. I am wondering if anyone has similar problem?

An elegant solution for this would be to write a compound type attribute, with 
the first field specifying the field to be described and the others with 
complementary info.  For example, if you have a table with two fields, one 
possibility is to describe it with a `descr` attribute like:

    Attribute: descr     {2}
        Type:      struct {
                   "fieldname"        +0    10-byte null-terminated ASCII 
string
                   "unit"             +10   10-byte null-terminated ASCII 
string
                   "expl"             +20   60-byte null-terminated ASCII 
string
                   "scale"            +80   native double
               } 88 bytes
        Data:  {"field1", "kg", "long explanatory field 1", 1.2},
               {"field2", "km/s", "long explanatory field 2", 24.3}

This is simple and quite powerful, IMO.

-- 
Francesc Alted

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to