@Immutable 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>> |
Variable.Cache| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isSubset |
protected com.google.common.collect.ImmutableList<Variable> |
members |
attributes, cache, dataType, dimensions, elementSize, hashCode, isVariableLength, ncfile, permitCaching, proxyReader, shape, spiObject| Modifier | Constructor and Description |
|---|---|
protected |
Structure(Structure.Builder<?> builder,
Group parentGroup) |
| Modifier and Type | Method and Description |
|---|---|
protected Structure.Builder<?> |
addLocalFieldsToBuilder(Structure.Builder<? extends Structure.Builder<?>> b) |
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, or null if not found.
|
int |
getElementSize()
Get the size in bytes of one Structure.
|
String |
getNameAndAttributes()
Get String with name and attributes.
|
int |
getNumberOfMemberVariables()
Get the number of variables contained directly in this Structure.
|
StructureDataIterator |
getStructureIterator()
Deprecated.
use readArray().iterator()
|
StructureDataIterator |
getStructureIterator(int bufferSize)
Deprecated.
use readArray().iterator()
|
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 |
isSubset()
Find if this was created from a subset() method.
|
StructureMembers |
makeStructureMembers()
Deprecated.
use makeStructureMembersBuilder()
|
StructureMembers.Builder |
makeStructureMembersBuilder() |
StructureData |
readStructure(int index)
Deprecated.
use readArray(Section)
|
ArrayStructure |
readStructure(int start,
int count)
Deprecated.
use readArray(Section)
|
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
|
Structure.Builder<?> |
toBuilder()
Turn into a mutable Builder.
|
protected void |
writeCDL(Formatter buf,
Indent indent,
boolean useFullName,
boolean strict) |
_read, _read, _readScalarData, addLocalFieldsToBuilder, attributes, compareTo, equals, extraInfo, findAttribute, findAttributeString, findDimensionIndex, getArrayType, getDatasetLocation, getDataType, getDescription, getDimension, getDimensions, getDimensionSet, getDimensionsString, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNetcdfFile, getParentGroup, getParentStructure, getRanges, getRank, getSection, getShape, getShape, getShapeAsSection, getShortName, getSize, getSizeToCache, getSPobject, getUnitsString, hasCachedData, hashCode, invalidateCache, isCaching, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isVariableLength, lookupEnumString, proxyReadArray, proxyReadArray, read, read, read, read, read, readArray, readArray, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, readToStream, reallyRead, reallyRead, reduce, resetShape, section, section, setCachedData, setCaching, slice, toString, toStringDebugprotected final com.google.common.collect.ImmutableList<Variable> members
protected final boolean isSubset
protected Structure(Structure.Builder<?> builder, Group parentGroup)
@Nullable public Variable findVariable(String shortName)
public int getNumberOfMemberVariables()
public int getElementSize()
getElementSize in class Variablepublic com.google.common.collect.ImmutableList<Variable> getVariables()
public com.google.common.collect.ImmutableList<String> getVariableNames()
public boolean isSubset()
@Deprecated public StructureMembers makeStructureMembers()
public StructureMembers.Builder makeStructureMembersBuilder()
public Structure select(List<String> memberNames)
memberNames - list of Variable names, already a memberpublic Structure select(String varName)
varName - name of member Variable@Deprecated public StructureData readStructure(int index) throws IOException, InvalidRangeException
index - linear index into the arrayIOException - on read errorInvalidRangeException - if index out of range@Deprecated public 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 range@Deprecated public StructureDataIterator getStructureIterator() throws IOException
StructureDataIterator ii = structVariable.getStructureIterator();
while (ii.hasNext()) {
StructureData sdata = ii.next();
}
IOException - on read errorgetStructureIterator(int bufferSize)@Deprecated 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 String getNameAndAttributes()
public Structure.Builder<?> toBuilder()
protected Structure.Builder<?> addLocalFieldsToBuilder(Structure.Builder<? extends Structure.Builder<?>> b)
public static Structure.Builder<?> builder()