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.
|
Variable.Cache
Modifier and Type | Field and Description |
---|---|
protected boolean |
isSubset |
protected java.util.List<Variable> |
members |
attributes, cache, dataType, debugCaching, defaultCoordsSizeToCache, defaultSizeToCache, dimensions, elementSize, hashCode, isVariableLength, ncfile, permitCaching, proxyReader, shape, sizeToCache, spiObject
annotations, dodsname, group, immutable, parentstruct, shortName, sort
Modifier | Constructor and Description |
---|---|
|
Structure(NetcdfFile ncfile,
Group group,
Structure parent,
java.lang.String shortName)
Deprecated.
Use Structure.builder()
|
|
Structure(NetcdfFile ncfile,
Group group,
Structure parent,
java.lang.String shortName,
java.util.List<Dimension> dimList)
Deprecated.
Use Structure.builder()
|
protected |
Structure(Structure.Builder<?> builder,
Group parentGroup) |
protected |
Structure(Structure from)
Deprecated.
Use Structure.builder()
|
Modifier and Type | Method and Description |
---|---|
protected Structure.Builder<?> |
addLocalFieldsToBuilder(Structure.Builder<? extends Structure.Builder<?>> b) |
Variable |
addMemberVariable(Variable v)
Deprecated.
Use Structure.builder()
|
static Structure.Builder<?> |
builder()
Get Builder for this class that allows subclassing.
|
void |
calcElementSize()
Deprecated.
will be private in ver6, where Structure will be immutable.
|
protected int |
calcStructureSize() |
protected Structure |
copy()
Deprecated.
Use
toBuilder() |
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()
Deprecated.
use readStructure(0)
|
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(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
|
Variable |
setImmutable()
Deprecated.
Use Structure.builder()
|
void |
setMemberVariables(java.util.List<Variable> vars)
Deprecated.
Use Structure.builder()
|
void |
setParentGroup(Group group)
Deprecated.
Use Structure.builder()
|
Structure.Builder<?> |
toBuilder()
Turn into a mutable Builder.
|
protected void |
writeCDL(java.util.Formatter buf,
Indent indent,
boolean useFullName,
boolean strict) |
_read, _read, _readScalarData, addAll, addAttribute, addLocalFieldsToBuilder, attributes, compareTo, createNewCache, equals, extraInfo, findAttribute, findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, findAttributeString, findDimensionIndex, getAttributes, getDAPName, getDAPName, getDatasetLocation, getDataType, getDescription, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNetcdfFile, getParentGroup, getParentGroupOrRoot, getParentStructure, getProxyReader, getRanges, getRank, getScalarData, getShape, getShape, getShapeAll, getShapeAsSection, getSize, getSizeToCache, getSPobject, getUnitsString, hasCachedData, hashCode, invalidateCache, isCoordinateVariable, isEmpty, isImmutable, isMemberOfStructure, 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, getFullNameEscaped, getGroup, getImmutable, getName, getShortName, getSort, localhash, setDODSName, setParentStructure, setShortName, setSort, unwrap
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getName, getShortName
filter, findAttValueIgnoreCase, getName, hasAttribute, hasAttributeIgnoreCase, iterator
protected java.util.List<Variable> members
protected boolean isSubset
@Deprecated public Structure(NetcdfFile ncfile, Group group, Structure parent, java.lang.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, java.lang.String shortName, java.util.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 Dimensions@Deprecated protected Structure(Structure from)
from
- copy from thisprotected Structure(Structure.Builder<?> builder, Group parentGroup)
public 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 boolean isSubset()
@Deprecated protected Structure copy()
toBuilder()
protected int calcStructureSize()
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(java.util.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 com.google.common.collect.ImmutableList<Variable> getVariables()
public int getNumberOfMemberVariables()
public com.google.common.collect.ImmutableList<java.lang.String> getVariableNames()
public Variable findVariable(java.lang.String shortName)
shortName
- name of the member variable.public StructureMembers makeStructureMembers()
public int getElementSize()
getElementSize
in class Variable
@Deprecated public void calcElementSize()
@Deprecated public StructureData readStructure() throws java.io.IOException
java.io.IOException
- on read errorpublic 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 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 java.lang.String getNameAndAttributes()
protected void writeCDL(java.util.Formatter buf, Indent indent, boolean useFullName, boolean strict)
public Structure.Builder<?> toBuilder()
protected Structure.Builder<?> addLocalFieldsToBuilder(Structure.Builder<? extends Structure.Builder<?>> b)
public static Structure.Builder<?> builder()