Package ucar.nc2

Class Structure

  • All Implemented Interfaces:
    Comparable<Variable>, ProxyReader
    Direct Known Subclasses:
    Sequence, StructureDS

    @Immutable
    public class Structure
    extends Variable
    A Structure is a type of Variable that contains other Variables, like a struct in C. A Structure can be scalar or multidimensional.

    A call to structure.read() will read all of the data in a Structure, including nested structures, and returns an Array of StructureData, with all of the data in memory. If there is a nested sequence, the sequence data may be read into memory all at once, or it may be read in increments as the iteration proceeds.

    Generally, the programmer can assume that the data in one Structure are stored together, so that it is efficient to read an entire Structure, and then access the Variable data through the Arrays in the StructureData.

    • Method Detail

      • findVariable

        @Nullable
        public Variable findVariable​(String shortName)
        Find the Variable member with the specified (short) name, or null if not found.
      • getNumberOfMemberVariables

        public int getNumberOfMemberVariables()
        Get the number of variables contained directly in this Structure.
      • getVariables

        public List<Variable> getVariables()
        Get the variables contained directly in this Structure.
      • getVariableNames

        public List<String> getVariableNames()
        Get the (short) names of the variables contained directly in this Structure.
      • isSubset

        public boolean isSubset()
        Find if this was created from a subset() method.
      • makeStructureMembersBuilder

        public StructureMembers.Builder makeStructureMembersBuilder()
        Create a StructureMembers.Builder from the Variables of this Structure. Used to create StructureDataArray.
      • select

        public Structure select​(List<String> memberNames)
        Create a subset of the Structure consisting only of the given member variables
        Parameters:
        memberNames - list of Variable names, already a member
        Returns:
        Structure containing just those members
      • select

        public Structure select​(String varName)
        Create a subset of the Structure consisting only of the one member variable
        Parameters:
        varName - name of member Variable
        Returns:
        containing just that member
      • getElementSize

        public int getElementSize()
        The size of one element of this structure - equals the sum of sizes of its members. This is the canonical size, not the actual size stored on disk.
        Overrides:
        getElementSize in class Variable
      • getNameAndAttributes

        public String getNameAndAttributes()
        Get String with name and attributes. Used in short descriptions like tooltips.
      • builder

        public static Structure.Builder<?> builder()
        Get Builder for this class that allows subclassing.
        See Also:
        "https://community.oracle.com/blogs/emcmanus/2010/10/24/using-builder-pattern-subclasses"