Class NC2Attribute

Object
All Implemented Interfaces:
Attribute, DataFormat, Serializable

public class NC2Attribute extends ScalarDS implements Attribute
An attribute is a (name, value) pair of metadata attached to a primary data object such as a dataset, group or named datatype. Like a dataset, an attribute has a name, datatype and dataspace. For more details on attributes, HDF5 Attributes in HDF5 User Guide The following code is an example of an attribute with 1D integer array of two elements.
 // Example of creating a new attribute
 // The name of the new attribute
 String name = "Data range";
 // Creating an unsigned 1-byte integer datatype
 Datatype type = new Datatype(Datatype.CLASS_INTEGER, // class
                              1,                      // size in bytes
                              Datatype.ORDER_LE,      // byte order
                              Datatype.SIGN_NONE);    // unsigned
 // 1-D array of size two
 long[] dims = {2};
 // The value of the attribute
 int[] value = {0, 255};
 // Create a new attribute
 Attribute dataRange = new Attribute(name, type, dims);
 // Set the attribute value
 dataRange.setValue(value);
 // See FileFormat.writeAttribute() for how to attach an attribute to an object,
 @see hdf.object.FileFormat#writeAttribute(HObject, Attribute, boolean)
 
For an atomic datatype, the value of an Attribute will be a 1D array of integers, floats and strings. For a compound datatype, it will be a 1D array of strings with field members separated by a comma. For example, "{0, 10.5}, {255, 20.0}, {512, 30.0}" is a compound attribute of {int, float} of three data points.
Version:
2.0 4/2/2018
Author:
Peter X. Cao, Jordan T. Henderson
See Also: