visad.jmet
Class GRIBCoordinateSystem

java.lang.Object
  extended by visad.CoordinateSystem
      extended by visad.georef.NavigatedCoordinateSystem
          extended by visad.georef.MapProjection
              extended by visad.jmet.GRIBCoordinateSystem
All Implemented Interfaces:
Serializable

public class GRIBCoordinateSystem
extends MapProjection

See Also:
Serialized Form

Constructor Summary
GRIBCoordinateSystem(int gridNumber)
          constructor for well-known grid numbers.
GRIBCoordinateSystem(int gridTypeCode, double La1, double Lo1, double DxDy, double lov)
          Constructor for a Polar Stereographic (GRIB type code = 5) with RealTupleType.LatitudeLongitudeTuple as a reference.
GRIBCoordinateSystem(int gridTypeCode, double La1, double Lo1, double DxDy, double Latin1, double Latin2, double Lov)
          Constructor for a Lambert conformal (GRIB type code = 3) with RealTupleType.LatitudeLongitudeTuple as a reference.
GRIBCoordinateSystem(int Ni, int Nj, double La1, double Lo1, double Di, double Dj)
          Constructor for a simple latitude-longitude (GRIB type code = 0) with RealTupleType.LatitudeLongitudeTuple as a reference.
GRIBCoordinateSystem(int gridTypeCode, int Ni, int Nj, double La1, double Lo1, double La2, double Lo2, double Di, double Dj)
          Constructor for a latitude-longitude (GRIB type code = 0) with RealTupleType.LatitudeLongitudeTuple as a reference.
GRIBCoordinateSystem(RealTupleType ref, int gridNumber)
          constructor for well-known grid numbers
GRIBCoordinateSystem(RealTupleType ref, int gridTypeCode, double La1, double Lo1, double DxDy, double lov)
          Constructor for a Polar Stereographic (GRIB type code = 5) with RealTupleType.LatitudeLongitudeTuple as a reference.
GRIBCoordinateSystem(RealTupleType ref, int gridTypeCode, double La1, double Lo1, double DxDy, double Latin1, double Latin2, double Lov)
          Constructor for a Lambert conformal (GRIB type code = 3)
GRIBCoordinateSystem(RealTupleType ref, int gridTypeCode, int Ni, int Nj, double La1, double Lo1, double La2, double Lo2, double Di, double Dj)
          constructor for a latitude-longitude (GRIB type code = 0).
 
Method Summary
 boolean equals(Object cs)
          determine if the Coordinate System in question is an GRIBCoordinateSystem
 double[][] fromReference(double[][] tuples)
          convert from lat,lon to x,y
 double getAspectRatio()
          return the ratio of the grid spacing between rows and columns
 Rectangle2D getDefaultMapArea()
          return the bounding box for this projection
static boolean isGridNumberKnown(int gridNumber)
          find out if the specified grid number (GRIB code) is known
static void main(String[] args)
           
 double[][] toReference(double[][] tuples)
          convert from x,y to lat,lon
 
Methods inherited from class visad.georef.MapProjection
getCenterLatLon, getLatLon, getXIndex, getYIndex, isLatLonOrder, isXYOrder, toString
 
Methods inherited from class visad.georef.NavigatedCoordinateSystem
getLatitudeIndex, getLongitudeIndex
 
Methods inherited from class visad.CoordinateSystem
canConvert, fromReference, fromReference, fromReference, getCoordinateSystemUnits, getDimension, getReference, getReferenceUnits, toReference, toReference, toReference, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinatesFreeUnits, transformCoordinatesFreeUnits
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GRIBCoordinateSystem

public GRIBCoordinateSystem(int gridTypeCode,
                            double La1,
                            double Lo1,
                            double DxDy,
                            double lov)
                     throws VisADException
Constructor for a Polar Stereographic (GRIB type code = 5) with RealTupleType.LatitudeLongitudeTuple as a reference.

Parameters:
gridTypeCode - GRIB-1 grid type
La1 - latitude of first grid point (degrees)
Lo1 - longitude of first grid point (degrees)
DxDy - spacing between grid points at 60N
lov - orientation of the grid (degrees)
Throws:
VisADException - couldn't create the necessary VisAD object

GRIBCoordinateSystem

public GRIBCoordinateSystem(RealTupleType ref,
                            int gridTypeCode,
                            double La1,
                            double Lo1,
                            double DxDy,
                            double lov)
                     throws VisADException
Constructor for a Polar Stereographic (GRIB type code = 5) with RealTupleType.LatitudeLongitudeTuple as a reference.

Parameters:
ref - reference RealTupleType (should be lat/lon)
gridTypeCode - GRIB-1 grid type
La1 - latitude of first grid point (degrees)
Lo1 - longitude of first grid point (degrees)
DxDy - spacing between grid points at 60N
lov - orientation of the grid (degrees)
Throws:
VisADException - couldn't create the necessary VisAD object

GRIBCoordinateSystem

public GRIBCoordinateSystem(RealTupleType ref,
                            int gridTypeCode,
                            double La1,
                            double Lo1,
                            double DxDy,
                            double Latin1,
                            double Latin2,
                            double Lov)
                     throws VisADException
Constructor for a Lambert conformal (GRIB type code = 3)

Parameters:
ref - reference RealTupleType (should be lat/lon)
gridTypeCode - GRIB-1 grid type
La1 - latitude of first grid point (degrees)
Lo1 - longitude of first grid point (degrees)
DxDy - ?
Latin1 - first intersecting latitude (degrees)
Latin2 - second intersecting latitude (degrees)
Lov - orientation of the grid (degrees)
Throws:
VisADException - couldn't create the necessary VisAD object

GRIBCoordinateSystem

public GRIBCoordinateSystem(int gridTypeCode,
                            double La1,
                            double Lo1,
                            double DxDy,
                            double Latin1,
                            double Latin2,
                            double Lov)
                     throws VisADException
Constructor for a Lambert conformal (GRIB type code = 3) with RealTupleType.LatitudeLongitudeTuple as a reference.

Parameters:
gridTypeCode - GRIB-1 grid type
La1 - latitude of first grid point (degrees)
Lo1 - longitude of first grid point (degrees)
DxDy - ?
Latin1 - first intersecting latitude (degrees)
Latin2 - second intersecting latitude (degrees)
Lov - orientation of the grid (degrees)
Throws:
VisADException - couldn't create the necessary VisAD object

GRIBCoordinateSystem

public GRIBCoordinateSystem(int gridTypeCode,
                            int Ni,
                            int Nj,
                            double La1,
                            double Lo1,
                            double La2,
                            double Lo2,
                            double Di,
                            double Dj)
                     throws VisADException
Constructor for a latitude-longitude (GRIB type code = 0) with RealTupleType.LatitudeLongitudeTuple as a reference.

Parameters:
gridTypeCode - GRIB-1 grid type
Ni - number of points (W-E) along a latitude circle
Nj - number of points (N-S) along a longitude circle
La1 - latitude of first grid point (degrees)
Lo1 - longitude of first grid point (degrees)
La2 - latitude of last grid point (degrees)
Lo2 - longitude of last grid point (degrees)
Di - longitudinal direction increment (degrees)
Dj - latitudinal direction increment (degrees)
Throws:
VisADException - couldn't create the necessary VisAD object

GRIBCoordinateSystem

public GRIBCoordinateSystem(RealTupleType ref,
                            int gridTypeCode,
                            int Ni,
                            int Nj,
                            double La1,
                            double Lo1,
                            double La2,
                            double Lo2,
                            double Di,
                            double Dj)
                     throws VisADException
constructor for a latitude-longitude (GRIB type code = 0). Reference should be RealTupleType.LatitudeLongitudeTuple. [this is overloaded to also handle LambertConformal (above, type = 3)]

Parameters:
ref - reference RealTupleType (should be lat/lon)
gridTypeCode - GRIB-1 grid type
Ni - number of points (W-E) along a latitude circle
Nj - number of points (N-S) along a longitude circle
La1 - latitude of first grid point (degrees)
Lo1 - longitude of first grid point (degrees)
La2 - latitude of last grid point (degrees)
Lo2 - longitude of last grid point (degrees)
Di - longitudinal direction increment (degrees)
Dj - latitudinal direction increment (degrees)
Throws:
VisADException - couldn't create the necessary VisAD object When type=3, then the parameters are (see construtor for 3): ref = ref, Ni = Ni, Nj = Nj, La1 = La1, Lo1 = Lo1, La2 = DxDy, Lo2 = Latin1, Di = Latin2, Dj = lov

GRIBCoordinateSystem

public GRIBCoordinateSystem(int Ni,
                            int Nj,
                            double La1,
                            double Lo1,
                            double Di,
                            double Dj)
                     throws VisADException
Constructor for a simple latitude-longitude (GRIB type code = 0) with RealTupleType.LatitudeLongitudeTuple as a reference.

Parameters:
Ni - number of points (W-E) along a latitude circle
Nj - number of points (N-S) along a longitude circle
La1 - latitude of first grid point (degrees)
Lo1 - longitude of first grid point (degrees)
Di - longitudinal direction increment (degrees)
Dj - latitudinal direction increment (degrees)
Throws:
VisADException - couldn't create the necessary VisAD object

GRIBCoordinateSystem

public GRIBCoordinateSystem(int gridNumber)
                     throws VisADException
constructor for well-known grid numbers. Uses RealTupleType.LatitudeLongitudeTuple for a reference.

Parameters:
gridNumber - GRIB grid number
Throws:
VisADException - couldn't create the necessary VisAD object

GRIBCoordinateSystem

public GRIBCoordinateSystem(RealTupleType ref,
                            int gridNumber)
                     throws VisADException
constructor for well-known grid numbers

Parameters:
ref - reference RealTupleType (should be lat/lon)
gridNumber - GRIB grid number
Throws:
VisADException - couldn't create the necessary VisAD object
Method Detail

toReference

public double[][] toReference(double[][] tuples)
                       throws VisADException
convert from x,y to lat,lon

Specified by:
toReference in class CoordinateSystem
Parameters:
tuples - contains the x,y coordinates (grid col, row)
Returns:
tuple of (lat,lon);
Throws:
VisADException - if problem with conversion.

fromReference

public double[][] fromReference(double[][] tuples)
                         throws VisADException
convert from lat,lon to x,y

Specified by:
fromReference in class CoordinateSystem
Parameters:
tuples - contains the lat,lon coordinates
Returns:
array of double values in CoordinateSystem Units.
Throws:
VisADException - if problem with conversion.

equals

public boolean equals(Object cs)
determine if the Coordinate System in question is an GRIBCoordinateSystem

Specified by:
equals in class CoordinateSystem
Parameters:
cs - the object in question.
Returns:
true if and only if this instance equals cs.

getDefaultMapArea

public Rectangle2D getDefaultMapArea()
return the bounding box for this projection

Specified by:
getDefaultMapArea in class MapProjection
Returns:
the bounding box of the MapProjection

getAspectRatio

public double getAspectRatio()
return the ratio of the grid spacing between rows and columns


isGridNumberKnown

public static boolean isGridNumberKnown(int gridNumber)
find out if the specified grid number (GRIB code) is known


main

public static void main(String[] args)