public class Structure extends Variable
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.
Modifier and Type | Class and Description |
---|---|
static class |
Structure.Builder<T extends Structure.Builder<T>>
A builder of Structures.
|
defaultCoordsSizeToCache, defaultSizeToCache, permitCaching
Modifier and Type | Method and Description |
---|---|
static Structure.Builder<?> |
builder()
Get Builder for this class that allows subclassing.
|
Variable |
findVariable(java.lang.String shortName)
Find the Variable member with the specified (short) name.
|
int |
getElementSize()
Get the size of one element of the Structure.
|
java.lang.String |
getNameAndAttributes()
Get String with name and attributes.
|
int |
getNumberOfMemberVariables()
Get the number of variables contained directly in this Structure.
|
StructureDataIterator |
getStructureIterator()
Iterator over all the data in a Structure.
|
StructureDataIterator |
getStructureIterator(int bufferSize)
Get an efficient iterator over all the data in the Structure.
|
com.google.common.collect.ImmutableList<java.lang.String> |
getVariableNames()
Get the (short) names of the variables contained directly in this Structure.
|
com.google.common.collect.ImmutableList<Variable> |
getVariables()
Get the variables contained directly in this Structure.
|
boolean |
isCaching()
Caching is not allowed
|
boolean |
isSubset()
Find if this was created from a subset() method.
|
StructureMembers |
makeStructureMembers()
Create a StructureMembers object that describes this Structure.
|
StructureData |
readStructure(int index)
Use this when this is a one dimensional array of Structures, or you are doing the index calculation yourself for
a multidimension array.
|
ArrayStructure |
readStructure(int start,
int count)
For rank 1 array of Structures, read count Structures and return the data as an ArrayStructure.
|
Structure |
select(java.util.List<java.lang.String> memberNames)
Create a subset of the Structure consisting only of the given member variables
|
Structure |
select(java.lang.String varName)
Create a subset of the Structure consisting only of the one member variable
|
void |
setCaching(boolean caching)
Caching is not allowed
|
Structure.Builder<?> |
toBuilder()
Turn into a mutable Builder.
|
attributes, compareTo, createNewCache, equals, findAttribute, findAttributeString, findDimensionIndex, getDatasetLocation, getDataType, getDescription, getDimension, getDimensions, getDimensionsString, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNetcdfFile, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShape, getShapeAsSection, getSize, getSizeToCache, getSPobject, getUnitsString, hasCachedData, hashCode, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isVariableLength, lookupEnumString, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, readToStream, reallyRead, reallyRead, reduce, section, section, slice, toString, toStringDebug
getShortName
filter, findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, getName, hasAttribute, hasAttributeIgnoreCase, isEmpty, iterator
public static Structure.Builder<?> builder()
public Variable findVariable(java.lang.String shortName)
shortName
- name of the member variable.public int getElementSize()
getElementSize
in class Variable
public java.lang.String getNameAndAttributes()
public int getNumberOfMemberVariables()
public StructureDataIterator getStructureIterator() throws java.io.IOException
StructureDataIterator ii = structVariable.getStructureIterator(); while (ii.hasNext()) { StructureData sdata = ii.next(); }
java.io.IOException
- on read errorgetStructureIterator(int bufferSize)
public StructureDataIterator getStructureIterator(int bufferSize) throws java.io.IOException
Example: StructureDataIterator ii = structVariable.getStructureIterator(100 * 1000); while (ii.hasNext()) { StructureData sdata = ii.next(); }
bufferSize
- size in bytes to buffer, set < 0 to use default sizejava.io.IOException
- on read errorpublic com.google.common.collect.ImmutableList<java.lang.String> getVariableNames()
public com.google.common.collect.ImmutableList<Variable> getVariables()
public boolean isCaching()
public boolean isSubset()
public StructureMembers makeStructureMembers()
public StructureData readStructure(int index) throws java.io.IOException, InvalidRangeException
index
- index into 1D arrayjava.io.IOException
- on read errorInvalidRangeException
- if index out of rangepublic ArrayStructure readStructure(int start, int count) throws java.io.IOException, InvalidRangeException
start
- start at this indexcount
- return this many StructureDatajava.io.IOException
- on read errorInvalidRangeException
- if start, count out of rangepublic Structure select(java.util.List<java.lang.String> memberNames)
memberNames
- list of Variable names, already a memberpublic Structure select(java.lang.String varName)
varName
- name of member Variablepublic void setCaching(boolean caching)
setCaching
in class Variable
caching
- set if caching.public Structure.Builder<?> toBuilder()