Package ucar.nc2.dataset
Class CoordinateAxis
- java.lang.Object
-
- ucar.nc2.Variable
-
- ucar.nc2.dataset.VariableDS
-
- ucar.nc2.dataset.CoordinateAxis
-
- All Implemented Interfaces:
Comparable<Variable>
,VariableEnhanced
,ProxyReader
- Direct Known Subclasses:
CoordinateAxis1D
@Immutable public class CoordinateAxis extends VariableDS
A Variable that specifies one of the coordinates of a CoordinateSystem, this is a legacy class, use GridAxis for new code.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, it is considered a string-valued Coordinate Axis and rank is reduced by one, since the outermost dimension is considered the string length: v(i, j, .., strlen). If its element type is String, it is a string-valued Coordinate Axis. Otherwise it is numeric-valued, and isNumeric() is true. A CoordinateAxis is optionally marked as georeferencing with an AxisType. It should have a units string and optionally a description string. A Structure cannot be a CoordinateAxis, although members of Structures can.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CoordinateAxis.AxisComparator
static class
CoordinateAxis.Builder<T extends CoordinateAxis.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 CoordinateAxis.Builder<?>
builder()
Get a Builder of CoordinateAxisboolean
equals(Object oo)
Instances which have same content are equal.static CoordinateAxis.Builder<?>
fromVariableDS(VariableDS.Builder<?> vdsBuilder)
Create a coordinate axis from an existing VariableDS.Builder.AxisType
getAxisType()
Get type of axisCalendar
getCalendarFromAttribute()
Figure out what calendar to use from the axis' attributes.static Calendar
getCalendarFromAttribute(NetcdfFile ncd, AttributeContainer attributes)
Figure out what calendar to use from the given attributes.String
getUnitsString()
Get the Unit String for the Variable.int
hashCode()
Override Object.hashCode() to implement equals.boolean
isNumeric()
Does the axis have numeric values?CoordinateAxis.Builder<?>
toBuilder()
Turn into a mutable Builder.-
Methods inherited from class ucar.nc2.dataset.VariableDS
convertArray, convertNeeded, fromVar, getArrayType, getCoordinateSystems, getDatasetLocation, getDescription, getEnhanceMode, getNetcdfFile, getOriginalArrayType, getOriginalName, getOriginalVariable, hasMissing, isMissing, lookupEnumString, proxyReadArray, proxyReadArray, readArray, readArray, scaleMissingUnsignedProxy, setCaching, toString
-
Methods inherited from class ucar.nc2.Variable
attributes, compareTo, findAttribute, findAttributeString, findDimensionIndex, getDimension, getDimensions, getDimensionSet, getDimensionsString, getElementSize, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentStructure, getRank, getSection, getShape, getShape, getShortName, getSize, getSizeToCache, getSPobject, hasCachedData, isCaching, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isVariableLength, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, reduce, section, slice
-
Methods inherited from interface ucar.nc2.dataset.VariableEnhanced
getFullName, getParentGroup, getShortName
-
-
-
-
Method Detail
-
fromVariableDS
public static CoordinateAxis.Builder<?> fromVariableDS(VariableDS.Builder<?> vdsBuilder)
Create a coordinate axis from an existing VariableDS.Builder.- Parameters:
vdsBuilder
- an existing Variable in dataset.- Returns:
- CoordinateAxis or one of its subclasses (CoordinateAxis1D, CoordinateAxis2D, or CoordinateAxis1DTime).
-
getAxisType
@Nullable public AxisType getAxisType()
Get type of axis
-
getUnitsString
public String getUnitsString()
Description copied from class:Variable
Get the Unit String for the Variable. Looks for the CDM.UNITS attribute value- Specified by:
getUnitsString
in interfaceVariableEnhanced
- Overrides:
getUnitsString
in classVariableDS
- Returns:
- unit string, or null if not found.
-
isNumeric
public boolean isNumeric()
Does the axis have numeric values?- Returns:
- true if the CoordAxis is numeric, false if its string valued ("nominal").
-
equals
public boolean equals(Object oo)
Instances which have same content are equal.
-
hashCode
public int hashCode()
Override Object.hashCode() to implement equals.
-
getCalendarFromAttribute
public Calendar getCalendarFromAttribute()
Figure out what calendar to use from the axis' attributes.
-
getCalendarFromAttribute
@Nullable public static Calendar getCalendarFromAttribute(@Nullable NetcdfFile ncd, AttributeContainer attributes)
Figure out what calendar to use from the given attributes.
-
toBuilder
public CoordinateAxis.Builder<?> toBuilder()
Description copied from class:Variable
Turn into a mutable Builder. Can use toBuilder().build() to copy.- Overrides:
toBuilder
in classVariableDS
-
builder
public static CoordinateAxis.Builder<?> builder()
Get a Builder of CoordinateAxis
-
-