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
,ucar.nc2.dataset.Enhancements
,ucar.nc2.dataset.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
-
-
Field Summary
-
Fields inherited from class ucar.nc2.Variable
defaultCoordsSizeToCache, defaultSizeToCache, permitCaching
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CoordinateAxis2D.Builder<?>
builder()
Get Builder for this class that allows subclassing.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()
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
copyNoCache, equals, fromVariableDS, getAxisType, getBoundaryRef, getCalendarFromAttribute, getInfo, getMaxValue, getMinValue, getPositive, getUnitsString, hashCode, isContiguous, isIndependentCoordinate, isNumeric
-
Methods inherited from class ucar.nc2.dataset.VariableDS
applyScaleOffset, applyScaleOffset, convertMissing, convertMissing, convertUnsigned, convertUnsigned, convertUnsigned, fillValueIsMissing, getCoordinateSystems, getDatasetLocation, getDescription, getEnhanceMode, getFillValue, getMissingDataArray, getMissingValues, getNetcdfFile, getOffset, getOriginalDataType, getOriginalName, getOriginalVariable, getScaledOffsetType, getScaleFactor, getSignedness, getUnsignedConversionType, getValidMax, getValidMin, hasFillValue, hasMissing, hasMissingValue, hasScaleOffset, hasValidData, invalidDataIsMissing, isFillValue, isInvalidData, isMissing, isMissingValue, lookupEnumString, missingDataIsMissing, readToStream, reallyRead, reallyRead, showScaleMissingProxy, toStringDebug
-
Methods inherited from class ucar.nc2.Variable
attributes, compareTo, createNewCache, findAttribute, findAttributeString, findDimensionIndex, getDataType, getDimension, getDimensions, getDimensionsString, getElementSize, getEnumTypedef, getFileTypeId, getFullName, getNameAndDimensions, getNameAndDimensions, getNameAndDimensions, getParentGroup, getParentStructure, getRanges, getRank, getShape, getShape, getShapeAsSection, getSize, getSizeToCache, getSPobject, hasCachedData, isCaching, isCoordinateVariable, isMemberOfStructure, isMetadata, isScalar, isUnlimited, isVariableLength, read, read, read, read, read, readScalarByte, readScalarDouble, readScalarFloat, readScalarInt, readScalarLong, readScalarShort, readScalarString, reduce, section, section, slice, toString
-
Methods inherited from interface ucar.nc2.AttributeContainer
findAttributeDouble, findAttributeIgnoreCase, findAttributeInteger, getName, hasAttribute, hasAttributeIgnoreCase, isEmpty, iterator
-
Methods inherited from interface ucar.nc2.dataset.Enhancements
addCoordinateSystem, removeCoordinateSystem
-
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
getShortName
-
-
-
-
Method Detail
-
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()
-
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
-
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"
-
-