Package ucar.nc2.grid
Class GridHorizCoordinateSystem
- java.lang.Object
-
- ucar.nc2.grid.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
GridHorizCoordinateSystem.CellBounds
The bounds of a particular grid cell, in projection coordinates.static class
GridHorizCoordinateSystem.CoordReturn
The cell index in which a grid coordinate is found.
-
Constructor Summary
Constructors Constructor Description GridHorizCoordinateSystem(GridAxisPoint xaxis, GridAxisPoint yaxis, Projection projection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<GridHorizCoordinateSystem.CellBounds>
cells()
An iterator over each cell of the GridHorizCoordinateSystem.boolean
equals(Object o)
Optional<GridHorizCoordinateSystem.CoordReturn>
findXYindexFromCoord(double x, double y)
From the (x,y) projection point, find the indices and coordinates of the horizontal 2D grid.Optional<GridHorizCoordinateSystem.CoordReturn>
findXYindexFromCoord(double x, double y, int[] initial)
From the (x,y) projection point, find the indices and coordinates of the horizontal 2D grid, with an initial guess.ProjectionRect
getBoundingBox()
Get horizontal bounding box in projection coordinates.String
getGeoUnits()
Get the horizontal coordinate units, null for latlon.LatLonPoint
getLatLon(int xindex, int yindex)
Get the Lat/Lon coordinates of the midpoint of a grid cell, using the x,y indices.LatLonRect
getLatLonBoundingBox()
Get horizontal bounding box in lat, lon coordinates.Projection
getProjection()
Get the horizontal Projection.List<Integer>
getShape()
The nominal sizes of the yaxis, xaxis as a list.GridAxisPoint
getXHorizAxis()
Get the 1D X axis (either GeoX or Lon).GridAxisPoint
getYHorizAxis()
Get the 1D Y axis (either GeoY or Lat).boolean
hasAxis(String axisName)
Does the named axis exist as the x or y axis?int
hashCode()
boolean
isCurvilinear()
If its curvilinear (will be instance of HorizCurviliner)boolean
isGlobalLon()
Is this a global coverage over longitude ?boolean
isLatLon()
Does this use lat/lon horizontal axes?String
toString()
-
-
-
Constructor Detail
-
GridHorizCoordinateSystem
public GridHorizCoordinateSystem(GridAxisPoint xaxis, GridAxisPoint yaxis, @Nullable Projection projection)
-
-
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?
-
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 indexyindex
- y index- Returns:
- lat/lon coordinate of the midpoint of the cell
-
cells
public Iterable<GridHorizCoordinateSystem.CellBounds> cells()
An iterator over each cell of the GridHorizCoordinateSystem.
-
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 pointy
- 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 pointy
- y of pointinitial
- initial guess, used eg for mouse tracking in UI- Returns:
- empty if not in the grid.
-
-