Single-Precision Coordinate Transform Routines

Fortran version:

FOR: I/O API version 3.2, these are all module routines within MODULE MODGCTP. Note that SETPROJ() is generic, taking either single-precision or double-precision arguments.

NOTES for prior I/O API versions:

LAMBERT() is the main function-body, and the rest except LL2UTM()) and UTM2LL() are all LOGICAL ENTRY into this function, rather than stand-alone subroutines.

For I/O API Version 3.1, explicit INTERFACEs are given in MODULE M3UTILIO, and LL2ALB() and ALB2LL() are the only Albers-projection functions available.

For I/O API versions prior to 3.1, they need explicit EXTERNAL declarations, and the Albers-projection functions are not available.

    LOGICAL FUNCTION LAMBERT( CNAME, A, B, C, XC, YC )
    LOGICAL FUNCTION POLSTE( CNAME, A, B, C, X, Y )
    LOGICAL FUNCTION TRMERC( CNAME, A, B, C, X, Y )
    LOGICAL FUNCTION EQMERC( CNAME, A, B, C, X, Y )
    LOGICAL FUNCTION ALBERS( CNAME, A, B, C, X, Y )

    LOGICAL FUNCTION INITPROJ( CNAME )
    LOGICAL FUNCTION INITPROJ( CNAME, CTYPE, AA, BB, CC, XX, YY )
    LOGICAL FUNCTION INITPROJ( CNAME, CTYPE, DA, DB, DC, DX, DY )

    LOGICAL FUNCTION SETPROJ( CNAME, CTYPE, A, B, C, XC, YC )
    LOGICAL FUNCTION SETPROJ( CNAME, CTYPE, D, E, F, XD, YD )
    LOGICAL FUNCTION SETLAM( A, B, C, X, Y )
    LOGICAL FUNCTION SETPOL( A, B, C, X, Y )
    LOGICAL FUNCTION SETTRM( A, B, C, X, Y )
    LOGICAL FUNCTION SETEQM( A, B, C, X, Y )
    LOGICAL FUNCTION SETALB( A, B, C, X, Y )

    LOGICAL FUNCTION LL2LAM ( X, Y, U, V )
    LOGICAL FUNCTION LL2UTM ( X, Y, Z, U, V )
    LOGICAL FUNCTION LL2POL ( X, Y, U, V )
    LOGICAL FUNCTION LL2TRM ( X, Y, U, V )
    LOGICAL FUNCTION LL2EQM ( X, Y, U, V )
    LOGICAL FUNCTION LL2ALB ( X, Y, U, V )
    LOGICAL FUNCTION LAM2LL ( X, Y, U, V )
    LOGICAL FUNCTION LAM2UTM( X, Y, Z, U, V )
    LOGICAL FUNCTION LAM2POL( X, Y, U, V )
    LOGICAL FUNCTION LAM2TRM( X, Y, U, V )
    LOGICAL FUNCTION LAM2EQM( X, Y, U, V )
    LOGICAL FUNCTION LAM2ALB( X, Y, U, V )
    LOGICAL FUNCTION UTM2LL ( X, Y, Z, U, V )
    LOGICAL FUNCTION UTM2LAM( X, Y, Z, U, V )
    LOGICAL FUNCTION UTM2POL( X, Y, Z, U, V )
    LOGICAL FUNCTION UTM2TRM( X, Y, Z, U, V )
    LOGICAL FUNCTION UTM2EQM( X, Y, Z, U, V )
    LOGICAL FUNCTION UTM2ALB( X, Y, Z, U, V )
    LOGICAL FUNCTION POL2LL ( X, Y, U, V )
    LOGICAL FUNCTION POL2LAM( X, Y, U, V )
    LOGICAL FUNCTION POL2UTM( X, Y, Z, U, V )
    LOGICAL FUNCTION POL2TRM( X, Y, U, V )
    LOGICAL FUNCTION POL2EQM( X, Y, U, V )
    LOGICAL FUNCTION POL2ALB( X, Y, U, V )
    LOGICAL FUNCTION TRM2LL ( X, Y, U, V )
    LOGICAL FUNCTION TRM2LAM( X, Y, U, V )
    LOGICAL FUNCTION TRM2UTM( X, Y, Z, U, V )
    LOGICAL FUNCTION TRM2POL( X, Y, U, V )
    LOGICAL FUNCTION TRM2EQM( X, Y, U, V )
    LOGICAL FUNCTION TRM2ALB( X, Y, U, V )
    LOGICAL FUNCTION EQM2LL ( X, Y, U, V )
    LOGICAL FUNCTION EQM2LAM( X, Y, U, V )
    LOGICAL FUNCTION EQM2UTM( X, Y, Z, U, V )
    LOGICAL FUNCTION EQM2POL( X, Y, U, V )
    LOGICAL FUNCTION EQM2TRM( X, Y, U, V )
    LOGICAL FUNCTION EQM2ALB( X, Y, U, V )
    LOGICAL FUNCTION ALB2LL ( X, Y, U, V )
    LOGICAL FUNCTION ALB2LAM( X, Y, U, V )
    LOGICAL FUNCTION ALB2UTM( X, Y, Z, U, V )
    LOGICAL FUNCTION ALB2POL( X, Y, U, V )
    LOGICAL FUNCTION ALB2TRM( X, Y, U, V )
    LOGICAL FUNCTION ALB2EQM( X, Y, U, V )

    REAL   , INTENT(IN   ) :: A        !  first secant latitude, or P_ALPHA
    REAL   , INTENT(IN   ) :: B        !  second secant latitude  B > A, or P_BETA
    REAL   , INTENT(IN   ) :: C        !  central meridian, or P_GAMMA
    REAL   , INTENT(IN   ) :: XC       !  Longitude of Cartesian origin
    REAL   , INTENT(IN   ) :: YC       !  Latitude  of Cartesian origin
    REAL   , INTENT(IN   ) :: X        !  (Input)  Cartesian easting  in meters or decimal degrees
    REAL   , INTENT(IN   ) :: Y        !  (Input)  Cartesian northing "
    REAL   , INTENT(IN   ) :: U        !  (Output) Cartesian easting  "
    REAL   , INTENT(IN   ) :: V        !  (Output) Cartesian northing "
    REAL*8 , INTENT(IN   ) :: D        !  first secant latitude, or P_ALPHA
    REAL*8 , INTENT(IN   ) :: E        !  second secant latitude  B > A, or P_BETA
    REAL*8 , INTENT(IN   ) :: F        !  central meridian, or P_GAMMA
    REAL*8 , INTENT(IN   ) :: XD       !  Longitude of Cartesian origin
    REAL*8 , INTENT(IN   ) :: YD       !  Latitude  of Cartesian origin
    INTEGER, INTENT(IN   ) :: Z        !  UTM zone (1...36)

    REAL   , INTENT(  OUT) :: AA       !  first secant latitude, or P_ALPHA
    REAL   , INTENT(  OUT) :: BB       !  second secant latitude  B > A, or P_BETA
    REAL   , INTENT(  OUT) :: CC       !  central meridian, or P_GAMMA
    REAL   , INTENT(  OUT) :: XX       !  Longitude of Cartesian origin
    REAL   , INTENT(  OUT) :: YY       !  Latitude  of Cartesian origin
    REAL   , INTENT(  OUT) :: DA       !  first secant latitude, or P_ALPHA
    REAL   , INTENT(  OUT) :: DB       !  second secant latitude  B > A, or P_BETA
    REAL   , INTENT(  OUT) :: DC       !  central meridian, or P_GAMMA
    REAL*8 , INTENT(  OUT) :: DX       !  Longitude of Cartesian origin
    REAL*8 , INTENT(  OUT) :: DY       !  Latitude  of Cartesian origin

Summary:

Note that inputs are 4-byte REAL single precision (unlike the double precision used internally by GCTP). Calculations for which precision is important should use GCTP or MODULE M3GCTP routine XY2XY() directly; further note that by default, LAMBERT() etc., use the GRS 1980 spheroid to represent the surface of the Earth (which may be important to know for high-precision calculations). For use in SMOKE and legacy applications, or where precision is not important. Otherwise use MODULE M3GCTP routine XY2XY()

INITPROJ(), LAMBERT(), POLSTE(), TRMERC(), EQMERC(), and ALBERS() set up USGS National Mapping Division General Cartographic Transformation Package, routine GTPZ0() by map-projection name for particular named Lambert Conformal Conic, Polar Stereographic, Transverse Mercator, Equatorial Mercator, or Albers Equal-Area Conic projections, respectively. If CNAME is the grid name, the subroutine returns the corresponding coordinate system name, and coordinate definition parameters A,B,C,X,Y. (or equivalent REAL*8 projection parameters. The resulting projection will be used by subsequent calls of that type -- e.g., if the projection is Lambert, by LAM2LL(), LL2LAM(),, etc.

SETPROJ(), SETLAM(), SETPOL(), SETTRM(), SETEQM(), and SETALB() set up GTPZ0() according to map-projection parameters supplied as arguments, for anonymous Lambert Conformal Conic, Polar Stereographic, Transverse Mercator, Equatorial Mercator, or Albers Equal-Area Conic projections, respectively. The resulting projection will be used by subsequent calls of that type -- e.g., if the projection is Lambert, by LAM2LL(), LL2LAM(),, etc.

See also:

the usage-manual section on horizontal coordinates and grids for more about I/O API grid and coordinate system conventions.

routines LL2UTM and UTM2LL.
USGS package GCTP
MODULE MODGCTP and its routines GRID2XY() and XY2XY()

Preconditions

For LAMBERT(), POLSTE(), TRMERC(), EQMERC(), or ALBERS(), CNAME must be the name either of a coordinate system or a grid found in file GRIDDESC; furthermore, the projection-type of that coordinate system must be respectively LAMGRD3 (i.e., Lambert Conformal Conic), POLGRD3 (Polar Stereographic), TRMGRD3 (Transverse Mercator), EQMGRD3 (Equatorial Mercator), or ALBGRD3 (Albers Equal-Area Conic) respectively.

You must call LAMBERT() or SETLAM() before calling conversion functions with Lambert input or output coordinates; likewise POLSTE() or SETPOL(), TRMERC() or SETTRM(), EQMERC() or SETEQM(), or ALBERS() or SETALB()before calling coordinate-transform functions for respectively Polar Stereographic, Transverse Mercator, Equatorial Mercator, or Albers Equal-Area Conic.

CNAME has length at most 16.

If named map projections are specified by LAMBERT(), POLSTE(), TRMERC(), EQMERC(), or ALBERS(), then a file with logical name GRIDDESC exists and contains correctly formatted coordinate system descriptions and grid descriptions.

Fortran Usage:

For Fortran-90 declarations and interface checking for I/O API Version 1 or later:
    USE MODGCTP
    
For version 3.1:
    USE M3UTILIO
    
For version 3.0 or earlier. declare explicitly:
    LOGICAL, EXTERNAL :: LAMBERT, LL2LAM, LAM2LL
    [etc...]
    
then:
    ...
    LOGICAL LAMSET, POLSET
    REAL    A, B, C, X, Y
    REAL    XX, YY, UU, VV
    CHARACTER*16    LAMNAME
    ...
    LAMSET = LAMBERT( LAMNAME, A, B, C, X, Y )
    ...
    Y = GETREAL( -90.0, 90.0, Y, 'Enter origin  latitude YCENT' )
    POLSET = SETPOL( A, B, C, X, Y )
    ...
    YY = GETREAL( -9.0E12, 9.0E12, Y, 'Enter input Y coordinate' )
    IF ( LAM2POL( XX, YY, UU, VV ) ) THEN
        WRITE( *, 2( 5X, A, 1PE14.6, A, 1PE14.6, A, / )' )
  &      'Lambert X=', XX, ' :  Y=', YY,  ' (meters)',
  &      'POL     X=', UU, ' :  Y=', VV,  ' (meters)'
       ...
    END IF
    ...
    

(See sample programs LATLON, PRESZ, or UTMTOOL, for usage examples.)


Previous: GCTP

Next: LL2UTM and UTM2LL

Up: Coordinate and Grid Related Routines

To: Models-3/EDSS I/O API: The Help Pages