Class NC2Group

Object
hdf.object.HObject
hdf.object.Group
hdf.object.nc2.NC2Group
All Implemented Interfaces:
MetaDataContainer, Serializable

public class NC2Group
extends Group
An NC2Group represents NetCDF3 group, inheriting from Group. Every NetCDF3 object has at least one name. An NetCDF3 group is used to store a set of the names together in one place, i.e. a group. The general structure of a group is similar to that of the UNIX file system in that the group may contain references to other groups or data objects just as the UNIX directory may contain subdirectories or files.
Version:
1.1 9/4/2007
Author:
Peter X. Cao
See Also:
Serialized Form
  • Field Details

    • netCDFGroup

      protected ucar.nc2.Group netCDFGroup
      The corresponding netcdf Group for this group.
  • Constructor Details

    • NC2Group

      public NC2Group​(FileFormat fileFormat, String name, String path, Group parent, long[] theID)
      Constructs an NC2 group with specific name, path, and parent.
      Parameters:
      fileFormat - the file which containing the group.
      name - the name of this group.
      path - the full path of this group.
      parent - the parent of this group.
      theID - the unique identifier of this data object.
  • Method Details

    • getNetCDFGroup

      public ucar.nc2.Group getNetCDFGroup()
    • setNetCDFGroup

      public void setNetCDFGroup​(ucar.nc2.Group netCDFGroup)
    • hasAttribute

      public boolean hasAttribute()
      Description copied from interface: MetaDataContainer
      Check if the object has any attributes attached.
      Returns:
      true if it has any attributes, false otherwise.
    • hasDimension

      public boolean hasDimension()
    • getMetadata

      public List getMetadata() throws Exception
      Description copied from interface: MetaDataContainer
      Retrieves the object's metadata, such as attributes, from the file.

      Metadata, such as attributes, is stored in a List.

      Returns:
      the list of metadata objects.
      Throws:
      Exception - if the metadata can not be retrieved
    • writeMetadata

      public void writeMetadata​(Object info) throws Exception
      Creates a new attribute and attached to this dataset if attribute does not exist. Otherwise, just update the value of the attribute.
      Parameters:
      info - the atribute to attach
      Throws:
      Exception - if there is an error
    • removeMetadata

      public void removeMetadata​(Object info) throws Exception
      Deletes an attribute from this dataset.
      Parameters:
      info - the attribute to delete.
      Throws:
      Exception - if there is an error
    • updateMetadata

      public void updateMetadata​(Object info) throws Exception
      Description copied from interface: MetaDataContainer
      Updates an existing piece of metadata attached to this object.
      Parameters:
      info - the metadata to update.
      Throws:
      Exception - if the metadata can not be updated
    • open

      public long open()
      Description copied from class: HObject
      Opens an existing object such as a dataset or group for access. The return value is an object identifier obtained by implementing classes such as H5.H5Dopen(). This function is needed to allow other objects to be able to access the object. For instance, H5File class uses the open() function to obtain object identifier for copyAttributes(long src_id, long dst_id) and other purposes. The open() function should be used in pair with close(long) function.
      Specified by:
      open in class HObject
      Returns:
      the object identifier if successful; otherwise returns a negative value.
      See Also:
      HObject.close(long)
    • close

      public void close​(long gid)
      Description copied from class: HObject
      Closes access to the object.

      Sub-classes must implement this interface because different data objects have their own ways of how the data resources are closed.

      For example, H5Group.close() calls the hdf.hdf5lib.H5.H5Gclose() method and closes the group resource specified by the group id.

      Specified by:
      close in class HObject
      Parameters:
      gid - The object identifier.
    • create

      public static NC2Group create​(String name, Group pgroup) throws Exception
      Creates a new group.
      Parameters:
      name - the name of the group to create.
      pgroup - the parent group of the new group.
      Returns:
      the new group if successful. Otherwise returns null.
      Throws:
      Exception - if there is an error
    • getMetadata

      public List getMetadata​(int... attrPropList) throws Exception
      Throws:
      Exception
    • netcdfAttributeString

      public String netcdfAttributeString​(int index)
    • netcdfDimensionString

      public String netcdfDimensionString​(int index)
    • netcdfTypedefString

      public String netcdfTypedefString​(int index)