Class GCTPStyleProjection
- All Implemented Interfaces:
Cloneable
,ProjectionConstants
- Direct Known Subclasses:
GCTPCStyleProjection
GCTPStyleProjection
class provides various static
constants and functions for classes that perform GCTP style
projection computations. The functions are based directly on those
from the GCTPC package.- Since:
- 3.2.1
- Author:
- Peter Hollemans
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
A useless quirky companion constant to go along with R2D.static final double
Conversion from degrees to radians.protected double
The eccentricity value for the spheroid.protected double
The eccentricity value squared for the spheroid.static final double
The epsilon value for checking if numbers are very close.protected double
The false easting value.protected double
The false northing value.static final double
The value of PI/2.static final double
The value of PI.static final double
Conversion from radians to degrees.protected double
The semi-major axis in meters.static final double
The value of 2 PI.Fields inherited from class noaa.coastwatch.util.trans.MapProjection
datum, DESCRIPTION, forwardAffine, inverseAffine, spheroid, system, zone
Fields inherited from class noaa.coastwatch.util.trans.EarthTransform
boundaryHandler, dims
Fields inherited from interface noaa.coastwatch.util.trans.ProjectionConstants
ALASKA, ALBERS, AZMEQD, EQRECT, EQUIDC, GEO, GNOMON, GOOD, GVNSP, HAMMER, HOM, IMOLL, LAMAZ, LAMCC, MAX_PROJECTIONS, MERCAT, MILLER, MOLL, OBEQA, ORTHO, POLYC, PROJECTION_NAMES, PS, ROBIN, SNSOID, SOM, SPCS, STEREO, TM, USDEF, UTM, VGRINT, WAGIV, WAGVII
-
Constructor Summary
ConstructorDescriptionGCTPStyleProjection
(int system, int zone, double rMajor, double rMinor, int[] dimensions, AffineTransform affine) Creates a GCTP style projection. -
Method Summary
Modifier and TypeMethodDescriptionstatic double
adjust_lon
(double x) Adjusts a longitude angle to be in the range [-180 ..static double
asinz
(double con) Computes asin and eliminates roundoff error.static int
calc_utm_zone
(double lon) Calculates the UTM zone number.static double
e0fn
(double x) Computes the constant e0 which is used in a series for calculating the distance along a meridian.static double
e1fn
(double x) Computes the constant e1 which is used in a series for calculating the distance along a meridian.static double
e2fn
(double x) Computes the constant e2 which is used in a series for calculating the distance along a meridian.static double
e3fn
(double x) Computes the constant e3 which is used in a series for calculating the distance along a meridian.static double
e4fn
(double x) Computes the constant e4 used in the Polar Stereographic projection.static double
mlfn
(double e0, double e1, double e2, double e3, double phi) Computes the value of M which is the distance along a meridian from the Equator to latitude phi.static double
msfnz
(double eccent, double sinphi, double cosphi) Computes the constant small m which is the radius of a parallel of latitude, phi, divided by the semimajor axis.static double
pack_angle
(double angle) Packs an angle in degrees to DDDMMMSSS.SS format.static double
pakcz
(double pak) Converts the 2 digit alternate packed DMS format (+/-)DDDMMSS.SSS to 3 digit standard packed DMS format (+/-)DDDMMMSSS.SSS.static double
pakr2dm
(double pak) Converts radians to 3 digit packed DMS format (+/-)DDDMMMSSS.SSS.static double
phi1z
(double eccent, double qs) Computes the value phi1, the latitude for the inverse of the Albers Conical Equal-Area projection.static double
phi2z
(double eccent, double ts) Computes the latitude angle, phi2, for the inverse of the Lambert Conformal Conic and Polar Stereographic projections.static double
phi3z
(double ml, double e0, double e1, double e2, double e3) Computes the latitude, phi3, for the inverse of the Equidistant Conic projection.static double
phi4z
(double eccent, double e0, double e1, double e2, double e3, double a, double b, double[] c) Computes phi4, the latitude for the inverse of the Polyconic projection.static double
qsfnz
(double eccent, double sinphi, double cosphi) Computes the constant small q which is the radius of a parallel of latitude, phi, divided by the semimajor axis.protected void
Sets the datum for this projection and pre-computes values needed and matching spheroid code.void
setFalse
(double falseEast, double falseNorth) Sets the false east and north values.static int
sign
(double x) Gets the sign of a value.static void
sphdz
(int isph, double[] parm, double[] r_major, double[] r_minor, double[] radius) Gets the semi-major, semi-minor, and radius axes lengths based on the parameters and spheroid code.static double
tsfnz
(double eccent, double phi, double sinphi) Computes the constant small t for use in the forward computations in the Lambert Conformal Conic and the Polar Stereographic projections.static double
unpack_angle
(double angle) Unpacks an angle in DDDMMMSSS.SS format to degrees.Methods inherited from class noaa.coastwatch.util.trans.MapProjection
clone, describe, equals, getAffine, getDatum, getModified, getParameters, getPixelDimensions, getPixelSize, getProjection, getSpheroid, getSpheroidName, getSubset, getSubset, getSystem, getSystemName, getZone, isOrientable, mapTransformFor, mapTransformInv, setAffine, setPositiveLon, transformImpl, transformImpl
Methods inherited from class noaa.coastwatch.util.trans.EarthTransform2D
get2DVersion, getBoundingBox, getWorldAxes, main, setPointTransform, transformToPoint
Methods inherited from class noaa.coastwatch.util.trans.EarthTransform
closest, distance, getBoundaryHandler, getDimensions, getResolution, getSpheroid, getSpheroid, isInvertible, transform, transform, transform, transform
Methods inherited from class noaa.coastwatch.util.MetadataContainer
getMetadataMap
-
Field Details
-
PI
public static final double PIThe value of PI.- See Also:
-
HALF_PI
public static final double HALF_PIThe value of PI/2.- See Also:
-
TWO_PI
public static final double TWO_PIThe value of 2 PI.- See Also:
-
EPSLN
public static final double EPSLNThe epsilon value for checking if numbers are very close.- See Also:
-
R2D
public static final double R2DConversion from radians to degrees.- See Also:
-
C3P
public static final double C3PA useless quirky companion constant to go along with R2D.- See Also:
-
D2R
public static final double D2RConversion from degrees to radians.- See Also:
-
falseEast
protected double falseEastThe false easting value. -
falseNorth
protected double falseNorthThe false northing value. -
ec
protected double ecThe eccentricity value for the spheroid. -
ec2
protected double ec2The eccentricity value squared for the spheroid. -
rMajor
protected double rMajorThe semi-major axis in meters.
-
-
Constructor Details
-
GCTPStyleProjection
public GCTPStyleProjection(int system, int zone, double rMajor, double rMinor, int[] dimensions, AffineTransform affine) throws NoninvertibleTransformException Creates a GCTP style projection.- Parameters:
system
- the map projection system.zone
- the map projection zone for State Plane and UTM projections.rMajor
- the semi-major axis in meters.rMinor
- the semi-minor axis in meters.dimensions
- the dimensions of the data grid as[rows, columns]
.affine
- the affine transform for translating data[row, column]
to map[x, y]
.- Throws:
NoninvertibleTransformException
-
-
Method Details
-
setDatum
Sets the datum for this projection and pre-computes values needed and matching spheroid code.- Parameters:
datum
- the new datum to use.
-
setFalse
public void setFalse(double falseEast, double falseNorth) Sets the false east and north values. By default, these are both set to zero.- Parameters:
falseEast
- the false easting value in meters.falseNorth
- the false northing value in meters.
-
asinz
public static double asinz(double con) Computes asin and eliminates roundoff error.- Parameters:
con
- the value to compute the arc sine for.- Returns:
- the arc sine of the value, in the range of -pi/2 through pi/2.
-
msfnz
public static double msfnz(double eccent, double sinphi, double cosphi) Computes the constant small m which is the radius of a parallel of latitude, phi, divided by the semimajor axis.- Parameters:
eccent
- the spheroid eccentricity.sinphi
- sine of the latitude angle.cosphi
- cosine of the latitude angle.- Returns:
- the value m.
-
qsfnz
public static double qsfnz(double eccent, double sinphi, double cosphi) Computes the constant small q which is the radius of a parallel of latitude, phi, divided by the semimajor axis.- Parameters:
eccent
- the spheroid eccentricity.sinphi
- sine of the latitude angle.cosphi
- cosine of the latitude angle.- Returns:
- the value q.
-
phi1z
public static double phi1z(double eccent, double qs) Computes the value phi1, the latitude for the inverse of the Albers Conical Equal-Area projection.- Parameters:
eccent
- the eccentricity angle in radians.qs
- the angle in radians.- Returns:
- the latitude angle in radians or Double.NaN if the iteration did not converge.
-
phi2z
public static double phi2z(double eccent, double ts) Computes the latitude angle, phi2, for the inverse of the Lambert Conformal Conic and Polar Stereographic projections.- Parameters:
eccent
- the spheroid eccentricity.ts
- the constant value t.- Returns:
- the latitude angle in radians or Double.NaN if the iteration did not converge.
-
phi3z
public static double phi3z(double ml, double e0, double e1, double e2, double e3) Computes the latitude, phi3, for the inverse of the Equidistant Conic projection.- Parameters:
ml
- the constant ml.e0
- the constant e0.e1
- the constant e1.e2
- the constant e2.e3
- the constant e3.- Returns:
- the latitude angle in radians or Double.NaN if the iteration did not converge.
-
phi4z
public static double phi4z(double eccent, double e0, double e1, double e2, double e3, double a, double b, double[] c) Computes phi4, the latitude for the inverse of the Polyconic projection.- Parameters:
eccent
- the eccentricity squared.e0
- the constant e0.e1
- the constant e1.e2
- the constant e0.e3
- the constant e0.a
- the constant e0.b
- the constant e0.c
- the constant c (modified).- Returns:
- the latitude angle in radians or Double.NaN if the iteration did not converge.
-
pakcz
public static double pakcz(double pak) Converts the 2 digit alternate packed DMS format (+/-)DDDMMSS.SSS to 3 digit standard packed DMS format (+/-)DDDMMMSSS.SSS.- Parameters:
pak
- the angle in alternate packed DMS format.- Returns:
- the angle packed in 3 digit format.
-
pakr2dm
public static double pakr2dm(double pak) Converts radians to 3 digit packed DMS format (+/-)DDDMMMSSS.SSS.- Parameters:
pak
- the angle in radians.- Returns:
- the angle packed in 3 digits format.
-
e0fn
public static double e0fn(double x) Computes the constant e0 which is used in a series for calculating the distance along a meridian.- Parameters:
x
- the eccentricity squared.- Returns:
- the constant e0.
-
e1fn
public static double e1fn(double x) Computes the constant e1 which is used in a series for calculating the distance along a meridian.- Parameters:
x
- the eccentricity squared.- Returns:
- the constant e1.
-
e2fn
public static double e2fn(double x) Computes the constant e2 which is used in a series for calculating the distance along a meridian.- Parameters:
x
- the eccentricity squared.- Returns:
- the constant e2.
-
e3fn
public static double e3fn(double x) Computes the constant e3 which is used in a series for calculating the distance along a meridian.- Parameters:
x
- the eccentricity squared.- Returns:
- the constant e3.
-
e4fn
public static double e4fn(double x) Computes the constant e4 used in the Polar Stereographic projection.- Parameters:
x
- the eccentricity.- Returns:
- the constant e4.
-
mlfn
public static double mlfn(double e0, double e1, double e2, double e3, double phi) Computes the value of M which is the distance along a meridian from the Equator to latitude phi.- Parameters:
e0
- the constant e0.e1
- the constant e1.e2
- the constant e0.e3
- the constant e0.phi
- the latitude value in radians.- Returns:
- the distance value M.
-
calc_utm_zone
public static int calc_utm_zone(double lon) Calculates the UTM zone number.- Parameters:
lon
- the longitude in degrees.- Returns:
- the UTM zone number.
-
sign
public static int sign(double x) Gets the sign of a value.- Parameters:
x
- the value to get the sign for.- Returns:
- the sign of the value, -1 if the value is less than zero, or 1 otherwise.
-
tsfnz
public static double tsfnz(double eccent, double phi, double sinphi) Computes the constant small t for use in the forward computations in the Lambert Conformal Conic and the Polar Stereographic projections.- Parameters:
eccent
- the eccentricity of the spheroid.phi
- the latitude phi in radians.sinphi
- the sine of the latitude.- Returns:
- the contant term t.
-
adjust_lon
public static double adjust_lon(double x) Adjusts a longitude angle to be in the range [-180 .. 180] in radians.- Parameters:
x
- the input longitude in radians.- Returns:
- the adjusted longitude in radians.
-
sphdz
public static void sphdz(int isph, double[] parm, double[] r_major, double[] r_minor, double[] radius) Gets the semi-major, semi-minor, and radius axes lengths based on the parameters and spheroid code. The following algorithm is used. If the spheroid code is negative, the first two values in the parameter array
parm
are used to define the values as follows:- If
parm[0]
is a non-zero value andparm[1]
is greater than one, the semimajor axis and radius are set toparm[0]
and the semiminor axis is set toparm[1]
. - If
parm[0]
is nonzero andparm[1]
is greater than zero but less than or equal to one, the semimajor axis and radius are set toparm[0]
and the semiminor axis is computed from the eccentricity squared valueparm[1]
. This algorithm is given below. - If
parm[0]
is nonzero andparm[1]
is equal to zero, the semimajor axis, radius, and semiminor axis are set toparm[0]
. - If
parm[0]
equals zero andparm[1]
is greater than zero, the default Clarke 1866 is used to assign values to the semimajor axis, radius and semiminor axis. - If
parm[0]
andparm[1]
equals zero, the semimajor axis and radius are set to 6370997.0 and the semiminor axis is set to zero.
If a spheroid code is zero or greater, the semimajor and semiminor axis are defined by the spheroid code arrays in the
SpheroidConstants
interface, and the radius is set to 6370997.0. If the spheroid code is greater thanMAX_SPHEROIDS-1
the default spheroid, Clarke 1866, is used to define the semimajor and semiminor axis and radius is set to 6370997.0.The algorithm to define the semiminor axis using the eccentricity squared value is as follows:
semiminor = sqrt(1.0 - ES) * semimajor
where
ES
is the eccentricity squared.- Parameters:
isph
- the spheroid code number.parm
- the projection parameter array.r_major
- the semi-major axis value in meters (modified).r_minor
- the semi-minor axis value in meters (modified).radius
- the radius value in meters (modified).
- If
-
pack_angle
public static double pack_angle(double angle) Packs an angle in degrees to DDDMMMSSS.SS format.- Parameters:
angle
- the angle in degrees.- Returns:
- the packed angle in DDDMMMSSS.SS format.
-
unpack_angle
public static double unpack_angle(double angle) Unpacks an angle in DDDMMMSSS.SS format to degrees.- Parameters:
angle
- the packed angle in DDDMMMSSS.SS format.- Returns:
- the angle in degrees.
-