Class 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.
See Also:
  • Constructor Details

    • 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 dataset
      vds - create it from here
  • Method Details

    • 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 class CoordinateAxis
      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 index
      r2 - 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 class CoordinateAxis
    • 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"