## ucar.nc2.dt Interface GridCoordSystem

`public interface GridCoordSystem`

A Coordinate System for gridded data. Assume:

• X and Y are 1 or 2 dimensional
• T is 1 or 2 dimensional. The 2D case is that it depends on runtime.
• We can create Dates out of the T and RT coordinate values.
• Z, E, RT are 1-dimensional
• An optional VerticalTransform can provide a height or pressure coordinate that may be 1-4 dimensional.

Author:
caron

Method Summary
` int[]` ```findXYindexFromCoord(double x_coord, double y_coord, int[] result)```
Given a point in x,y coordinate space, find the x,y indices.
` int[]` ```findXYindexFromCoordBounded(double x_coord, double y_coord, int[] result)```
Given a point in x,y coordinate space, find the x,y indices.
` int[]` ```findXYindexFromLatLon(double lat, double lon, int[] result)```
Given a lat,lon point, find the x,y index of the containing grid point.
` int[]` ```findXYindexFromLatLonBounded(double lat, double lon, int[] result)```
Given a lat,lon point, find the x,y index of the containing grid point.
` ProjectionRect` `getBoundingBox()`
Get horizontal bounding box in projection coordinates.
` java.util.List<CoordinateAxis>` `getCoordinateAxes()`
Get the list of all axes.
` java.util.List<CoordinateTransform>` `getCoordinateTransforms()`
Get the list of all CoordinateTransforms.
` DateRange` `getDateRange()`
If there is a time coordinate, get the time covered.
` java.util.List<Dimension>` `getDomain()`
Get the list of dimensions used by any of the Axes in the Coordinate System.
` CoordinateAxis1D` `getEnsembleAxis()`
Get the ensemble axis.
` 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.
` java.lang.String` `getName()`
The name of the Grid Coordinate System, consisting of the list of coordinate axes, seperated by blanks.
` ProjectionImpl` `getProjection()`
Get the Projection that performs the transform math.
` ProjectionCT` `getProjectionCT()`
Get the Projection CoordinateTransform.
` java.util.List<Range>` `getRangesFromLatLonRect(LatLonRect llbb)`
Get Index Ranges for the given lat, lon bounding box.
` CoordinateAxis1DTime` `getRunTimeAxis()`
Get the RunTime axis.
` CoordinateAxis` `getTimeAxis()`
Get the Time axis, if it exists.
` CoordinateAxis1DTime` `getTimeAxis1D()`
Get the Time axis, if it exists, and its 1-dimensional.
` CoordinateAxis1DTime` `getTimeAxisForRun(int run_index)`
This is the case of a 2D time axis, which depends on the run index.
` CoordinateAxis1D` `getVerticalAxis()`
Get the Z axis.
` VerticalCT` `getVerticalCT()`
Get the Vertical CoordinateTransform, it it exists.
` VerticalTransform` `getVerticalTransform()`
Get the VerticalTransform that performs the transform math.
` CoordinateAxis` `getXHorizAxis()`
Get the X axis.
` CoordinateAxis` `getYHorizAxis()`
Get the Y axis.
` boolean` `hasTimeAxis()`
True if there is a Time Axis.
` boolean` `hasTimeAxis1D()`
True if there is a Time Axis and it is 1D.
` boolean` `isLatLon()`
Does this use lat/lon horizontal axes? If not, then the horizontal axes are GeoX, GeoY, and there must be a Projection defined.
` boolean` `isProductSet()`
True if all axes are 1 dimensional.
` boolean` `isRegularSpatial()`
True if both X and Y axes are 1 dimensional and are regularly spaced.
` boolean` `isZPositive()`
True if increasing z coordinate values means "up" in altitude

Method Detail

### getName

`java.lang.String getName()`
The name of the Grid Coordinate System, consisting of the list of coordinate axes, seperated by blanks.

Returns:
name of the Grid Coordinate System

### getDomain

`java.util.List<Dimension> getDomain()`
Get the list of dimensions used by any of the Axes in the Coordinate System.

Returns:
List of Dimension

### getCoordinateAxes

`java.util.List<CoordinateAxis> getCoordinateAxes()`
Get the list of all axes.

Returns:
List of CoordinateAxis.

### isProductSet

`boolean isProductSet()`
True if all axes are 1 dimensional.

Returns:
true if all axes are 1 dimensional.

### getXHorizAxis

`CoordinateAxis getXHorizAxis()`
Get the X axis. May be 1 or 2 dimensional.

Returns:
X CoordinateAxis, may not be null.

### getYHorizAxis

`CoordinateAxis getYHorizAxis()`
Get the Y axis. May be 1 or 2 dimensional.

Returns:
Y CoordinateAxis, may not be null.

### getVerticalAxis

`CoordinateAxis1D getVerticalAxis()`
Get the Z axis. Must be 1 dimensional.

Returns:
Y CoordinateAxis, may be null.

### getTimeAxis

`CoordinateAxis getTimeAxis()`
Get the Time axis, if it exists. May be 1 or 2 dimensional. If 1D, will be a CoordinateAxis1DTime. If 2D, then you can use getTimeAxisForRun(). A time coordinate must be a udunit date or ISO String, so it can always be converted to a Date. Typical meaning is the date of measurement or valid forecast time.

Returns:
the time coordinate axis, may be null.

### getEnsembleAxis

`CoordinateAxis1D getEnsembleAxis()`
Get the ensemble axis. Must be 1 dimensional. Typical meaning is an enumeration of ensemble Model runs.

Returns:
ensemble CoordinateAxis, may be null.

### getRunTimeAxis

`CoordinateAxis1DTime getRunTimeAxis()`
Get the RunTime axis. Must be 1 dimensional. A runtime coordinate must be a udunit date or ISO String, so it can always be converted to a Date. Typical meaning is the date that a Forecast Model Run is made.

Returns:
RunTime CoordinateAxis, may be null.

### getCoordinateTransforms

`java.util.List<CoordinateTransform> getCoordinateTransforms()`
Get the list of all CoordinateTransforms.

Returns:
List of CoordinateTransform.

### getProjectionCT

`ProjectionCT getProjectionCT()`
Get the Projection CoordinateTransform. It must exist if !isLatLon().

Returns:
ProjectionCT or null.

### getProjection

`ProjectionImpl getProjection()`
Get the Projection that performs the transform math. Same as getProjectionCT().getProjection().

Returns:
ProjectionImpl or null.

### getVerticalCT

`VerticalCT getVerticalCT()`
Get the Vertical CoordinateTransform, it it exists.

Returns:
VerticalCT or null.

### getVerticalTransform

`VerticalTransform getVerticalTransform()`
Get the VerticalTransform that performs the transform math. Same as getVerticalCT().getVerticalTransform().

Returns:
VerticalTransform or null.

### isLatLon

`boolean isLatLon()`
Does this use lat/lon horizontal axes? If not, then the horizontal axes are GeoX, GeoY, and there must be a Projection defined.

Returns:
true if lat/lon horizontal axes

### getLatLonBoundingBox

`LatLonRect getLatLonBoundingBox()`
Get horizontal bounding box in lat, lon coordinates. For projection, only an approximation based on corners.

Returns:
LatLonRect bounding box.

### getBoundingBox

`ProjectionRect getBoundingBox()`
Get horizontal bounding box in projection coordinates. For lat/lon, the ProjectionRect has units of degrees north and east.

Returns:
ProjectionRect bounding box.

### isRegularSpatial

`boolean isRegularSpatial()`
True if both X and Y axes are 1 dimensional and are regularly spaced.

Returns:
true if both X and Y axes are 1 dimensional and are regularly spaced.

### getRangesFromLatLonRect

```java.util.List<Range> getRangesFromLatLonRect(LatLonRect llbb)
throws InvalidRangeException```
Get Index Ranges for the given lat, lon bounding box. For projection, only an approximation based on corners. Must have CoordinateAxis1D or 2D for x and y axis.

Parameters:
`llbb` - a lat/lon bounding box.
Returns:
list of 2 Range objects, first y then x.
Throws:
`InvalidRangeException` - if llbb generates bad ranges

### findXYindexFromCoord

```int[] findXYindexFromCoord(double x_coord,
double y_coord,
int[] result)```
Given a point in x,y coordinate space, find the x,y indices.

Parameters:
`x_coord` - position in x coordinate space, ie, units of getXHorizAxis().
`y_coord` - position in y coordinate space, ie, units of getYHorizAxis().
`result` - optionally pass in the result array to use.
Returns:
int[2], 0=x, 1=y indices of the point. These will be -1 if out of range.

### findXYindexFromCoordBounded

```int[] findXYindexFromCoordBounded(double x_coord,
double y_coord,
int[] result)```
Given a point in x,y coordinate space, find the x,y indices. If outside the range, the closest point is returned

Parameters:
`x_coord` - position in x coordinate space, ie, units of getXHorizAxis().
`y_coord` - position in y coordinate space, ie, units of getYHorizAxis().
`result` - optionally pass in the result array to use.
Returns:
int[2], 0=x, 1=y indices of the point.

### findXYindexFromLatLon

```int[] findXYindexFromLatLon(double lat,
double lon,
int[] result)```
Given a lat,lon point, find the x,y index of the containing grid point.

Parameters:
`lat` - latitude position.
`lon` - longitude position.
`result` - put result in here, may be null
Returns:
int[2], 0=x,1=y indices in the coordinate system of the point. These will be -1 if out of range.

### findXYindexFromLatLonBounded

```int[] findXYindexFromLatLonBounded(double lat,
double lon,
int[] result)```
Given a lat,lon point, find the x,y index of the containing grid point. If outside the range, the closest point is returned

Parameters:
`lat` - latitude position.
`lon` - longitude position.
`result` - return result here, may be null
Returns:
int[2], 0=x,1=y indices in the coordinate system of the point.

### getLatLon

```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

### isZPositive

`boolean isZPositive()`
True if increasing z coordinate values means "up" in altitude

Returns:
true if increasing z coordinate values means "up" in altitude

### getDateRange

`DateRange getDateRange()`
If there is a time coordinate, get the time covered.

Returns:
DateRange or null if no time coordinate

### hasTimeAxis

`boolean hasTimeAxis()`
True if there is a Time Axis.

Returns:
true if there is a Time Axis.

### hasTimeAxis1D

`boolean hasTimeAxis1D()`
True if there is a Time Axis and it is 1D.

Returns:
true if there is a Time Axis and it is 1D.

### getTimeAxis1D

`CoordinateAxis1DTime getTimeAxis1D()`
Get the Time axis, if it exists, and its 1-dimensional.

Returns:
the time coordinate axis, may be null.

### getTimeAxisForRun

`CoordinateAxis1DTime getTimeAxisForRun(int run_index)`
This is the case of a 2D time axis, which depends on the run index. A time coordinate must be a udunit date or ISO String, so it can always be converted to a Date.

Parameters:
`run_index` - which run?
Returns:
1D time axis for that run.