ucar.nc2.dataset
Class CoordinateAxis

java.lang.Object
  extended by ucar.nc2.Variable
      extended by ucar.nc2.dataset.VariableDS
          extended by ucar.nc2.dataset.CoordinateAxis
All Implemented Interfaces:
java.lang.Comparable, Enhancements, EnhanceScaleMissing, VariableEnhanced, VariableIF, VariableSimpleIF
Direct Known Subclasses:
CoordinateAxis1D, CoordinateAxis2D

public class CoordinateAxis
extends VariableDS
implements java.lang.Comparable

A Coordinate Axis is a Variable that specifies one of the coordinates of a CoordinateSystem. Mathematically it is a scalar function F from index space to S:

  F:D -> S
  where D is a product set of dimensions (aka index space), and S is the set of reals (R) or Strings.
 
If its element type is char, this it is a string-valued Coordinate Axis of rank-1, where the outermost dimension is considered the string length: v(i, j, .. strlen); Otherwise it is numeric-valued, and isNumeric() is true.

The one-dimensional case F(i) -> R is the common case which affords important optimizations. In that case, use the subtype CoordinateAxis1D. The factory methods will return either a CoordinateAxis1D if the variable is one-dimensional, a CoordinateAxis2D if its 2D, or a CoordinateAxis for the general case.

A CoordinateAxis is optionally marked as georeferencing with an AxisType. It should have a units string and optionally a description string.

Version:
$Revision:51 $ $Date:2006-07-12 17:13:13Z $
Author:
john caron
See Also:
"NCML documentation"

Nested Class Summary
static class CoordinateAxis.AxisComparator
          Standard sort on Coordinate Axes
 
Field Summary
static java.lang.String POSITIVE_DOWN
           
static java.lang.String POSITIVE_UP
           
 
Fields inherited from class ucar.nc2.Variable
defaultSizeToCache
 
Constructor Summary
CoordinateAxis(NetcdfDataset ds, Group group, java.lang.String shortName, DataType dataType, java.lang.String dims, java.lang.String units, java.lang.String desc)
          Constructor when theres no underlying variable.
 
Method Summary
 int compareTo(java.lang.Object o)
          Use the name to sort on
 boolean equals(java.lang.Object oo)
          Instances which have same content are equal.
static CoordinateAxis factory(NetcdfDataset dataset, VariableDS vds)
          Create a coordinate axis from an existing Variable.
 AxisType getAxisType()
          Get type of axis, or null if none.
 java.lang.String getBoundaryRef()
          Get the name of this coordinate axis' boundary variable, or null if none.
 java.lang.String getInfo()
          formatted string representation
 double getMaxValue()
          Get the minimum coordinate value
 double getMinValue()
          Get the maximum coordinate value
 java.lang.String getPositive()
          Get the direction of increasing values, used only for vertical Axes.
 java.lang.String getUnitsString()
          Get the Unit String for the Variable.
 int hashCode()
          Override Object.hashCode() to implement equals.
 boolean isContiguous()
          If the edges are contiguous or disjoint.
 boolean isNumeric()
          If the CoordAxis is numeric or string valued.
 void setAxisType(AxisType axisType)
          Set type of axis, or null if none.
 void setBoundaryRef(java.lang.String boundaryRef)
          Set a reference to a boundary variable.
 void setContiguous(boolean isContiguous)
          Set if the edges are contiguous or disjoint.
 void setPositive(java.lang.String positive)
          Set the direction of increasing values, used only for vertical Axes.
 
Methods inherited from class ucar.nc2.dataset.VariableDS
addCoordinateSystem, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, convertScaleOffsetMissing, enhance, getCoordinateSystems, getDescription, getOriginalDataType, getOriginalVariable, getProxyReader, getUnitString, getValidMax, getValidMin, hasFillValue, hasInvalidData, hasMissing, hasMissingValue, hasScaleOffset, isEnhanced, isFillValue, isInvalidData, isMissing, isMissingValue, removeCoordinateSystem, section, setFillValueIsMissing, setInvalidDataIsMissing, setMissingDataIsMissing, setProxyReader, setUnitsString, setUseNaNs, slice
 
Methods inherited from class ucar.nc2.Variable
addAttribute, findAttribute, findAttributeIgnoreCase, findDimensionIndex, getAttributes, getCoordinateDimension, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getElementSize, getIOVar, getName, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getSectionRanges, getShape, getShortName, getSize, getSizeToCache, getSPobject, hasCachedData, invalidateCache, isCaching, isMemberOfStructure, isMetadata, isScalar, isUnknownLength, isUnlimited, isUnsigned, isVariableLength, read, read, read, read, readAllStructures, readAllStructuresSpec, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, remove, replaceDimension, setCachedData, setCaching, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setIOVar, setIsCoordinateAxis, setName, setParentGroup, setParentStructure, setSizeToCache, setSPobject, toString, toStringDebug, writeCDL
 
Methods inherited from class java.lang.Object
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
 

Field Detail

POSITIVE_UP

public static final java.lang.String POSITIVE_UP
See Also:
Constant Field Values

POSITIVE_DOWN

public static final java.lang.String POSITIVE_DOWN
See Also:
Constant Field Values
Constructor Detail

CoordinateAxis

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

Parameters:
ds - the containing dataset.
group - the containing group; if null, use rootGroup
shortName - axis name.
dataType - data type
dims - list of dimension names
units - units of coordinates, preferably udunit compatible.
desc - long name.
Method Detail

factory

public static CoordinateAxis factory(NetcdfDataset dataset,
                                     VariableDS vds)
Create a coordinate axis from an existing Variable.

Parameters:
dataset - the containing dataset
vds - an existing Variable in dataset.
Returns:
CoordinateAxis1D, CoordinateAxis2D, or CoordinateAxis.

getAxisType

public AxisType getAxisType()
Get type of axis, or null if none.


setAxisType

public void setAxisType(AxisType axisType)
Set type of axis, or null if none. Default is none.


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 VariableDS
Returns:
unit string, or null if not found.

isNumeric

public boolean isNumeric()
If the CoordAxis is numeric or string valued.


isContiguous

public boolean isContiguous()
If the edges are contiguous or disjoint. Assumed true unless set otherwise.


setContiguous

public void setContiguous(boolean isContiguous)
Set if the edges are contiguous or disjoint.


getPositive

public java.lang.String getPositive()
Get the direction of increasing values, used only for vertical Axes.

Returns:
POSITIVE_UP, POSITIVE_DOWN, or null if unknown.

setPositive

public void setPositive(java.lang.String positive)
Set the direction of increasing values, used only for vertical Axes. Set to POSITIVE_UP, POSITIVE_DOWN, or null if you dont know..


getBoundaryRef

public java.lang.String getBoundaryRef()
Get the name of this coordinate axis' boundary variable, or null if none.


setBoundaryRef

public void setBoundaryRef(java.lang.String boundaryRef)
Set a reference to a boundary variable. Must be name of boundary coordinate variable.


getMinValue

public double getMinValue()
Get the maximum coordinate value


getMaxValue

public double getMaxValue()
Get the minimum coordinate value


getInfo

public java.lang.String getInfo()
formatted string representation


equals

public boolean equals(java.lang.Object oo)
Instances which have same content are equal.

Overrides:
equals in class Variable

hashCode

public int hashCode()
Override Object.hashCode() to implement equals.

Overrides:
hashCode in class Variable

compareTo

public int compareTo(java.lang.Object o)
Use the name to sort on

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class VariableDS
Parameters:
o - the other CoordinateAxis
Returns:
-1,0,1