Package ucar.nc2.grid
Class GridHorizCurvilinear
- java.lang.Object
-
- ucar.nc2.grid.GridHorizCoordinateSystem
-
- ucar.nc2.grid.GridHorizCurvilinear
-
@Immutable public class GridHorizCurvilinear extends GridHorizCoordinateSystem
A "Curvilinear" horizontal CoordinateSystem does not have a closed form projection function, nor orthogonal lat/lon axes. The x/y axes are typically nominal (eg just reflect the x,y index). The lat/lon values are stored in a 2D array. To find a cell from a lat/lon value, we do a search in those 2D arrays.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ucar.nc2.grid.GridHorizCoordinateSystem
GridHorizCoordinateSystem.CellBounds, GridHorizCoordinateSystem.CoordReturn
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<GridHorizCoordinateSystem.CellBounds>
cells()
An iterator over each cell of the GridHorizCoordinateSystem.static GridHorizCurvilinear
create(GridAxisPoint xaxis, GridAxisPoint yaxis, Array<Number> latdata, Array<Number> londata)
Create a GridHorizCurvilinear from the x/y axes and 2D lat/lon arrays.static GridHorizCurvilinear
createFromEdges(GridAxisPoint xaxis, GridAxisPoint yaxis, Array<Double> latedge, Array<Double> lonedge)
Create a GridHorizCurvilinear from the x/y axes and 2D lat/lon edge arrays.boolean
equals(Object o)
Optional<GridHorizCoordinateSystem.CoordReturn>
findXYindexFromCoord(double lon, double lat)
Find the grid indexes of the given longitude and latitude.Optional<GridHorizCoordinateSystem.CoordReturn>
findXYindexFromCoord(double lon, double lat, int[] initial)
Find the grid indexes of the given longitude and latitude, with a starting guess.Array<Double>
getLatEdges()
The latitude edge array.LatLonPoint
getLatLon(int xindex, int yindex)
Get the Lat/Lon coordinates of the midpoint of a grid cell, using the x,y indices.Array<Double>
getLonEdges()
The longitude edge array.int
hashCode()
boolean
isLatLon()
Always true for GridHorizCurvilinear.-
Methods inherited from class ucar.nc2.grid.GridHorizCoordinateSystem
getBoundingBox, getGeoUnits, getLatLonBoundingBox, getProjection, getShape, getXHorizAxis, getYHorizAxis, hasAxis, isCurvilinear, isGlobalLon, toString
-
-
-
-
Method Detail
-
create
public static GridHorizCurvilinear create(GridAxisPoint xaxis, GridAxisPoint yaxis, Array<Number> latdata, Array<Number> londata)
Create a GridHorizCurvilinear from the x/y axes and 2D lat/lon arrays.- Parameters:
xaxis
- the xaxis, may be nominal, as the projection is never used.yaxis
- the yaxis, may be nominal, as the projection is never used.latdata
- The latitude of the center points.londata
- The longitude of the center points.- Returns:
- a new GridHorizCurvilinear
-
createFromEdges
public static GridHorizCurvilinear createFromEdges(GridAxisPoint xaxis, GridAxisPoint yaxis, Array<Double> latedge, Array<Double> lonedge)
Create a GridHorizCurvilinear from the x/y axes and 2D lat/lon edge arrays.- Parameters:
xaxis
- the xaxis, may be nominal, as the projection is never used.yaxis
- the yaxis, may be nominal, as the projection is never used.latedge
- The latitudes of the edges.lonedge
- The longitude of the edges.- Returns:
- a new GridHorizCurvilinear
-
isLatLon
public boolean isLatLon()
Always true for GridHorizCurvilinear.- Overrides:
isLatLon
in classGridHorizCoordinateSystem
-
findXYindexFromCoord
public Optional<GridHorizCoordinateSystem.CoordReturn> findXYindexFromCoord(double lon, double lat)
Find the grid indexes of the given longitude and latitude.- Overrides:
findXYindexFromCoord
in classGridHorizCoordinateSystem
- Parameters:
lon
- x of pointlat
- y of point- Returns:
- empty if not in the grid.
-
findXYindexFromCoord
public Optional<GridHorizCoordinateSystem.CoordReturn> findXYindexFromCoord(double lon, double lat, @Nullable int[] initial)
Find the grid indexes of the given longitude and latitude, with a starting guess.- Overrides:
findXYindexFromCoord
in classGridHorizCoordinateSystem
- Parameters:
lon
- x of pointlat
- y of pointinitial
- initial guess, used eg for mouse tracking in UI- Returns:
- empty if not in the grid.
-
cells
public Iterable<GridHorizCoordinateSystem.CellBounds> cells()
Description copied from class:GridHorizCoordinateSystem
An iterator over each cell of the GridHorizCoordinateSystem.- Overrides:
cells
in classGridHorizCoordinateSystem
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classGridHorizCoordinateSystem
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classGridHorizCoordinateSystem
-
getLatLon
public LatLonPoint getLatLon(int xindex, int yindex)
Description copied from class:GridHorizCoordinateSystem
Get the Lat/Lon coordinates of the midpoint of a grid cell, using the x,y indices.- Overrides:
getLatLon
in classGridHorizCoordinateSystem
- Parameters:
xindex
- x indexyindex
- y index- Returns:
- lat/lon coordinate of the midpoint of the cell
-
-