|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.jgrib.GribRecordGDS
public abstract class GribRecordGDS
A class that represents the grid definition section (GDS) of a GRIB record.
5 Okt 05 - Changed class to become abstract as intended by RDG all common methods between this class and all known subclasses is changed to abstract methods, so it becomes more clear, which methods one should actually implement, when adding support for a new type of GRIB files.
4 Sep 02 - Modified to be implemented using GribGDSFactory class.
This class is used to store the first 32 octets of the GDS, which are common, or similar, in all GDS types. Sometimes names vary slightly in Table D, but functionality is similar, e.g.
Grid type Octet Id
Lat/Lon 7-8 Ni - Number of points along a latitude circle
Lambert 7-8 Nx - Number of points along x-axis
Other times, functionality is different, e.g.
Lat/Lon 18-20 La2 - latitude of grid point
Lambert 18-20 Lov - the orientation of the grid
However, all sets have at least 32 octets. Those 32 are stored here, and the differences are resolved in the child classes, and therefore, all attributes are set from the Child classes.
The names of the attributes are the same JGrib originally used , for simplicity and continuity. The fact that some grids use a different number of octets for doubles is irrelevant, as the conversion is stored, not the octets.
The child classes should call the proper setters and getters.
The class retains every bit of the original functionality, so it can continue to be used in legacy programs (still limited to grid_type 0 and 10).
New users should not create instances of this class directly (in fact, it should be changed to an abstract class - it's on the to do list), but use the GribGDS factory instead, and add new child classes (e.g. GribGDSXxxx) as needed for additional grid_types.
, Capt Richard D. Gonzalez, USAF (Modified original code)
, Peter Gylling
Field Summary | |
---|---|
protected double |
EARTH_RADIUS
Radius of earth used in calculating projections per table 7 - assumes spheroid |
protected double |
grid_dx
x-distance between two grid points can be delta-Lon or delta x. |
protected double |
grid_dy
y-distance of two grid points can be delta-Lat or delta y. |
protected double |
grid_lat1
Latitude of grid start point. |
protected double |
grid_lat2
Latitude of grid end point. |
protected double |
grid_latsp
y-coordinate/latitude of south pole of a rotated lat/lon grid. |
protected double |
grid_lon1
Longitude of grid start point. |
protected double |
grid_lon2
Longitude of grid end point. |
protected double |
grid_lonsp
x-coordinate/longitude of south pole of a rotated lat/lon grid. |
protected int |
grid_mode
Mode of grid (See table 7) only 128 supported == increments given) |
protected int |
grid_nx
Number of grid columns. |
protected int |
grid_ny
Number of grid rows. |
protected double |
grid_rotang
Rotation angle of rotated lat/lon grid. |
protected int |
grid_scan
Scanning mode (See table 8). |
protected int |
grid_type
Type of grid (See table 6) |
protected int |
length
Length in bytes of this section. |
Constructor Summary | |
---|---|
GribRecordGDS(BitInputStream in)
Deprecated. - Call GribGDSFactory.getGDS() |
|
GribRecordGDS(int[] header)
New constructor created for child classes, which has to be public! |
Method Summary | |
---|---|
abstract int |
compare(GribRecordGDS gds)
rdg - added this method to be used in a comparator for sorting while extracting records. |
abstract boolean |
equals(java.lang.Object obj)
Overrides Object.equals() - perfect for testing |
abstract double[] |
getGridCoords()
Get grid coordinates in longitude/latitude |
abstract double |
getGridDX()
Get x-increment/distance between two grid points. |
abstract double |
getGridDY()
Get y-increment/distance between two grid points. |
abstract double |
getGridLat1()
Get y-coordinate/latitude of grid start point. |
double |
getGridLat2()
NOTE: This method must remain here, so we don't break backward compability - thus this method does not make any sence if the grid type isn't standard lat/lon or rotated lat/lon Get y-coordinate/latitude of grid end point. |
double |
getGridLatSP()
NOTE: This method must remain here, so we don't break backward compability - thus this method does not make any sence if the grid type isn't standard lat/lon or rotated lat/lon Get y-coordinate/latitude of south pole of a rotated latitude/longitude grid. |
abstract double |
getGridLon1()
Get x-coordinate/longitude of grid start point. |
double |
getGridLon2()
NOTE: This method must remain here, so we don't break backward compability - thus this method does not make any sence if the grid type isn't standard lat/lon or rotated lat/lon Get x-coordinate/longitude of grid end point. |
double |
getGridLonSP()
NOTE: This method must remain here, so we don't break backward compability - thus this method does not make any sence if the grid type isn't standard lat/lon or rotated lat/lon Get x-coordinate/longitude of south pole of a rotated latitude/longitude grid. |
abstract int |
getGridMode()
Get grid mode. |
abstract int |
getGridNX()
Get number of grid columns. |
abstract int |
getGridNY()
Get number of grid rows. |
double |
getGridRotAngle()
NOTE: This method must remain here, so we don't break backward compability - thus this method does not make any sence if the grid type isn't standard lat/lon or rotated lat/lon Get grid rotation angle of a rotated latitude/longitude grid. |
abstract int |
getGridScanmode()
Get scan mode (sign of increments). |
abstract int |
getGridType()
Get type of grid. |
abstract int |
getLength()
Get length in bytes of this section. |
abstract double[] |
getXCoords()
Get all longitide coordinates |
abstract double[] |
getYCoords()
Get all latitude coordinates |
abstract int |
hashCode()
Overrides Object.hashCode() to be used in hashTables |
abstract boolean |
isUVEastNorth()
Table J.Resolution and Component Flags, bit 5 (from left) = 2^(8-5) = 8 = 0x08 : false = u and v components are relative to east, north true = u and v components are relative to grid x,y direction (i,j) |
abstract java.lang.String |
toString()
Get a string representation of this GDS. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final double EARTH_RADIUS
protected int length
protected int grid_type
protected int grid_nx
protected int grid_ny
protected double grid_lat1
protected double grid_lon1
protected int grid_mode
protected double grid_lat2
protected double grid_lon2
protected double grid_dx
protected double grid_dy
protected int grid_scan
protected double grid_latsp
protected double grid_lonsp
protected double grid_rotang
Constructor Detail |
---|
public GribRecordGDS(int[] header)
header
- - integer array of header data (octets 1-6) read in
GribGDSFactory
exceptions are thrown in children and passed upGribGDSFactory.getGDS(BitInputStream)
public GribRecordGDS(BitInputStream in) throws java.io.IOException, NoValidGribException
in
- bit input stream with GDS content
java.io.IOException
- if stream can not be opened etc.
NoValidGribException
- if stream contains no valid GRIB fileGribGDSFactory.getGDS(BitInputStream)
Method Detail |
---|
public abstract int getLength()
public abstract int getGridType()
public abstract int getGridNX()
public abstract int getGridNY()
public abstract double getGridLat1()
public abstract double getGridLon1()
public abstract int getGridMode()
public abstract double getGridDX()
public abstract double getGridDY()
public abstract int getGridScanmode()
public abstract double[] getXCoords()
public abstract double[] getYCoords()
public abstract double[] getGridCoords()
public abstract boolean isUVEastNorth()
public abstract int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public abstract boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public abstract int compare(GribRecordGDS gds)
gds
- - GribRecordGDS
Comparator.compare(java.lang.Object, java.lang.Object)
public abstract java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public double getGridLat2()
public double getGridLon2()
public double getGridLatSP()
public double getGridLonSP()
public double getGridRotAngle()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |