edu.wisc.ssec.mcidas
Class GRIDnav

java.lang.Object
  extended by edu.wisc.ssec.mcidas.GRIDnav
All Implemented Interfaces:
Serializable

public class GRIDnav
extends Object
implements Serializable

GRIDnav is the class for handling the navigation of McIDAS grids. It is basically a Java version of GRDDEF.FOR.

Author:
Don Murray
See Also:
McIDAS Programmer's Manual, Serialized Form

Field Summary
 int indexCol
          "Column" index in row/column array
 int indexLat
          "Latitude" index in latitude/longitude array
 int indexLon
          "Longitude" index in latitude/longitude array
 int indexRow
          "Row" index in row/column array
 
Constructor Summary
GRIDnav(int[] gridDirBlock)
          Construct a new GRIDnav from a grid directory block
 
Method Summary
 boolean equals(Object obj)
          Determines whether or not the Object in question is the same as this AREAnav.
 int getColumnIndex()
          Get the column index
 int getRowIndex()
          Get the row index
 double getRowOffset()
          Get the row offset for flipped coordinates
 boolean isFlippedRowCoordinates()
          Determine if navigation is using flipped coordinates.
 void setFlipRowCoordinates(int row)
          specify whether the row coordinates are inverted and the row offset.
 void setStart(int startRow, int startColumn)
          define the starting row and column of another coordinate system -- for example (0,0)
 double[][] toLatLon(double[][] rowcol)
          converts from grid coordinates (x,y) or (col, row) to latitude/longitude
 double[][] toRowCol(double[][] latlon)
          toRowCol converts latitude/longitude to grid row/col
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indexRow

public final int indexRow
"Row" index in row/column array

See Also:
Constant Field Values

indexCol

public final int indexCol
"Column" index in row/column array

See Also:
Constant Field Values

indexLat

public final int indexLat
"Latitude" index in latitude/longitude array

See Also:
Constant Field Values

indexLon

public final int indexLon
"Longitude" index in latitude/longitude array

See Also:
Constant Field Values
Constructor Detail

GRIDnav

public GRIDnav(int[] gridDirBlock)
        throws McIDASException
Construct a new GRIDnav from a grid directory block

Parameters:
gridDirBlock - grid header block
Throws:
McIDASException - illegal grid header
Method Detail

toLatLon

public double[][] toLatLon(double[][] rowcol)
converts from grid coordinates (x,y) or (col, row) to latitude/longitude

Parameters:
rowcol - array of row/col pairs. Where rowcol[indexRow][] is a row and rowcol[indexCol][] is a column.
Returns:
latlon[][] array of lat/long pairs. Output array is latlon[indexLat][] of latitudes and latlon[indexLon][] of longitudes.

toRowCol

public double[][] toRowCol(double[][] latlon)
toRowCol converts latitude/longitude to grid row/col

Parameters:
latlon - array of lat/long pairs. Where latlon[indexLat][] are latitudes and latlon[indexLon][] are longitudes.
Returns:
rowcol[][] array of row/col pairs. Where rowcol[indexRow][] is a row and rowcol[indexCol][] is an column. These are in 'grid' coordinates

equals

public boolean equals(Object obj)
Determines whether or not the Object in question is the same as this AREAnav. Right now, this returns false until we can figure out when two navigations are equal. Subclasses could override if desired.

Overrides:
equals in class Object
Parameters:
obj - the AREAnav in question

setStart

public void setStart(int startRow,
                     int startColumn)
define the starting row and column of another coordinate system -- for example (0,0)

Parameters:
startRow - the starting row number in another coordinate system
startColumn - the starting column number in another coordinate system

setFlipRowCoordinates

public void setFlipRowCoordinates(int row)
specify whether the row coordinates are inverted and the row offset.

Parameters:
row - ending row number

isFlippedRowCoordinates

public boolean isFlippedRowCoordinates()
Determine if navigation is using flipped coordinates. This would mean that the start of the coordinate system is in the lower left instead of the upper left.

Returns:
true if using flipped row coordinates, otherwise false

getRowOffset

public double getRowOffset()
Get the row offset for flipped coordinates

Returns:
row offset

getRowIndex

public int getRowIndex()
Get the row index

Returns:
the row index in the returned arrays

getColumnIndex

public int getColumnIndex()
Get the column index

Returns:
the column index in the returned arrays