Package ucar.nc2.grid

Class GridHorizCoordinateSystem

  • Direct Known Subclasses:
    GridHorizCurvilinear

    @Immutable
    public class GridHorizCoordinateSystem
    extends Object
    Manages the Projection GeoX/GeoY or Lat/Lon horizontal CoordinateSystem, with orthogonal axes. Note that when isLatLon() is true, the coordinates are LatLon projection coordinates, where the longitude coordinates are not constrained to +/- 180, and are monotonic.
    • Method Detail

      • getXHorizAxis

        public GridAxisPoint getXHorizAxis()
        Get the 1D X axis (either GeoX or Lon).
      • getYHorizAxis

        public GridAxisPoint getYHorizAxis()
        Get the 1D Y axis (either GeoY or Lat).
      • getProjection

        public Projection getProjection()
        Get the horizontal Projection.
      • isLatLon

        public boolean isLatLon()
        Does this use lat/lon horizontal axes?
      • isCurvilinear

        public boolean isCurvilinear()
        If its curvilinear (will be instance of HorizCurviliner)
      • isGlobalLon

        public boolean isGlobalLon()
        Is this a global coverage over longitude ?
      • hasAxis

        public boolean hasAxis​(String axisName)
        Does the named axis exist as the x or y axis?
      • getShape

        public List<Integer> getShape()
        The nominal sizes of the yaxis, xaxis as a list.
      • getGeoUnits

        @Nullable
        public String getGeoUnits()
        Get the horizontal coordinate units, null for latlon. Needed to convert projection units.
      • getLatLonBoundingBox

        public LatLonRect getLatLonBoundingBox()
        Get horizontal bounding box in lat, lon coordinates. When not isLatLon(), only an approximation based on corners.
      • getBoundingBox

        public ProjectionRect getBoundingBox()
        Get horizontal bounding box in projection coordinates.
      • getLatLon

        public LatLonPoint getLatLon​(int xindex,
                                     int yindex)
        Get the Lat/Lon coordinates of the midpoint of a grid cell, using the x,y indices.
        Parameters:
        xindex - x index
        yindex - y index
        Returns:
        lat/lon coordinate of the midpoint of the cell
      • findXYindexFromCoord

        public Optional<GridHorizCoordinateSystem.CoordReturn> findXYindexFromCoord​(double x,
                                                                                    double y)
        From the (x,y) projection point, find the indices and coordinates of the horizontal 2D grid.
        Parameters:
        x - x of point
        y - y of point
        Returns:
        empty if not in the grid.
      • findXYindexFromCoord

        public Optional<GridHorizCoordinateSystem.CoordReturn> findXYindexFromCoord​(double x,
                                                                                    double y,
                                                                                    @Nullable
                                                                                    int[] initial)
        From the (x,y) projection point, find the indices and coordinates of the horizontal 2D grid, with an initial guess. The initial guess is an optimization used for curvilinear grids, otherwise not needed.
        Parameters:
        x - x of point
        y - y of point
        initial - initial guess, used eg for mouse tracking in UI
        Returns:
        empty if not in the grid.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object