XY2XY

Fortran version:

"Generic" Fortran-90 routine to do map-projection transforms on arrays of points, with optional SPHER_O, SPHER_I spheroid arguments and optional rank (=0,1,2) for the arrays of points being converted.
    SUBROUTINE XY2XY( GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I,          &
                      GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O,          &
                      XLOC_O, YLOC_O, XLOC_I, YLOC_I )

    SUBROUTINE XY2XY( GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I, SPHER_I, &
                      GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O, SPHER_O, &
                      XLOC_O, YLOC_O, XLOC_I, YLOC_I )

    SUBROUTINE XY2XY( GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I,          &
                      GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O,          &
                      NPTS, XPTS_O, YPTS_O, XPTS_I, YPTS_I )

    SUBROUTINE XY2XY( GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I, SPHER_I, &
                      GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O, SPHER_O, &
                      NPTS, XPTS_O, YPTS_O, XPTS_I, YPTS_I )

    SUBROUTINE XY2XY( GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I,          &
                      GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O,          &
                      NCOLS, NROWS, XGRD_O, YGRD_O, XGRD_I, YGRD_I )

    SUBROUTINE XY2XY( GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I, SPHER_I, &
                      GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O, SPHER_O, &
                      NCOLS, NROWS, XGRD_O, YGRD_O, XGRD_I, YGRD_I )

        INTEGER, INTENT(IN   ) :: GDTYP_I, GDTYP_O
        REAL*8 , INTENT(IN   ) :: P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I
        REAL*8 , INTENT(IN   ) :: P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O
        REAL*8 , INTENT(IN   ) :: SPHER_I, SPHER_O
        REAL*8 , INTENT(IN   ) :: XLOC_O
        REAL*8 , INTENT(IN   ) :: YLOC_O
        REAL*8 , INTENT(  OUT) :: XLOC_I
        REAL*8 , INTENT(  OUT) :: YLOC_I
        REAL*8 , INTENT(IN   ) :: XPTS_O( NPTS )
        REAL*8 , INTENT(IN   ) :: YPTS_O( NPTS )
        REAL*8 , INTENT(  OUT) :: XPTS_I( NPTS )
        REAL*8 , INTENT(  OUT) :: YPTS_I( NPTS )
        REAL*8 , INTENT(IN   ) :: XGRD_O( NCOLS,NROWS )
        REAL*8 , INTENT(IN   ) :: YGRD_O( NCOLS,NROWS )
        REAL*8 , INTENT(  OUT) :: XGRD_I( NCOLS,NROWS )
        REAL*8 , INTENT(  OUT) :: YGRD_I( NCOLS,NROWS )

Summary:

For I/O API Version 3.2 or later, only: generic module-routine CONTAINed in MODULE MODGCTP..

Transform point-locations with (input) GRID_I coordinates into (output) GRID_O coordinates, using USGS GCTP-package routine GTPZ0(). The usual I/O API coordinate-description conventions are used for the GDTYP,P_ALP,P_BET,P_GAM,XCENT,YCENT input and output coordinate description arguments.

Versions without the spheroid arguments use routine INITSPHERES() (controlled by environment variable IOAPI_ISPH) to determine the spheroid used by the map projections; the two-spheroid-argument versions should be used for transformations for which the input map projection uses a different spheroid from the output map projection (in which case, the tramsform must be implemented "behind the scenes" as a two-stage process: first, using the input spheroid, from input-projection coordinates to Lat-Lon; then, using the output spheroid, from Lat-Lon to the output-projection coordinates).

I/O API Version 3.2 after 1/15/2018: Pass-through "missing" input locations (i.e., if arguments X*_0<AMISS3 or Y*_0<AMISS3).

For I/O API Version 3.2 or later, only: generic module-routine CONTAINed in MODULE MODGCTP.

Preconditions

USE MODGCTGP

CALL INITSPHERES() or CALL SETSPHERE() before using.

Fortran Usage:

    ...
    INTEGER     GDTYP_O      !!  parameters for output coordinate system
    REAL*8      P_ALP_O
    REAL*8      P_BET_O
    REAL*8      P_GAM_O
    REAL*8      XCENT_O
    REAL*8      YCENT_O
    INTEGER     NCOLS_O
    INTEGER     NROWS_O
    INTEGER     GDTYP_I      !!  parameters for input grid and coord system
    INTEGER     NCOLS
    INTEGER     NROWS
    INTEGER     NTHIK_I
    REAL*8      P_ALP_I
    REAL*8      P_BET_I
    REAL*8      P_GAM_I
    REAL*8      XCENT_I
    REAL*8      YCENT_I
    ...
    REAL*8  XLOC_I           !!  input point
    REAL*8  YLOC_I
    REAL*8  XLOC_O           !!  output point
    REAL*8  YLOC_O
    ...
    INTEGER NPTS
    REAL*8  XPTS_I( NPTS )   !!  input points
    REAL*8  YPTS_I( NPTS )
    REAL*8  XPTS_O( NPTS )   !!  output points
    REAL*8  YPTS_O( NPTS )
    ...
    REAL*8  XGRD_I( NCOLS,NROWS )   !!  input points
    REAL*8  YGRD_I( NCOLS,NROWS )
    REAL*8  XGRD_O( NCOLS,NROWS )   !!  output points
    REAL*8  YGRD_O( NCOLS,NROWS )
    ...
    CALL XY2XY( GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O,     &
                GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I,     &
               XLOC_I, YLOC_I, XLOC_O, YLOC_O )
    ...
    CALL XY2XY( GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O,     &
                GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I,     &
                NPTS, XPTS_I, YPTS_I, XPTS_O, YPTS_O )
    ...
    CALL XY2XY( GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O,     &
                GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I,     &
                NPTS, XPTS_I, YPTS_I, XPTS_O, YPTS_O )
    ...
    CALL XY2XY( GDTYP_O, P_ALP_O, P_BET_O, P_GAM_O, XCENT_O, YCENT_O,     &
                GDTYP_I, P_ALP_I, P_BET_I, P_GAM_I, XCENT_I, YCENT_I,     &
                NCOLS_I, NROWS_I, XGRD_I, YGRD_I, XGRD_O, YGRD_O )
    ...

See also:

GCTP coordinate transformation routine from USGS

MODULE MODGCTP

GRID2INDX()/PNTS2INDX()/INDXMULT(): Bilinear-interpolation packagee in MODULE MODGCTP

GRID2XY(): Grid-cell-center coordinate transformation routinee in MODULE MODGCTP


Up: MODULE MODGCTP

Up: Coordinate and Grid Related Routines

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