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:
java.lang.Comparable, Enhancements, EnhanceScaleMissing, VariableEnhanced, VariableIF, VariableSimpleIF

public class StructureDS
extends Structure
implements VariableEnhanced

An "enhanced" Structure.

Version:
$Revision:51 $ $Date:2006-07-12 17:13:13Z $
Author:
john caron

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.nc2.Structure
Structure.Iterator
 
Nested classes/interfaces inherited from class ucar.nc2.Variable
Variable.Cache
 
Field Summary
 
Fields inherited from class ucar.nc2.Structure
memberHash, memberNames, members
 
Fields inherited from class ucar.nc2.Variable
attributes, cache, dataType, debugCaching, defaultSizeToCache, dimensions, elementSize, group, isCoordinateAxis, isMetadata, isSection, isSlice, isVlen, ncfile, orgVar, parent, scalarIndex, sectionRanges, shape, shortName, sizeToCache, sliceDim, sliceRanges
 
Constructor Summary
StructureDS(Group g, Structure orgVar, boolean reparent)
           
StructureDS(NetcdfDataset ds, Group group, Structure parentStructure, java.lang.String shortName, java.lang.String dims, java.lang.String units, java.lang.String desc)
          Constructor when theres no underlying variable.
 
Method Summary
protected  Array _read()
           
protected  Array _read(java.util.List section)
           
 void addCoordinateSystem(CoordinateSystem p0)
          Add a CoordinateSystem to the dataset.
 int compareTo(java.lang.Object o)
          Implement Comparable
 double convertScaleOffsetMissing(byte value)
          Convert data if hasScaleOffset, using scale and offset.
 double convertScaleOffsetMissing(double value)
          Convert this double value using scale/offset/missing value if applicable
 double convertScaleOffsetMissing(int value)
          Convert this int value to a double, using scale/offset/missing value if applicable
 double convertScaleOffsetMissing(long value)
          Convert this long value to a double, using scale/offset/missing value if applicable
 double convertScaleOffsetMissing(short value)
          Convert this short value to a double, using scale/offset/missing value if applicable
 java.util.List getCoordinateSystems()
          Get the list of Coordinate Systems for this Variable.
 java.lang.String getDescription()
          Get the description of the Variable.
 java.lang.String getUnitsString()
          Get the Unit String for the Variable.
 double getValidMax()
          return the maximum value in the valid range
 double getValidMin()
          return the minimum value in the valid range
 boolean hasFillValue()
          true if Variable has _FillValue attribute
 boolean hasInvalidData()
          true if Variable has valid_range, valid_min or valid_max attributes
 boolean hasMissing()
          true if Variable has missing data values
 boolean hasMissingValue()
          true if Variable has missing_value attribute
 boolean hasScaleOffset()
          true if Variable data will be converted using scale and offet
 boolean isFillValue(double p0)
          return true if val equals the _FillValue
 boolean isInvalidData(double p0)
          return true if val is outside the valid range
 boolean isMissing(double p0)
          true if val is a missing data value
 boolean isMissingValue(double p0)
          return true if val equals a missing_value
 StructureMembers makeStructureMembers()
          Make the StructureMembers object corresponding to this Structure.
 void removeCoordinateSystem(CoordinateSystem p0)
          Remove a CoordinateSystem from the dataset.
 Variable section(java.util.List section)
          Override so it returns a Structure
 void setFillValueIsMissing(boolean p0)
          set if _FillValue is considered isMissing(); better set in constructor if possible
 void setInvalidDataIsMissing(boolean p0)
          set if valid_range is considered isMissing(); better set in constructor if possible
 void setMissingDataIsMissing(boolean p0)
          set if missing_data is considered isMissing(); better set in constructor if possible
 void setUseNaNs(boolean useNaNs)
          set whether to use NaNs for missing values, for efficiency
 
Methods inherited from class ucar.nc2.Structure
addMemberVariable, calcElementSize, calcStructureSize, findVariable, getElementSize, getNameAndAttributes, getStructureIterator, getStructureIterator, getVariableNames, getVariables, isCaching, readStructure, readStructure, readStructure, removeMemberVariable, replaceMemberVariable, setCaching, setMemberVariables, setParentGroup, toString, writeCDL
 
Methods inherited from class ucar.nc2.Variable
_readMemberData, addAttribute, attributes, calcIsCoordinateVariable, equals, extraInfo, findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getCoordinateDimension, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getIOVar, getName, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getSectionRanges, getShape, getShortName, getSize, getSizeToCache, getSPobject, hasCachedData, hashCode, invalidateCache, isMemberOfStructure, isMetadata, isScalar, isSection, isUnknownLength, isUnlimited, isUnsigned, isVariableLength, makeSection, makeSectionAddParents, makeSectionRanges, makeSectionWithParents, makeSlice, makeSliceRanges, read, read, read, read, readAllStructures, readAllStructuresSpec, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, remove, replaceDimension, setCachedData, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setIOVar, setIsCoordinateAxis, setName, setParentStructure, setSizeToCache, setSPobject, slice, toStringDebug
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ucar.nc2.VariableSimpleIF
findAttributeIgnoreCase, getAttributes, getDataType, getDimensions, getName, getRank, getShape, getShortName
 
Methods inherited from interface ucar.nc2.VariableIF
findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getCoordinateDimension, getDataType, getDimension, getDimensions, getDimensionsAll, getElementSize, getName, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShortName, getSize, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isUnsigned, isVariableLength, read, read, read, read, readAllStructures, readAllStructuresSpec, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, toStringDebug
 

Constructor Detail

StructureDS

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


StructureDS

public StructureDS(Group g,
                   Structure orgVar,
                   boolean reparent)
Method Detail

section

public Variable section(java.util.List section)
                 throws InvalidRangeException
Override so it returns a Structure

Specified by:
section in interface VariableIF
Overrides:
section in class Structure
Parameters:
section - List of type ucar.ma2.Range, with size equal to getRank(). Each Range 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:
InvalidRangeException

makeStructureMembers

public StructureMembers makeStructureMembers()
Description copied from class: Structure
Make the StructureMembers object corresponding to this Structure.

Overrides:
makeStructureMembers in class Structure

_read

protected Array _read()
               throws java.io.IOException
Overrides:
_read in class Variable
Throws:
java.io.IOException

_read

protected Array _read(java.util.List section)
               throws java.io.IOException,
                      InvalidRangeException
Overrides:
_read in class Variable
Throws:
java.io.IOException
InvalidRangeException

addCoordinateSystem

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

Specified by:
addCoordinateSystem in interface Enhancements

removeCoordinateSystem

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

Specified by:
removeCoordinateSystem in interface Enhancements

getCoordinateSystems

public java.util.List 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 java.lang.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 VariableSimpleIF
Overrides:
getDescription in class Variable
Returns:
description, or null if not found.

getUnitsString

public java.lang.String getUnitsString()
Description copied from class: Variable
Get the Unit String for the Variable. Default is to use "units" attribute value

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

getValidMax

public double getValidMax()
Description copied from interface: EnhanceScaleMissing
return the maximum value in the valid range

Specified by:
getValidMax in interface EnhanceScaleMissing

getValidMin

public double getValidMin()
Description copied from interface: EnhanceScaleMissing
return the minimum value in the valid range

Specified by:
getValidMin in interface EnhanceScaleMissing

hasFillValue

public boolean hasFillValue()
Description copied from interface: EnhanceScaleMissing
true if Variable has _FillValue attribute

Specified by:
hasFillValue in interface EnhanceScaleMissing

hasInvalidData

public boolean hasInvalidData()
Description copied from interface: EnhanceScaleMissing
true if Variable has valid_range, valid_min or valid_max attributes

Specified by:
hasInvalidData in interface EnhanceScaleMissing

hasMissing

public boolean hasMissing()
Description copied from interface: EnhanceScaleMissing
true if Variable has missing data values

Specified by:
hasMissing in interface EnhanceScaleMissing

hasMissingValue

public boolean hasMissingValue()
Description copied from interface: EnhanceScaleMissing
true if Variable has missing_value attribute

Specified by:
hasMissingValue in interface EnhanceScaleMissing

hasScaleOffset

public boolean hasScaleOffset()
Description copied from interface: EnhanceScaleMissing
true if Variable data will be converted using scale and offet

Specified by:
hasScaleOffset in interface EnhanceScaleMissing

isFillValue

public boolean isFillValue(double p0)
Description copied from interface: EnhanceScaleMissing
return true if val equals the _FillValue

Specified by:
isFillValue in interface EnhanceScaleMissing

isInvalidData

public boolean isInvalidData(double p0)
Description copied from interface: EnhanceScaleMissing
return true if val is outside the valid range

Specified by:
isInvalidData in interface EnhanceScaleMissing

isMissing

public boolean isMissing(double p0)
Description copied from interface: EnhanceScaleMissing
true if val is a missing data value

Specified by:
isMissing in interface EnhanceScaleMissing

isMissingValue

public boolean isMissingValue(double p0)
Description copied from interface: EnhanceScaleMissing
return true if val equals a missing_value

Specified by:
isMissingValue in interface EnhanceScaleMissing

setFillValueIsMissing

public void setFillValueIsMissing(boolean p0)
Description copied from interface: EnhanceScaleMissing
set if _FillValue is considered isMissing(); better set in constructor if possible

Specified by:
setFillValueIsMissing in interface EnhanceScaleMissing

setInvalidDataIsMissing

public void setInvalidDataIsMissing(boolean p0)
Description copied from interface: EnhanceScaleMissing
set if valid_range is considered isMissing(); better set in constructor if possible

Specified by:
setInvalidDataIsMissing in interface EnhanceScaleMissing

setMissingDataIsMissing

public void setMissingDataIsMissing(boolean p0)
Description copied from interface: EnhanceScaleMissing
set if missing_data is considered isMissing(); better set in constructor if possible

Specified by:
setMissingDataIsMissing in interface EnhanceScaleMissing

setUseNaNs

public void setUseNaNs(boolean useNaNs)
Description copied from interface: EnhanceScaleMissing
set whether to use NaNs for missing values, for efficiency

Specified by:
setUseNaNs in interface EnhanceScaleMissing

convertScaleOffsetMissing

public double convertScaleOffsetMissing(byte value)
Convert data if hasScaleOffset, using scale and offset. Also if useNaNs = true, return NaN if value is missing data.

Specified by:
convertScaleOffsetMissing in interface EnhanceScaleMissing
Specified by:
convertScaleOffsetMissing in interface VariableSimpleIF
Parameters:
value - data to convert
Returns:
converted data.

convertScaleOffsetMissing

public double convertScaleOffsetMissing(short value)
Description copied from interface: EnhanceScaleMissing
Convert this short value to a double, using scale/offset/missing value if applicable

Specified by:
convertScaleOffsetMissing in interface EnhanceScaleMissing
Specified by:
convertScaleOffsetMissing in interface VariableSimpleIF

convertScaleOffsetMissing

public double convertScaleOffsetMissing(int value)
Description copied from interface: EnhanceScaleMissing
Convert this int value to a double, using scale/offset/missing value if applicable

Specified by:
convertScaleOffsetMissing in interface EnhanceScaleMissing
Specified by:
convertScaleOffsetMissing in interface VariableSimpleIF

convertScaleOffsetMissing

public double convertScaleOffsetMissing(long value)
Description copied from interface: EnhanceScaleMissing
Convert this long value to a double, using scale/offset/missing value if applicable

Specified by:
convertScaleOffsetMissing in interface EnhanceScaleMissing
Specified by:
convertScaleOffsetMissing in interface VariableSimpleIF

convertScaleOffsetMissing

public double convertScaleOffsetMissing(double value)
Description copied from interface: EnhanceScaleMissing
Convert this double value using scale/offset/missing value if applicable

Specified by:
convertScaleOffsetMissing in interface EnhanceScaleMissing
Specified by:
convertScaleOffsetMissing in interface VariableSimpleIF

compareTo

public int compareTo(java.lang.Object o)
Implement Comparable

Specified by:
compareTo in interface java.lang.Comparable