|
||||||||||
| 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().
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 |
| Field Summary |
|---|
| Fields inherited from class ucar.nc2.dataset.CoordinateAxis |
|---|
POSITIVE_DOWN, POSITIVE_UP |
| Fields inherited from class ucar.nc2.Variable |
|---|
defaultSizeToCache |
| Constructor Summary | |
|---|---|
CoordinateAxis1D(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. |
|
CoordinateAxis1D(VariableDS vds)
create a 1D coordinate axis from an existing Variable |
|
| Method Summary | |
|---|---|
int |
findCoordElement(double pos)
Given a coordinate position, find what grid element contains it. |
int |
findCoordElement(double pos,
int lastIndex)
Given a coordinate position, find what grid element contains it. |
int |
findCoordElementBounded(double pos)
Given a coordinate position, find what grid element contains it, but always return valid index. |
int |
findCoordElementBounded(double pos,
int lastIndex)
Given a coordinate position, find what grid element contains it, but always return valid index. |
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. |
java.lang.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() |
int |
getIndex(java.lang.String name)
Get the index corresponding to the name. |
double |
getMaxValue()
Get the minimum coordinate value |
double |
getMinValue()
Get the maximum coordinate value |
java.util.List |
getNames()
Get the list of names, to be used for user selection. |
double |
getStart()
Get Starting value if isRegular() |
boolean |
isLayer()
If coordinate lies between a layer, or is at a point. |
boolean |
isRegular()
If evenly spaced. |
Variable |
section(java.util.List section)
Create a new Variable that is a logical subsection of this Variable. |
CoordinateAxis1D |
section(Range r)
Create a new CoordinateAxis1D as a section of this CoordinateAxis1D. |
void |
setLayer(boolean isLayer)
If coordinate lies between a layer, or is at a point. |
| Methods inherited from class ucar.nc2.dataset.CoordinateAxis |
|---|
compareTo, equals, factory, getAxisType, getBoundaryRef, getInfo, getPositive, getUnitsString, hashCode, isContiguous, isNumeric, setAxisType, setBoundaryRef, setContiguous, setPositive |
| 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 |
| Constructor Detail |
|---|
public CoordinateAxis1D(VariableDS vds)
public CoordinateAxis1D(NetcdfDataset ds,
Group group,
java.lang.String shortName,
DataType dataType,
java.lang.String dims,
java.lang.String units,
java.lang.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
public Variable section(java.util.List section)
throws InvalidRangeException
Variable
section in interface VariableIFsection in class VariableDSsection - 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.
InvalidRangeExceptionpublic java.lang.String getCoordName(int index)
public double getCoordValue(int index)
index - which coordinate. Between 0 and getNumElements()-1 inclusive.
java.lang.UnsupportedOperationException - if !isNumeric()public double getMinValue()
CoordinateAxis
getMinValue in class CoordinateAxispublic double getMaxValue()
CoordinateAxis
getMaxValue in class CoordinateAxispublic 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.
java.lang.UnsupportedOperationException - if !isNumeric()public double[] getCoordValues()
java.lang.UnsupportedOperationException - if !isNumeric()public double[] getCoordEdges()
java.lang.UnsupportedOperationException - if !isNumeric()public double[] getBound1()
java.lang.UnsupportedOperationException - if !isNumeric()public double[] getBound2()
java.lang.UnsupportedOperationException - if !isNumeric()public double[] getCoordEdges(int i)
i - coordinate index
public int findCoordElement(double pos)
edge[i] <= pos < edge[i+1] (if values are ascending)
edge[i] > pos >= edge[i+1] (if values are descending)
pos - position in this coordinate system
public int findCoordElement(double pos,
int lastIndex)
edge[i] <= pos < edge[i+1] (if values are ascending)
edge[i] > pos >= edge[i+1] (if values are descending)
pos - position in this coordinate systemlastIndex - last position we looked for, or -1 if none
public int findCoordElementBounded(double pos)
pos - position in this coordinate system
public int findCoordElementBounded(double pos,
int lastIndex)
if values are ascending:
pos < edge[0] return 0
edge[n] < pos return n-1
edge[i] <= pos < edge[i+1] return i
if values are descending:
pos > edge[0] return 0
edge[n] > pos return n-1
edge[i] > pos >= edge[i+1] return i
pos - position in this coordinate systemlastIndex - last position we looked for, or -1 if none
public double getStart()
public double getIncrement()
public boolean isLayer()
public void setLayer(boolean isLayer)
public boolean isRegular()
public java.util.List getNames()
public int getIndex(java.lang.String name)
name -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||