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
Constructor and Description |
---|
Structure(NetcdfFile ncfile,
Group group,
Structure parent,
String shortName)
Deprecated.
Use Structure.builder()
|
Structure(NetcdfFile ncfile,
Group group,
Structure parent,
String shortName,
List<Dimension> dimList)
Deprecated.
Use Structure.builder()
|
Modifier and Type | Method and Description |
---|---|
Variable |
addMemberVariable(Variable v)
Deprecated.
Use Structure.builder()
|
static Structure.Builder<?> |
builder()
Get Builder for this class that allows subclassing.
|
void |
calcElementSize()
Force recalculation of size of one element of this structure - equals the sum of sizes of its members.
|
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.
|
List<String> |
getVariableNames()
Get the (short) names of the variables contained directly in this Structure.
|
List<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()
Use this when this is a scalar 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.
|
boolean |
removeMemberVariable(Variable v)
Deprecated.
Use Structure.builder()
|
boolean |
replaceMemberVariable(Variable newVar)
Deprecated.
Use Structure.builder()
|
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
|
Variable |
setImmutable()
Deprecated.
Use Structure.builder()
|
void |
setMemberVariables(List<Variable> vars)
Deprecated.
Use Structure.builder()
|
void |
setParentGroup(Group group)
Deprecated.
Use Structure.builder()
|
Structure.Builder<?> |
toBuilder()
Turn into a mutable Builder.
|
addAll, addAttribute, attributes, compareTo, createNewCache, equals, findAttribute, findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, findAttValueIgnoreCase, findDimensionIndex, getAttributes, getDAPName, getDAPName, getDatasetLocation, getDataType, getDescription, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getEnumTypedef, getFileTypeId, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNetcdfFile, getParentGroup, getProxyReader, getRanges, getRank, getShape, getShape, getShapeAll, getShapeAsSection, getSize, getSizeToCache, getSPobject, getUnitsString, hasCachedData, hashCode, invalidateCache, isCoordinateVariable, isImmutable, isMetadata, isScalar, isUnknownLength, isUnlimited, isVariableLength, lookupEnumString, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, readToByteChannel, readToStream, reallyRead, reallyRead, reduce, remove, removeAttribute, removeAttributeIgnoreCase, resetDimensions, resetShape, section, section, setCachedData, setCachedData, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setEnumTypedef, setIsScalar, setName, setProxyReader, setSizeToCache, setSPobject, setValues, setValues, slice, toString, toStringDebug, writeCDL
annotate, annotation, getDODSName, getFullName, getFullNameEscaped, getGroup, getImmutable, getName, getParentStructure, getShortName, getSort, isMemberOfStructure, localhash, setDODSName, setParentStructure, setShortName, setSort, unwrap
getFullName, getName, getShortName
getName, hasAttribute, iterator
forEach, spliterator
@Deprecated public Structure(NetcdfFile ncfile, Group group, Structure parent, String shortName)
ncfile
- the containing NetcdfFile.group
- the containing group; if null, use rootGroupparent
- parent Structure, may be nullshortName
- variable shortName, must be unique within the Group@Deprecated public Structure(NetcdfFile ncfile, Group group, Structure parent, String shortName, List<Dimension> dimList)
ncfile
- the containing NetcdfFile.group
- the containing group; if null, use rootGroupparent
- parent Structure, may be nullshortName
- variable shortName, must be unique within the GroupdimList
- list of Dimensionspublic Structure select(List<String> memberNames)
memberNames
- list of Variable names, already a memberpublic Structure select(String varName)
varName
- name of member Variablepublic boolean isSubset()
public boolean isCaching()
public void setCaching(boolean caching)
setCaching
in class Variable
caching
- set if caching.@Deprecated public Variable addMemberVariable(Variable v)
v
- add this variable as a member of this structure@Deprecated public void setMemberVariables(List<Variable> vars)
vars
- this is the list of member variables@Deprecated public boolean removeMemberVariable(Variable v)
v
- remove this variable as a member of this structure@Deprecated public boolean replaceMemberVariable(Variable newVar)
newVar
- add this variable as a member of this structure@Deprecated public void setParentGroup(Group group)
setParentGroup
in class Variable
group
- set to this value@Deprecated public Variable setImmutable()
Variable
setImmutable
in class Variable
public List<Variable> getVariables()
public int getNumberOfMemberVariables()
public List<String> getVariableNames()
public Variable findVariable(String shortName)
shortName
- name of the member variable.public StructureMembers makeStructureMembers()
public int getElementSize()
getElementSize
in class Variable
public void calcElementSize()
public StructureData readStructure() throws IOException
IOException
- on read errorpublic 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 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 String getNameAndAttributes()
public Structure.Builder<?> toBuilder()
public static Structure.Builder<?> builder()