ucar.nc2.dataset
Class SequenceDS

java.lang.Object
  extended by ucar.nc2.Variable
      extended by ucar.nc2.Structure
          extended by ucar.nc2.dataset.StructureDS
              extended by ucar.nc2.dataset.SequenceDS
All Implemented Interfaces:
Comparable<VariableSimpleIF>, Enhancements, VariableEnhanced, ProxyReader, VariableIF, VariableSimpleIF

public class SequenceDS
extends StructureDS

Enhance sequence

Since:
Nov 10, 2009
Author:
caron

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.nc2.Variable
Variable.Cache
 
Field Summary
 
Fields inherited from class ucar.nc2.dataset.StructureDS
orgVar
 
Fields inherited from class ucar.nc2.Structure
defaultBufferSize, isSubset, memberHash, members
 
Fields inherited from class ucar.nc2.Variable
attributes, cache, dataType, debugCaching, defaultCoordsSizeToCache, defaultSizeToCache, dimensions, elementSize, group, hashCode, isMetadata, isVariableLength, ncfile, parent, proxyReader, shape, shapeAsSection, shortName, sizeToCache, spiObject
 
Constructor Summary
SequenceDS(Group g, Sequence orgSeq)
           
 
Method Summary
 StructureDataIterator getStructureIterator(int bufferSize)
          Get an efficient iterator over all the data in the Structure.
 Array read()
          Read all the data for this Variable and return a memory resident Array.
 Array read(Section section)
          Read a section of the data for this Variable from the netcdf file and return a memory resident Array.
 
Methods inherited from class ucar.nc2.dataset.StructureDS
addCoordinateSystem, clearCoordinateSystems, convert, convert, copy, enhance, getCoordinateSystems, getDescription, getOriginalDataType, getOriginalName, getOriginalVariable, getUnitsString, reallyRead, reallyRead, removeCoordinateSystem, select, setName, setOriginalVariable, setUnitsString
 
Methods inherited from class ucar.nc2.Structure
addMemberVariable, calcElementSize, calcStructureSize, findVariable, getElementSize, getNameAndAttributes, getNumberOfMemberVariables, getStructureIterator, getVariableNames, getVariables, isCaching, isSubset, makeStructureMembers, readStructure, readStructure, readStructure, removeMemberVariable, replaceMemberVariable, select, setCaching, setImmutable, setMemberVariables, setParentGroup, writeCDL
 
Methods inherited from class ucar.nc2.Variable
_read, _read, addAttribute, clone, compareTo, createNewCache, equals, extraInfo, findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getEnumTypedef, getFullName, getFullNameEscaped, getName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentStructure, getProxyReader, getRanges, getRank, getScalarData, getShape, getShape, getShapeAll, getShapeAsSection, getShortName, getSize, getSizeToCache, getSPobject, hasCachedData, hashCode, invalidateCache, isCoordinateVariable, isImmutable, isMemberOfStructure, isMetadata, isScalar, isUnknownLength, isUnlimited, isUnsigned, isVariableLength, lookupEnumString, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, readToByteChannel, remove, removeAttribute, removeAttributeIgnoreCase, resetDimensions, resetShape, section, section, setCachedData, setCachedData, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setEnumTypedef, setIsScalar, setParentStructure, setProxyReader, setSizeToCache, setSPobject, setValues, setValues, slice, toString, toStringDebug, writeCDL
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ucar.nc2.VariableIF
findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getDataType, getDimension, getDimensions, getDimensionsAll, getElementSize, getFullName, getFullNameEscaped, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShapeAsSection, getShortName, getSize, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isUnsigned, isVariableLength, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, section, toStringDebug
 
Methods inherited from interface ucar.nc2.VariableSimpleIF
getName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

SequenceDS

public SequenceDS(Group g,
                  Sequence orgSeq)
Method Detail

getStructureIterator

public StructureDataIterator getStructureIterator(int bufferSize)
                                           throws IOException
Description copied from class: Structure
Get an efficient iterator over all the data in the Structure. This is the efficient way to get all the data, it can be much faster than reading one record at a time, and is optimized for large datasets. This is accomplished by buffering bufferSize amount of data at once.
Example:

  StructureDataIterator ii = structVariable.getStructureIterator(100 * 1000);
  while (ii.hasNext()) {
    StructureData sdata = ii.next();
  }
 

Overrides:
getStructureIterator in class Structure
Parameters:
bufferSize - size in bytes to buffer, set < 0 to use default size
Returns:
StructureDataIterator over type StructureData
Throws:
IOException - on read error

read

public Array read(Section section)
           throws IOException,
                  InvalidRangeException
Description copied from class: Variable
Read a section of the data for this Variable from the netcdf file and return a memory resident Array. The Array has the same element type as the Variable, and the requested shape. Note that this does not do rank reduction, so the returned Array has the same rank as the Variable. Use Array.reduce() for rank reduction.

If the Variable is a member of an array of Structures, this returns only the variable's data in the first Structure, so that the Array shape is the same as the Variable. To read the data in all structures, use readAllStructures().

Note this only allows you to specify a subset of this variable. If the variable is nested in a array of structures and you want to subset that, use NetcdfFile.read(String sectionSpec, boolean flatten);

Specified by:
read in interface VariableIF
Overrides:
read in class Variable
Parameters:
section - list of Range specifying the section of data to read. Must be null or same rank as variable. If list is null, assume all data. Each Range corresponds to a Dimension. If the Range object is null, it means use the entire dimension.
Returns:
the requested data in a memory-resident Array
Throws:
IOException - if error
InvalidRangeException - if section is invalid

read

public Array read()
           throws IOException
Description copied from class: Variable
Read all the data for this Variable and return a memory resident Array. The Array has the same element type and shape as the Variable.

If the Variable is a member of an array of Structures, this returns only the variable's data in the first Structure, so that the Array shape is the same as the Variable. To read the data in all structures, use readAllStructures().

Specified by:
read in interface VariableIF
Overrides:
read in class Variable
Returns:
the requested data in a memory-resident Array.
Throws:
IOException


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.