|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.nc2.Variable
ucar.nc2.dataset.VariableDS
ucar.nc2.dataset.CoordinateAxis
ucar.nc2.dataset.CoordinateAxis1D
public class CoordinateAxis1D
A 1-dimensional Coordinate Axis. Its values must be monotonic.
If this is char valued, it will have rank 2, otherwise it will have rank 1. If string or char valued, only getCoordName() can be called. If the coordinates are regularly spaced, isRegular() is true, and the values are equal to getStart() + i * getIncrement(). This will also set "cell bounds" for this axis. By default, the cell bounds are midway between the coordinates values, and are therefore contiguous, and can be accessed though getCoordEdge(i). The only way the bunds can be set is if the coordinate variable has an attribute "bounds" that points to another variable bounds(ncoords,2). These contain the cell bounds, and must be ascending or descending as the coordinate values are. In this case isContiguous() is true when bounds1(i+1) == bounds2(i) for all i.
CoordinateAxis.factory(ucar.nc2.dataset.NetcdfDataset, ucar.nc2.dataset.VariableDS)
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ucar.nc2.dataset.CoordinateAxis |
---|
CoordinateAxis.AxisComparator |
Nested classes/interfaces inherited from class ucar.nc2.Variable |
---|
Variable.Cache |
Field Summary |
---|
Fields inherited from class ucar.nc2.dataset.CoordinateAxis |
---|
axisType, boundaryRef, isContiguous, ncd, positive |
Fields inherited from class ucar.nc2.dataset.VariableDS |
---|
orgDataType, orgName, orgVar |
Fields inherited from class ucar.nc2.Variable |
---|
attributes, cache, dataType, debugCaching, defaultCoordsSizeToCache, defaultSizeToCache, dimensions, elementSize, group, isMetadata, isVariableLength, ncfile, parent, proxyReader, shape, shapeAsSection, shortName, sizeToCache, spiObject |
Constructor Summary | |
---|---|
CoordinateAxis1D(NetcdfDataset ds,
Group group,
String shortName,
DataType dataType,
String dims,
String units,
String desc)
Constructor when theres no underlying variable. |
|
CoordinateAxis1D(NetcdfDataset ncd,
VariableDS vds)
Create a 1D coordinate axis from an existing Variable |
Method Summary | |
---|---|
protected Variable |
copy()
|
CoordinateAxis |
copyNoCache()
Make a copy, with an independent cache. |
int |
findCoordElement(double coordVal)
Given a coordinate position, find what grid element contains it. |
int |
findCoordElement(double coordVal,
int lastIndex)
Deprecated. use findCoordElement(coordVal) |
int |
findCoordElementBounded(double coordVal)
Given a coordinate position, find what grid element contains it, or is closest to it. |
double[] |
getBound1()
Get the coordinate bound1 as a double array. |
double[] |
getBound2()
Get the coordinate bound1 as a double array. |
double |
getCoordEdge(int index)
Get the ith coordinate edge. |
double[] |
getCoordEdges()
Get the coordinate edges as a double array. |
double[] |
getCoordEdges(int i)
Get the coordinate edges for the ith coordinate. |
String |
getCoordName(int index)
The "name" of the ith coordinate. |
double |
getCoordValue(int index)
Get the ith coordinate value. |
double[] |
getCoordValues()
Get the coordinate values as a double array. |
double |
getIncrement()
Get increment value if isRegular() |
double |
getMaxValue()
The largest coordinate value. |
double |
getMinValue()
The smallest coordinate value. |
List<NamedObject> |
getNames()
Get the list of names, to be used for user selection. |
double |
getStart()
Get starting value if isRegular() |
boolean |
isContiguous()
If the edges are contiguous or disjoint Caution: many datasets do not explicitly specify this info, this is often a guess; default is true. |
boolean |
isInterval()
If this coordinate has interval values. |
boolean |
isRegular()
If true, then value(i) = getStart() + i * getIncrement(). |
CoordinateAxis1D |
section(Range r)
Create a new CoordinateAxis1D as a section of this CoordinateAxis1D. |
Methods inherited from class ucar.nc2.dataset.CoordinateAxis |
---|
equals, factory, getAxisType, getBoundaryRef, getInfo, getPositive, getUnitsString, hashCode, isNumeric, setAxisType, setBoundaryRef, setPositive |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ucar.nc2.VariableSimpleIF |
---|
getName |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Constructor Detail |
---|
public CoordinateAxis1D(NetcdfDataset ncd, VariableDS vds)
ncd
- the containing datasetvds
- wrap this VariableDS, which is not changed.public CoordinateAxis1D(NetcdfDataset ds, Group group, String shortName, DataType dataType, String dims, String units, String desc)
ds
- the containing dataset.group
- the containing group; if null, use rootGroupshortName
- axis name.dataType
- data typedims
- list of dimension namesunits
- units of coordinates, preferably udunit compatible.desc
- long name.Method Detail |
---|
public CoordinateAxis1D section(Range r) throws InvalidRangeException
r
- the section range
InvalidRangeException
- if IllegalRangeprotected Variable copy()
copy
in class CoordinateAxis
public CoordinateAxis copyNoCache()
CoordinateAxis
copyNoCache
in class CoordinateAxis
public String getCoordName(int index)
index
- which one ?
public double getCoordValue(int index)
index
- which coordinate. Between 0 and getNumElements()-1 inclusive.
UnsupportedOperationException
- if !isNumeric()public double getMinValue()
CoordinateAxis
getMinValue
in class CoordinateAxis
public double getMaxValue()
CoordinateAxis
getMaxValue
in class CoordinateAxis
public double getCoordEdge(int index)
Coordinate edges must be strictly monotonic: coordEdge(0) < coordValue(0) < coordEdge(1) < coordValue(1) ... ... coordEdge(i) < coordValue(i) < coordEdge(i+1) < coordValue(i+1) ... ... coordEdge(n-1) < coordValue(n-1) < coordEdge(n)
index
- which coordinate. Between 0 and getNumElements() inclusive.
UnsupportedOperationException
- if !isNumeric()public double[] getCoordValues()
UnsupportedOperationException
- if !isNumeric()public double[] getCoordEdges()
UnsupportedOperationException
- if !isNumeric()public boolean isContiguous()
CoordinateAxis
isContiguous
in class CoordinateAxis
public boolean isInterval()
public double[] getBound1()
UnsupportedOperationException
- if !isNumeric()public double[] getBound2()
UnsupportedOperationException
- if !isNumeric()public double[] getCoordEdges(int i)
i
- coordinate index
public int findCoordElement(double coordVal)
edge[i] <= pos < edge[i+1] (if values are ascending) edge[i] > pos >= edge[i+1] (if values are descending)
coordVal
- position in this coordinate system
public int findCoordElementBounded(double coordVal)
coordVal
- position in this coordinate system
public int findCoordElement(double coordVal, int lastIndex)
public double getStart()
public double getIncrement()
public boolean isRegular()
public List<NamedObject> getNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |