Package ucar.nc2
Class Sequence
- java.lang.Object
-
- ucar.nc2.Variable
-
- ucar.nc2.Structure
-
- ucar.nc2.Sequence
-
- All Implemented Interfaces:
Comparable<Variable>
,Iterable<StructureData>
,ProxyReader
- Direct Known Subclasses:
SequenceDS
@Immutable public class Sequence extends Structure implements Iterable<StructureData>
A one-dimensional Structure with indeterminate length, possibly 0. The only data access is through getStructureIterator().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Sequence.Builder<T extends Sequence.Builder<T>>
-
Field Summary
-
Fields inherited from class ucar.nc2.Variable
permitCaching
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Sequence.Builder<?>
builder()
Get Builder for this class that allows subclassing.Iterator<StructureData>
iterator()
An iterator over all the data in the sequence.StructureDataArray
readArray()
Read all data into memory.StructureData
readRecord(int recno)
Read one StructureData at index recno.Variable
section(Section subsection)
Create a new Variable that is a logical subsection of this Variable.Variable
slice(int dim, int value)
Create a new Variable that is a logical slice of this Variable, by fixing the specified dimension at the specified index value.Sequence.Builder<?>
toBuilder()
Turn into a mutable Builder.-
Methods inherited from class ucar.nc2.Structure
findVariable, getElementSize, getNameAndAttributes, getNumberOfMemberVariables, getVariableNames, getVariables, isSubset, makeStructureMembersBuilder, select, select
-
Methods inherited from class ucar.nc2.Variable
attributes, compareTo, equals, findAttribute, findAttributeString, findDimensionIndex, getArrayType, getDatasetLocation, getDescription, getDimension, getDimensions, getDimensionSet, getDimensionsString, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNetcdfFile, getParentGroup, getParentStructure, getRank, getSection, getShape, getShape, getShortName, getSize, getSizeToCache, getSPobject, getUnitsString, hasCachedData, hashCode, isCaching, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isVariableLength, lookupEnumString, proxyReadArray, proxyReadArray, readArray, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, reduce, setCaching, toString
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
iterator
public Iterator<StructureData> iterator()
An iterator over all the data in the sequence.- Specified by:
iterator
in interfaceIterable<StructureData>
-
readArray
public StructureDataArray readArray()
Read all data into memory.
-
section
public Variable section(Section subsection)
Description copied from class:Variable
Create a new Variable that is a logical subsection of this Variable. No data is read until a read method is called on it.- Overrides:
section
in classVariable
- Parameters:
subsection
- Section of this variable. Each Range in the section corresponds to a Dimension, and specifies the section of data to read in that Dimension. A Range object may be null, which means use the entire dimension.- Returns:
- a new Variable which is a logical section of this Variable.
- Throws:
UnsupportedOperationException
- always
-
slice
public Variable slice(int dim, int value)
Description copied from class:Variable
Create a new Variable that is a logical slice of this Variable, by fixing the specified dimension at the specified index value. This reduces rank by 1. No data is read until a read method is called on it.- Overrides:
slice
in classVariable
- Parameters:
dim
- which dimension to fixvalue
- at what index value- Returns:
- a new Variable which is a logical slice of this Variable.
- Throws:
UnsupportedOperationException
- always
-
readRecord
public StructureData readRecord(int recno)
Description copied from class:Structure
Read one StructureData at index recno. For rank 0 or 1 Structure, eg netcdf3 record variables.- Overrides:
readRecord
in classStructure
- Parameters:
recno
- start at this index- Throws:
UnsupportedOperationException
- always
-
toBuilder
public Sequence.Builder<?> toBuilder()
Turn into a mutable Builder. Can use toBuilder().build() to copy.
-
builder
public static Sequence.Builder<?> builder()
Get Builder for this class that allows subclassing.- See Also:
- "https://community.oracle.com/blogs/emcmanus/2010/10/24/using-builder-pattern-subclasses"
-
-