Package noaa.coastwatch.util.trans
Class GCTPCStyleProjection
java.lang.Object
noaa.coastwatch.util.MetadataContainer
noaa.coastwatch.util.trans.EarthTransform
noaa.coastwatch.util.trans.EarthTransform2D
noaa.coastwatch.util.trans.MapProjection
noaa.coastwatch.util.trans.GCTPStyleProjection
noaa.coastwatch.util.trans.GCTPCStyleProjection
- All Implemented Interfaces:
Cloneable
,ProjectionConstants
- Direct Known Subclasses:
AlaskaConformalProjection
,AlbersConicalEqualAreaProjection
,AzimuthalEquidistantProjection
,EquidistantConicProjection
,EquirectangularProjection
,GeneralVerticalNearsidePerspectiveProjection
,GeographicProjection
,GnomonicProjection
,HammerProjection
,HotineObliqueMercatorProjection
,InterruptedGoodeHomolosineProjection
,InterruptedMollweideProjection
,LambertAzimuthalEqualAreaProjection
,LambertConformalConicProjection
,MercatorProjection
,MillerCylindricalProjection
,MollweideProjection
,OblatedEqualAreaProjection
,OrthographicProjection
,PolarStereographicProjection
,PolyconicProjection
,RobinsonProjection
,SinusoidalProjection
,SpaceObliqueMercatorProjection
,StatePlaneProjection
,StereographicProjection
,TransverseMercatorProjection
,UniversalTransverseMercatorProjection
,VanderGrintenProjection
,WagnerIVProjection
,WagnerVIIProjection
The
GCTPCStyleProjection
class provides method signatures
that correspond directly with the GCTPC code modules for ease of converting
GCTPC code to Java.- Since:
- 3.3.0
- Author:
- Peter Hollemans
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
The indices into return value array for inverse transforms.static final int
The return codes for GCTPC functions.protected double[]
The projection parameters used at initialization.static final int
The indices into return value array for forward transforms.static final int
Fields inherited from class noaa.coastwatch.util.trans.GCTPStyleProjection
C3P, D2R, ec, ec2, EPSLN, falseEast, falseNorth, HALF_PI, PI, R2D, rMajor, TWO_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
ModifierConstructorDescriptionprotected
GCTPCStyleProjection
(int system, int zone, double rMajor, double rMinor, int[] dimensions, AffineTransform affine) Creates a GCTP C style projection. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
cenlat
(double lat) protected void
cenlon
(double lon) protected void
cenlonmer
(double lon) protected static void
protected static void
genrpt_long
(long a, String what) double[]
Gets a set of GCTP-style projection parameters if available.void
mapTransformFor
(double[] lonLat, double[] xy) Performs a forward map transformation from (latitude, longitude) coordinates to map (x, y).void
mapTransformInv
(double[] xy, double[] lonLat) Performs an inverse map transformation from map (x, y) coordinates to (latitude, longitude).protected void
offsetp
(double fe, double fn) protected void
origin
(double lat) protected static void
p_error
(char[] what, char[] where) These are some GCTP error reporting methods that log at the FINER level.protected static void
protected static void
static double
paksz
(double ang, long[] iflg) Converts DMS packed angle into degrees.static double
phi1z
(double eccent, double qs, long[] flag) Convenience function for phi1z.static double
phi2z
(double eccent, double ts, long[] flag) Convenience function for phi2z.static double
phi3z
(double ml, double e0, double e1, double e2, double e3, long[] flag) Convenience function for phi3z.static long
phi4z
(double eccent, double e0, double e1, double e2, double e3, double a, double b, double[] c, double[] phi) Convenience function for phi4z.protected abstract long
projfor
(double lat, double lon, double[] x, double[] y) Performs the actual forward calculation as specified in the GCTP C code.protected abstract long
projinv
(double x, double y, double[] lon, double[] lat) Performs the actual inverse calculation as specified in the GCTP C code.protected static void
These are some GCTP parameter reporting methods that log at the FINE level.protected void
radius
(double r) protected void
radius2
(double rmaj, double rmin) void
setParameters
(double[] parameters) Sets the GCTPC style parameter set.protected static void
protected void
stanparl
(double lat1, double lat2) protected void
stparl1
(double lat) Methods inherited from class noaa.coastwatch.util.trans.GCTPStyleProjection
adjust_lon, asinz, calc_utm_zone, e0fn, e1fn, e2fn, e3fn, e4fn, mlfn, msfnz, pack_angle, pakcz, pakr2dm, phi1z, phi2z, phi3z, phi4z, qsfnz, setDatum, setFalse, sign, sphdz, tsfnz, unpack_angle
Methods inherited from class noaa.coastwatch.util.trans.MapProjection
clone, describe, equals, getAffine, getDatum, getModified, getPixelDimensions, getPixelSize, getProjection, getSpheroid, getSpheroidName, getSubset, getSubset, getSystem, getSystemName, getZone, isOrientable, 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
-
X
public static final int XThe indices into return value array for forward transforms.- See Also:
-
Y
public static final int Y- See Also:
-
LON
public static final int LONThe indices into return value array for inverse transforms.- See Also:
-
LAT
public static final int LAT- See Also:
-
OK
public static final int OKThe return codes for GCTPC functions.- See Also:
-
ERROR
public static final int ERROR- See Also:
-
IN_BREAK
public static final int IN_BREAK- See Also:
-
params
protected double[] paramsThe projection parameters used at initialization.
-
-
Constructor Details
-
GCTPCStyleProjection
protected GCTPCStyleProjection(int system, int zone, double rMajor, double rMinor, int[] dimensions, AffineTransform affine) throws NoninvertibleTransformException Creates a GCTP C 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
-
projfor
protected abstract long projfor(double lat, double lon, double[] x, double[] y) Performs the actual forward calculation as specified in the GCTP C code. This method is as close as possible to the native C function signature.- Parameters:
lat
- the latitude to convert.lon
- the longitude to convert.x
- the map coordinate x value (modified).y
- the map coordinate y value (modified).- Returns:
- OK on success, or not OK on failure.
-
mapTransformFor
public void mapTransformFor(double[] lonLat, double[] xy) Description copied from class:MapProjection
Performs a forward map transformation from (latitude, longitude) coordinates to map (x, y).- Specified by:
mapTransformFor
in classMapProjection
- Parameters:
lonLat
- the longitude and latitude in radians.xy
- the x and y in meters or Double.NaN if the transform could not be computed (modified).
-
projinv
protected abstract long projinv(double x, double y, double[] lon, double[] lat) Performs the actual inverse calculation as specified in the GCTP C code. This method is as close as possible to the native C function signature.- Parameters:
lat
- the latitude to convert.lon
- the longitude to convert.x
- the map coordinate x value (modified).y
- the map coordinate y value (modified).- Returns:
- OK on success, or not OK on failure.
-
mapTransformInv
public void mapTransformInv(double[] xy, double[] lonLat) Description copied from class:MapProjection
Performs an inverse map transformation from map (x, y) coordinates to (latitude, longitude).- Specified by:
mapTransformInv
in classMapProjection
- Parameters:
xy
- the x and y in meters.lonLat
- the longitude and latitude in radians or Double.NaN if the transform could not be computed (modified).
-
sprintf
-
p_error
protected static void p_error(char[] what, char[] where) These are some GCTP error reporting methods that log at the FINER level. Some of the GCTP functions log errors when a coordinate transform fails due to not being on the map. For example a GVNSP coordinate transform logs an error when the (x,y) to (lat,lon) calculation fails because the (x,y) is a space view pixel. In order to keep the coordinate transform code fast when transforming large numbers of possibly invalid coordinates and avoid creating new strings whenever an error is found, we check the logger level first in these method to make sure the creation of a message string is needed. -
p_error
-
p_error
-
ptitle
These are some GCTP parameter reporting methods that log at the FINE level. -
radius
protected void radius(double r) -
radius2
protected void radius2(double rmaj, double rmin) -
cenlon
protected void cenlon(double lon) -
cenlonmer
protected void cenlonmer(double lon) -
cenlat
protected void cenlat(double lat) -
origin
protected void origin(double lat) -
stanparl
protected void stanparl(double lat1, double lat2) -
stparl1
protected void stparl1(double lat) -
offsetp
protected void offsetp(double fe, double fn) -
genrpt
-
genrpt_long
-
setParameters
public void setParameters(double[] parameters) Sets the GCTPC style parameter set. This is the parameter set that will be returned bygetParameters()
.- Parameters:
parameters
- the parameters to set.
-
getParameters
public double[] getParameters()Description copied from class:MapProjection
Gets a set of GCTP-style projection parameters if available.- Overrides:
getParameters
in classMapProjection
- Returns:
- the parameters array.
-
phi1z
public static double phi1z(double eccent, double qs, long[] flag) Convenience function for phi1z. -
phi2z
public static double phi2z(double eccent, double ts, long[] flag) Convenience function for phi2z. -
phi3z
public static double phi3z(double ml, double e0, double e1, double e2, double e3, long[] flag) Convenience function for phi3z. -
phi4z
public static long phi4z(double eccent, double e0, double e1, double e2, double e3, double a, double b, double[] c, double[] phi) Convenience function for phi4z. -
paksz
public static double paksz(double ang, long[] iflg) Converts DMS packed angle into degrees.- Parameters:
ang
- the DMS packed angle.iflg
- the error flag number (modified).- Returns:
- the unpacked angle in degrees.
-