ucar.nc2.dataset
Class StructureDS

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

public class StructureDS
extends Structure
implements VariableEnhanced

An "enhanced" Structure.

Author:
john caron
See Also:
NetcdfDataset

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.nc2.Variable
Variable.Cache
 
Field Summary
protected  Structure 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
  StructureDS(Group g, Structure orgVar)
          Create a StructureDS thats wraps a Structure
  StructureDS(NetcdfDataset ds, Group group, Structure parentStructure, String shortName, String dims, String units, String desc)
          Constructor when theres no underlying variable.
  StructureDS(NetcdfDataset ds, Group group, Structure parent, String shortName, Structure orgVar)
          Wrap the given Structure, making it into a StructureDS.
protected StructureDS(NetcdfFile ncfile, Group group, String shortName)
           
 
Method Summary
 void addCoordinateSystem(CoordinateSystem p0)
          Add a CoordinateSystem to the dataset.
 void clearCoordinateSystems()
          clear previous coordinate systems.
protected  ArrayStructure convert(Array data, Section section)
           
protected  StructureData convert(StructureData sdata, int recno)
           
protected  Variable copy()
           
 void enhance(Set<NetcdfDataset.Enhance> mode)
          DO NOT USE DIRECTLY.
 List<CoordinateSystem> getCoordinateSystems()
          Get the list of Coordinate Systems for this Variable.
 String getDescription()
          Get the description of the Variable.
 DataType getOriginalDataType()
          When this wraps another Variable, get the original Variable's DataType.
 String getOriginalName()
          When this wraps another Variable, get the original Variable's DataType.
 Variable getOriginalVariable()
          A StructureDS may wrap another Structure.
 String getUnitsString()
          Get the Unit String for the Variable.
 Array reallyRead(Variable client, CancelTask cancelTask)
          public by accident, do not call directly.
 Array reallyRead(Variable client, Section section, CancelTask cancelTask)
          public by accident, do not call directly.
 void removeCoordinateSystem(CoordinateSystem p0)
          Remove a CoordinateSystem from the dataset.
 Structure select(List<String> memberNames)
          Create a subset of the Structure consisting only of the given member variables
 String setName(String newName)
          Set the short name, converting to valid CDM object name if needed.
 void setOriginalVariable(Variable orgVar)
          Set the Structure to wrap.
 void setUnitsString(String units)
          Set the Unit String for this Variable.
 
Methods inherited from class ucar.nc2.Structure
addMemberVariable, calcElementSize, calcStructureSize, findVariable, getElementSize, getNameAndAttributes, getNumberOfMemberVariables, getStructureIterator, 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, 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, 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
 

Field Detail

orgVar

protected Structure orgVar
Constructor Detail

StructureDS

protected StructureDS(NetcdfFile ncfile,
                      Group group,
                      String shortName)

StructureDS

public StructureDS(NetcdfDataset ds,
                   Group group,
                   Structure parentStructure,
                   String shortName,
                   String dims,
                   String units,
                   String desc)
Constructor when theres no underlying variable. You better set the values too!

Parameters:
ds - the containing NetcdfDataset.
group - the containing group; if null, use rootGroup
parentStructure - parent Structure, may be null
shortName - variable shortName, must be unique within the Group
dims - list of dimension names, space delimited
units - unit string (may be null)
desc - description (may be null)

StructureDS

public StructureDS(Group g,
                   Structure orgVar)
Create a StructureDS thats wraps a Structure

Parameters:
g - parent group
orgVar - original Structure

StructureDS

public StructureDS(NetcdfDataset ds,
                   Group group,
                   Structure parent,
                   String shortName,
                   Structure orgVar)
Wrap the given Structure, making it into a StructureDS. Delegate data reading to the original variable. Does not share cache, iosp. This is for NcML explicit mode

Parameters:
ds - the containing NetcdfDataset.
group - the containing group; may not be null
parent - parent Structure, may be null
shortName - variable shortName, must be unique within the Group
orgVar - the original Structure to wrap.
Method Detail

copy

protected Variable copy()
Overrides:
copy in class Structure

select

public Structure select(List<String> memberNames)
Description copied from class: Structure
Create a subset of the Structure consisting only of the given member variables

Overrides:
select in class Structure
Parameters:
memberNames - list of Variable names, already a member
Returns:
Structure containing just those members

getOriginalVariable

public Variable getOriginalVariable()
A StructureDS may wrap another Structure.

Specified by:
getOriginalVariable in interface VariableEnhanced
Returns:
original Structure or null

setOriginalVariable

public void setOriginalVariable(Variable orgVar)
Set the Structure to wrap.

Specified by:
setOriginalVariable in interface VariableEnhanced
Parameters:
orgVar - original Variable, must be a Structure

getOriginalDataType

public DataType getOriginalDataType()
When this wraps another Variable, get the original Variable's DataType.

Returns:
original Variable's DataType

getOriginalName

public String getOriginalName()
When this wraps another Variable, get the original Variable's DataType.

Specified by:
getOriginalName in interface VariableEnhanced
Returns:
original Variable's DataType

setName

public String setName(String newName)
Description copied from class: Variable
Set the short name, converting to valid CDM object name if needed.

Overrides:
setName in class Variable
Parameters:
newName - set to this value
Returns:
valid CDM object name

reallyRead

public Array reallyRead(Variable client,
                        CancelTask cancelTask)
                 throws IOException
Description copied from class: Variable
public by accident, do not call directly.

Specified by:
reallyRead in interface ProxyReader
Overrides:
reallyRead in class Variable
Parameters:
client - the client Variable
cancelTask - user may cancel
Returns:
Array
Throws:
IOException - on error

reallyRead

public Array reallyRead(Variable client,
                        Section section,
                        CancelTask cancelTask)
                 throws IOException,
                        InvalidRangeException
Description copied from class: Variable
public by accident, do not call directly.

Specified by:
reallyRead in interface ProxyReader
Overrides:
reallyRead in class Variable
Parameters:
client - the client Variable
section - the section of data to read.
cancelTask - user may cancel
Returns:
Array
Throws:
IOException - on error
InvalidRangeException - if section has incorrect rank or illegal shape.

convert

protected ArrayStructure convert(Array data,
                                 Section section)
                          throws IOException
Throws:
IOException

convert

protected StructureData convert(StructureData sdata,
                                int recno)
                         throws IOException
Throws:
IOException

enhance

public void enhance(Set<NetcdfDataset.Enhance> mode)
DO NOT USE DIRECTLY. public by accident. recalc any enhancement info

Specified by:
enhance in interface VariableEnhanced

clearCoordinateSystems

public void clearCoordinateSystems()
Description copied from interface: VariableEnhanced
clear previous coordinate systems. if any

Specified by:
clearCoordinateSystems in interface VariableEnhanced

addCoordinateSystem

public void addCoordinateSystem(CoordinateSystem p0)
Description copied from interface: Enhancements
Add a CoordinateSystem to the dataset.

Specified by:
addCoordinateSystem in interface Enhancements
Parameters:
p0 - add this Coordinate System

removeCoordinateSystem

public void removeCoordinateSystem(CoordinateSystem p0)
Description copied from interface: Enhancements
Remove a CoordinateSystem from the dataset.

Specified by:
removeCoordinateSystem in interface Enhancements
Parameters:
p0 - remove this coordinate system

getCoordinateSystems

public List<CoordinateSystem> getCoordinateSystems()
Description copied from interface: Enhancements
Get the list of Coordinate Systems for this Variable.

Specified by:
getCoordinateSystems in interface Enhancements
Returns:
list of type CoordinateSystem; may be empty but not null.

getDescription

public String getDescription()
Description copied from class: Variable
Get the description of the Variable. Default is to use "long_name" attribute value. If not exist, look for "description", "title", or "standard_name" attribute value (in that order).

Specified by:
getDescription in interface Enhancements
Specified by:
getDescription in interface VariableIF
Specified by:
getDescription in interface VariableSimpleIF
Overrides:
getDescription in class Variable
Returns:
description, or null if not found.

getUnitsString

public String getUnitsString()
Description copied from class: Variable
Get the Unit String for the Variable. Looks for the "units" attribute value

Specified by:
getUnitsString in interface Enhancements
Specified by:
getUnitsString in interface VariableIF
Specified by:
getUnitsString in interface VariableSimpleIF
Overrides:
getUnitsString in class Variable
Returns:
unit string, or null if not found.

setUnitsString

public void setUnitsString(String units)
Description copied from interface: VariableEnhanced
Set the Unit String for this Variable. Default is to use the "units" attribute.

Specified by:
setUnitsString in interface VariableEnhanced
Parameters:
units - unit string


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