Package noaa.coastwatch.util.trans
Class EarthTransform2D
java.lang.Object
noaa.coastwatch.util.MetadataContainer
noaa.coastwatch.util.trans.EarthTransform
noaa.coastwatch.util.trans.EarthTransform2D
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
CDMGridMappedProjection
,DataProjection
,GeoVectorProjection
,MapProjection
,SensorScanProjection
,SwathProjection
The
EarthTransform2D
class adds extra functionality to
its super class common to two-dimensional earth transforms. It
also allows the use of a raster-is-point transform mode rather than
the default raster-is-area mode. In raster-is-area mode, the Earth
location returned by EarthTransform.transform(DataLocation,EarthLocation)
refers to the center of the raster pixel area. In raster-is-point
mode, the extra method transformToPoint(noaa.coastwatch.util.DataLocation, noaa.coastwatch.util.EarthLocation)
may be used to
retrieve the earth location of the point data, which may not be at
the center of the raster pixel area.- Since:
- 3.2.0
- Author:
- Peter Hollemans
-
Field Summary
Fields inherited from class noaa.coastwatch.util.trans.EarthTransform
boundaryHandler, dims
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets a version of this transform that can be used with 2D data locations.getBoundingBox
(DataLocation upperLeft, DataLocation lowerRight, int segments) Gets a polygon bounding box for this transform using the specified data coordinate limits.void
getWorldAxes
(EarthLocation earthLoc, double[] northVector, double[] eastVector) Gets the world axes for this transform at the specified location.boolean
Gets the orientation hint.static void
Tests this class.void
setPointTransform
(EarthTransform2D pointTrans) Sets the data to geographic transform used whentransformToPoint(noaa.coastwatch.util.DataLocation, noaa.coastwatch.util.EarthLocation)
is called.transformToPoint
(DataLocation dataLoc, EarthLocation earthLoc) Converts data coordinates to geographic coordinates (raster point mode).Methods inherited from class noaa.coastwatch.util.trans.EarthTransform
clone, closest, describe, distance, getBoundaryHandler, getDatum, getDimensions, getResolution, getSpheroid, getSpheroid, getSubset, isInvertible, transform, transform, transform, transform, transformImpl, transformImpl
Methods inherited from class noaa.coastwatch.util.MetadataContainer
getMetadataMap
-
Constructor Details
-
EarthTransform2D
public EarthTransform2D()
-
-
Method Details
-
get2DVersion
Description copied from class:EarthTransform
Gets a version of this transform that can be used with 2D data locations.- Specified by:
get2DVersion
in classEarthTransform
- Returns:
- the 2D version of this transform.
-
isOrientable
public boolean isOrientable()Gets the orientation hint. If a transform is orientable, then it may be better for the user to have it rotated for display so that northerly locations occur where data locations have smaller row values and southerly locations occur where data locations have larger row values. If a transform is not orientable, then it should be presented to the user exactly as-is.- Returns:
- true if the transform is orientable, or false if not. Unless overridden by the subclass, this method returns true.
- Since:
- 3.3.1
-
setPointTransform
Sets the data to geographic transform used whentransformToPoint(noaa.coastwatch.util.DataLocation, noaa.coastwatch.util.EarthLocation)
is called. This transform is different from the normal 2D transform in that it returns earth locations that correspond to a raster-is-point style model rather than raster-is-area. By default,transformToPoint(noaa.coastwatch.util.DataLocation, noaa.coastwatch.util.EarthLocation)
returns the same value asEarthTransform.transform(DataLocation,EarthLocation)
.- Parameters:
pointTrans
- the point transform to use for raster-is-point coordinate transformations or null to use this transform.
-
getBoundingBox
Gets a polygon bounding box for this transform using the specified data coordinate limits.- Parameters:
upperLeft
- the upper-left corner of the data window.lowerRight
- the lower-right corner of the data window.segments
- the number of segments along each side of the data window.
-
getWorldAxes
Gets the world axes for this transform at the specified location. The world axes are the north-pointing unit vector and east-pointing unit vector in data coordinates.- Parameters:
earthLoc
- the earth location to get the world axes. The location must transform to a valid data location, or the output vectors may contain NaN values.northVector
- the north-pointing vector array of length 2 (modified).eastVector
- the east-pointing vector array of length 2 (modified).- Since:
- 3.3.1
-
transformToPoint
Converts data coordinates to geographic coordinates (raster point mode). By default, this method simply callsEarthTransform.transform(DataLocation,EarthLocation)
if no point transform has been set with a call tosetPointTransform(noaa.coastwatch.util.trans.EarthTransform2D)
. Otherwise, it passes the data location to the stored point transform.- Parameters:
dataLoc
- the data location.earthLoc
- the earth location or null. If null, an object is created and returned. If non-null, the object is simply modified.- Returns:
- the earth location. The earth location may contain
Double.NaN
if no conversion is possible. - See Also:
-
main
Tests this class.- Parameters:
argv
- the array of command line parameters.- Throws:
Exception
-