6.1.1 User Defined Functions

An original transformation can be defined by the user when the following entries are provided.

STFUSR(UX,UY,XX,YY) The forward transformation
STIUSR(XX,XY,UX,UY) The inverse transformation
STSUSR Initialization of functions


The entries for forward and inverse transformation are called from the subroutine STFTRN, which is a subroutine of STFTRF. The values of UX, UY handed over to STFUSR, are values that have been processed by STFRAD ¤È STFROT. Enlargement and parallel transformation is performed by STFTRN, so only the other basic transformation functions need to be set for these functions. Although settings exist for both forward and inverse transformation functions, only the entry statement for the inverse function is necessary if inverse transformation is not performed.

The STSUSR is called from the SGSTRF, which conforms the transformation function. For this entry, the functions of STPACK performed by SGSTRF must normally be initialized. The functions for initialization are STSTRF, STSTRN, STSRAD, and STSROT (in map projection).

The following program defines a log-log coordinate for common logarithm.




*--------------------------------------------------------------

*     USER SUPPLIED FUNCTION

*--------------------------------------------------------------

      SUBROUTINE STFUSR(UX, UY, XX, YY)



      XX = LOG(UX)

      YY = LOG(UY)



      RETURN

*--------------------------------------------------------------

      ENTRY STIUSR(XX, YY, UX, UY)



      UX = EXP(XX)

      UY = EXP(YY)



      RETURN

      END

*--------------------------------------------------------------

      SUBROUTINE STSUSR



      CALL SGQVPT(VXMIN, VXMAX, VYMIN, VYMAX)

      CALL SGQWND(UXMIN, UXMAX, UYMIN, UYMAX)



      CX = (VXMAX-VXMIN)/LOG(UXMAX/UXMIN)

      CY = (VYMAX-VYMIN)/LOG(UYMAX/UYMIN)



      VX0 = VXMIN - CX*LOG(UXMIN)

      VY0 = VYMIN - CY*LOG(UYMIN)



      CALL STSTRF(.FALSE.)

      CALL STSRAD(.FALSE., .FALSE.)

      CALL STSTRN(99, CX, CY, VX0, VY0)



      END


The following program uses the MPFMWL/MPIMWL in MATH1/MAPLIB to define a pseudo-Mollweide map projection function.


*---------------------------------------------------------------

*     USER SUPPLIED FUNCTION

*---------------------------------------------------------------

      SUBROUTINE STFUSR(UX, UY, XX, YY)



      CALL MPFMWL(UX, UY, XX, YY) 

      RETURN 

*---------------------------------------------------------------

      ENTRY STIUSR(XX, YY, UX, UY) 



      CALL MPIMWL(XX, YY, UX, UY) 



      RETURN 

      END 

*---------------------------------------------------------------

      SUBROUTINE STSUSR 

      LOGICAL LDEG 



      CALL SGQVPT(VXMIN, VXMAX, VYMIN, VYMAX) 

      CALL SGQSIM(SIMFAC, XOFF, YOFF) 

      CALL SGQMPL(PLX, PLY, PLROT) 

      CALL SGLGET('LDEG', LDEG) 



      IF(LDEG) THEN 

        CP = RFPI()/180 

      ELSE 

        CP = 1 

      ENDIF 



      CALL SGRGET('TXMIN', TXMIN) 

      CALL SGRGET('TXMAX', TXMAX) 

      CALL SGRGET('TYMIN', TYMIN) 

      CALL SGRGET('TYMAX', TYMAX) 

      CALL SZSCLX(CP*TXMIN, CP*TXMAX) 

      CALL SZSCLY(CP*TYMIN, CP*TYMAX) 



      VX0 = (VXMAX+VXMIN)/2 + XOFF 

      VY0 = (VYMAX+VYMIN)/2 + YOFF 



      CALL STSTRF(.TRUE.) 

      CALL STSRAD(LDEG, LDEG) 

      CALL STSROT(RFPI()/2-CP*PLY, CP*PLX, CP*PLROT) 

      CALL STSTRN(99, SIMFAC, SIMFAC, VX0, VY0) 



      END