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(String shortName)
Find the Variable member with the specified (short) name.
|
int |
getElementSize()
Get the size of one element of the Structure.
|
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<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(List<String> memberNames)
Create a subset of the Structure consisting only of the given member variables
|
Structure |
select(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
forEach, spliterator
public static Structure.Builder<?> builder()
public Variable findVariable(String shortName)
shortName
- name of the member variable.public int getElementSize()
getElementSize
in class Variable
public String getNameAndAttributes()
public int getNumberOfMemberVariables()
public StructureDataIterator getStructureIterator() throws IOException
StructureDataIterator ii = structVariable.getStructureIterator(); while (ii.hasNext()) { StructureData sdata = ii.next(); }
IOException
- on read errorgetStructureIterator(int bufferSize)
public StructureDataIterator getStructureIterator(int bufferSize) throws 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 sizeIOException
- on read errorpublic com.google.common.collect.ImmutableList<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 IOException, InvalidRangeException
index
- index into 1D arrayIOException
- on read errorInvalidRangeException
- if index out of rangepublic ArrayStructure readStructure(int start, int count) throws IOException, InvalidRangeException
start
- start at this indexcount
- return this many StructureDataIOException
- on read errorInvalidRangeException
- if start, count out of rangepublic Structure select(List<String> memberNames)
memberNames
- list of Variable names, already a memberpublic Structure select(String varName)
varName
- name of member Variablepublic void setCaching(boolean caching)
setCaching
in class Variable
caching
- set if caching.public Structure.Builder<?> toBuilder()