Package uk.ac.rdg.resc.edal.util
Class CurvilinearCoords
- java.lang.Object
-
- uk.ac.rdg.resc.edal.util.CurvilinearCoords
-
public final class CurvilinearCoords extends Object
A horizontal (2D) grid that is defined by explicitly specifying the longitude and latitude coordinates of its cells. We assume the WGS84 lat-lon coordinate system.- Author:
- Guy Griffiths, Jon Blower
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCurvilinearCoords.CellA cell within this curvilinear grid.
-
Constructor Summary
Constructors Constructor Description CurvilinearCoords(Array2D<Number> lonVals, Array2D<Number> latVals)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)BoundingBoxgetBoundingBox()CurvilinearCoords.CellgetCell(int i, int j)Gets the [i,j]th cell in this grid.List<CurvilinearCoords.Cell>getCells()Returns an unmodifiable list of the cells in this grid, with the i direction varying fastest.doublegetMeanCellArea()Gets the mean area of the cells in this grid, in square degrees.HorizontalPositiongetMidpoint(int i, int j)Gets the location of the midpoint of the cell at indices i, j.intgetNi()intgetNj()inthashCode()static voidmain(String[] args)intsize()Returns the number of cells in this grid
-
-
-
Method Detail
-
getMidpoint
public HorizontalPosition getMidpoint(int i, int j)
Gets the location of the midpoint of the cell at indices i, j. Thelongitude coordinateof the midpoint will be in the range [-180,180].- Throws:
ArrayIndexOutOfBoundsException- if i and j combine to give a point outside the grid.
-
getCell
public CurvilinearCoords.Cell getCell(int i, int j)
Gets the [i,j]th cell in this grid. TODO cache or precompute the cells?- Throws:
IllegalArgumentException- if i,j is not a valid cell in this grid.
-
getNi
public int getNi()
- Returns:
- the number of points in the i direction in this grid
-
getNj
public int getNj()
- Returns:
- the number of points in the j direction in this grid
-
size
public int size()
Returns the number of cells in this grid
-
getBoundingBox
public BoundingBox getBoundingBox()
-
getCells
public List<CurvilinearCoords.Cell> getCells()
Returns an unmodifiable list of the cells in this grid, with the i direction varying fastest.
-
getMeanCellArea
public double getMeanCellArea()
Gets the mean area of the cells in this grid, in square degrees.
-
main
public static void main(String[] args)
-
-