Francesc,
I think this is a really nice and elegant solution. Honestly, I am still
thinking of attributes as of simple strings. Now I see the advantage to
use other types. Thank you!
I see just another problem with this though. Actually, what I really
want is attributes for the types, not the data! When attributes are
associated with data, this compound attribute need to be written every
time when I write data of this type. However, what I really need for
compound type are attributes of the type. Indeed, once fields are
described there is no need to repeat this every time I write the data
into a file.
Anton
> 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.
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org