Package ucar.nc2.dataset
Class CoordinateAxis2D
- java.lang.Object
-
- ucar.nc2.CDMNode
-
- ucar.nc2.Variable
-
- ucar.nc2.dataset.VariableDS
-
- ucar.nc2.dataset.CoordinateAxis
-
- ucar.nc2.dataset.CoordinateAxis2D
-
- All Implemented Interfaces:
Comparable<VariableSimpleIF>
,Iterable<Attribute>
,IsMissingEvaluator
,AttributeContainer
,Enhancements
,EnhanceScaleMissingUnsigned
,VariableEnhanced
,ProxyReader
,VariableSimpleIF
public class CoordinateAxis2D extends CoordinateAxis
A 2-dimensional numeric Coordinate Axis. Must be invertible meaning, roughly, that if you draw lines connecting the points, none would cross.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CoordinateAxis2D.Builder<T extends CoordinateAxis2D.Builder<T>>
-
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, hashCode, isVariableLength, ncfile, permitCaching, proxyReader, shape, sizeToCache, spiObject
-
Fields inherited from class ucar.nc2.CDMNode
annotations, dodsname, group, immutable, parentstruct, shortName, sort
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CoordinateAxis2D(CoordinateAxis2D.Builder<?> builder, Group parentGroup)
CoordinateAxis2D(NetcdfDataset ncd, VariableDS vds)
Deprecated.Use CoordinateAxis2D.builder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected CoordinateAxis2D.Builder<?>
addLocalFieldsToBuilder(CoordinateAxis2D.Builder<? extends CoordinateAxis2D.Builder<?>> b)
static CoordinateAxis2D.Builder<?>
builder()
Get Builder for this class that allows subclassing.protected CoordinateAxis2D
copy()
Deprecated.UsetoBuilder()
int
findTimeIndexFromCalendarDate(int run_idx, CalendarDate want)
ArrayDouble.D3
getCoordBoundsArray()
Only call if isInterval()CoordinateAxisTimeHelper
getCoordinateAxisTimeHelper()
double
getCoordValue(int j, int i)
Get the coordinate value at the i, j index.double[]
getCoordValues()
Get the coordinate values as a 1D double array, in canonical order.ArrayDouble.D2
getCoordValuesArray()
ArrayDouble.D2
getEdges()
ArrayDouble.D2
getXEdges()
Deprecated.use getEdges()ArrayDouble.D2
getYEdges()
Deprecated.use getEdges()boolean
isInterval()
An interval coordinate consists of two numbers, bound1 and bound2.static ArrayDouble.D2
makeEdges(ArrayDouble.D2 midpoints)
Normal case: do something reasonable in deciding on the edges when we have the midpoints of a 2D coordinate.static ArrayDouble.D2
makeXEdgesRotated(ArrayDouble.D2 midx)
Experimental: for WRF rotated (NMM "E") Gridsstatic ArrayDouble.D2
makeYEdgesRotated(ArrayDouble.D2 midy)
Experimental: for WRF rotated (NMM "E") GridsCoordinateAxis2D
section(Range r1, Range r2)
Create a new CoordinateAxis2D as a section of this CoordinateAxis2D.CoordinateAxis2D.Builder<?>
toBuilder()
Turn into a mutable Builder.-
Methods inherited from class ucar.nc2.dataset.CoordinateAxis
addLocalFieldsToBuilder, copyNoCache, equals, factory, fromVariableDS, getAxisType, getBoundaryRef, getCalendarFromAttribute, getInfo, getMaxValue, getMinValue, getPositive, getUnitsString, hashCode, isContiguous, isIndependentCoordinate, isNumeric, setAxisType, setBoundaryRef, setPositive
-
Methods inherited from class ucar.nc2.dataset.VariableDS
_read, _read, addCoordinateSystem, addEnhancement, addLocalFieldsToBuilder, applyScaleOffset, applyScaleOffset, clearCoordinateSystems, convert, convertMissing, convertMissing, convertUnsigned, convertUnsigned, convertUnsigned, enhance, fillValueIsMissing, getCoordinateSystems, getDatasetLocation, getDescription, getEnhanceMode, getFillValue, getMissingDataArray, getMissingValues, getNetcdfFile, getOffset, getOriginalDataType, getOriginalName, getOriginalVariable, getScaledOffsetType, getScaleFactor, getSignedness, getUnsignedConversionType, getValidMax, getValidMin, hasCachedDataRecurse, hasFillValue, hasMissing, hasMissingValue, hasScaleOffset, hasValidData, invalidDataIsMissing, isFillValue, isInvalidData, isMissing, isMissingValue, lookupEnumString, missingDataIsMissing, readToStream, reallyRead, reallyRead, removeCoordinateSystem, removeEnhancement, setCaching, setFillValueIsMissing, setInvalidDataIsMissing, setMissingDataIsMissing, setName, setOriginalVariable, setUnitsString, showScaleMissingProxy, toStringDebug
-
Methods inherited from class ucar.nc2.Variable
_readScalarData, addAll, addAttribute, addLocalFieldsToBuilder, attributes, compareTo, createNewCache, extraInfo, findAttribute, findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, findAttributeString, findDimensionIndex, getAttributes, getDAPName, getDAPName, getDataType, getDimension, getDimensions, getDimensionsAll, getDimensionsString, getElementSize, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentGroupOrRoot, getParentStructure, getProxyReader, getRanges, getRank, getScalarData, getShape, getShape, getShapeAll, getShapeAsSection, getSize, getSizeToCache, getSPobject, hasCachedData, invalidateCache, isCaching, isCoordinateVariable, isEmpty, isImmutable, isMemberOfStructure, isMetadata, isScalar, isUnknownLength, isUnlimited, isVariableLength, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, readToByteChannel, reduce, remove, removeAttribute, removeAttributeIgnoreCase, resetDimensions, resetShape, section, section, setCachedData, setCachedData, setDataType, setDimension, setDimensions, setDimensions, setDimensionsAnonymous, setElementSize, setEnumTypedef, setImmutable, setIsScalar, setParentGroup, setProxyReader, setSizeToCache, setSPobject, setValues, setValues, slice, toString, writeCDL, writeCDL
-
Methods inherited from class ucar.nc2.CDMNode
annotate, annotation, getDODSName, getFullNameEscaped, getGroup, getImmutable, getName, getShortName, getSort, localhash, setDODSName, setParentStructure, setShortName, setSort, unwrap
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ucar.nc2.AttributeContainer
findAttValueIgnoreCase, getName, hasAttribute, hasAttributeIgnoreCase, iterator
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface ucar.nc2.dataset.VariableEnhanced
getFullName, getShortName
-
Methods inherited from interface ucar.nc2.VariableSimpleIF
getName, getShortName
-
-
-
-
Constructor Detail
-
CoordinateAxis2D
@Deprecated public CoordinateAxis2D(NetcdfDataset ncd, VariableDS vds)
Deprecated.Use CoordinateAxis2D.builder()Create a 2D coordinate axis from an existing VariableDS- Parameters:
ncd
- the containing datasetvds
- create it from here
-
CoordinateAxis2D
protected CoordinateAxis2D(CoordinateAxis2D.Builder<?> builder, Group parentGroup)
-
-
Method Detail
-
copy
@Deprecated protected CoordinateAxis2D copy()
Deprecated.UsetoBuilder()
- Overrides:
copy
in classCoordinateAxis
-
getCoordValue
public double getCoordValue(int j, int i)
Get the coordinate value at the i, j index.- Parameters:
i
- index 0 (fastest varying, right-most)j
- index 1- Returns:
- midpoint.get(j, i).
-
isInterval
public boolean isInterval()
Description copied from class:CoordinateAxis
An interval coordinate consists of two numbers, bound1 and bound2. The coordinate value must lie between them, but otherwise is somewhat arbitrary. If not interval, then it has one number, the coordinate value.- Overrides:
isInterval
in classCoordinateAxis
- Returns:
- true if its an interval coordinate.
-
getCoordValues
public double[] getCoordValues()
Get the coordinate values as a 1D double array, in canonical order.- Returns:
- coordinate values
- Throws:
UnsupportedOperationException
- if !isNumeric()
-
section
public CoordinateAxis2D section(Range r1, Range r2) throws InvalidRangeException
Create a new CoordinateAxis2D as a section of this CoordinateAxis2D.- Parameters:
r1
- the section on the first indexr2
- the section on the second index- Returns:
- a section of this CoordinateAxis2D
- Throws:
InvalidRangeException
- if specified Ranges are invalid
-
getCoordValuesArray
public ArrayDouble.D2 getCoordValuesArray()
-
getCoordBoundsArray
public ArrayDouble.D3 getCoordBoundsArray()
Only call if isInterval()- Returns:
- bounds array pr null if not an interval
-
getEdges
public ArrayDouble.D2 getEdges()
-
getXEdges
public ArrayDouble.D2 getXEdges()
Deprecated.use getEdges()
-
getYEdges
public ArrayDouble.D2 getYEdges()
Deprecated.use getEdges()
-
makeEdges
public static ArrayDouble.D2 makeEdges(ArrayDouble.D2 midpoints)
Normal case: do something reasonable in deciding on the edges when we have the midpoints of a 2D coordinate.- Parameters:
midpoints
- values of midpoints with shape (ny, nx)- Returns:
- values of edges with shape (ny+1, nx+1)
-
makeXEdgesRotated
public static ArrayDouble.D2 makeXEdgesRotated(ArrayDouble.D2 midx)
Experimental: for WRF rotated (NMM "E") Grids- Parameters:
midx
- x coordinates of midpoints- Returns:
- x coordinates of edges with shape (ny+2, nx+1)
-
makeYEdgesRotated
public static ArrayDouble.D2 makeYEdgesRotated(ArrayDouble.D2 midy)
Experimental: for WRF rotated (NMM "E") Grids- Parameters:
midy
- y coordinates of midpoints- Returns:
- y coordinates of edges with shape (ny+2, nx+1)
-
getCoordinateAxisTimeHelper
public CoordinateAxisTimeHelper getCoordinateAxisTimeHelper()
-
findTimeIndexFromCalendarDate
public int findTimeIndexFromCalendarDate(int run_idx, CalendarDate want)
-
toBuilder
public CoordinateAxis2D.Builder<?> toBuilder()
Description copied from class:Variable
Turn into a mutable Builder. Can use toBuilder().build() to copy.- Overrides:
toBuilder
in classCoordinateAxis
-
addLocalFieldsToBuilder
protected CoordinateAxis2D.Builder<?> addLocalFieldsToBuilder(CoordinateAxis2D.Builder<? extends CoordinateAxis2D.Builder<?>> b)
-
builder
public static CoordinateAxis2D.Builder<?> builder()
Get Builder for this class that allows subclassing.- See Also:
- "https://community.oracle.com/blogs/emcmanus/2010/10/24/using-builder-pattern-subclasses"
-
-