C*************************************************************
C  PROGRAM TO CONVERT OWENS VALLEYWIDE MODEL COORDINATES TO
C  UTM COORDINATES.
C*************************************************************
      PROGRAM MAIN
      IMPLICIT DOUBLE PRECISION (A-Z)
C  READ IN NUMBER OF X,Y PAIRS
      DO 100 J=1,9999
      READ(5,*,END=200) NCOUNT
      WRITE(6,900)
      DO 100 I=1,NCOUNT
C  READ IN MODEL COORDINATES (ROW AND COLUMN)
      READ(5,*)XMOD,YMOD
C  CALCULATE UTM X,Y
      CALL MODUTM(XMOD,YMOD,XUTM,YUTM)
C  PRINT RESULTS
      WRITE(6,901)XMOD,YMOD,XUTM,YUTM
  100 CONTINUE
  200 CONTINUE
C  FORMAT STATEMENTS
  900 FORMAT('  XMODEL    YMODEL      XUTM      YUTM')
  901 FORMAT(2F10.4,2F10.0)
  902 FORMAT(2F10.4,2F15.4)
      STOP
      END
C*************************************************************
C  PROGRAM TO CONVERT OWENS VALLEYWIDE MODEL COORDINATES TO
C  UTM COORDINATES.
C
C  NOTE: THE REQUIRED USE OF DOUBLE PRECISION
C               WRITTEN BY WRDANSKIN@DCASCR
C               LAST REVISION     1/6/87
C
      SUBROUTINE MODUTM(XMOD,YMOD,XUTM,YUTM)
      IMPLICIT DOUBLE PRECISION (A-Z)
C  DEFINE CONSTANTS
      SCALE=2000.*12.*2.54/100.
      THETA=16.96826-90.
      THETA=THETA*0.017453
      XOFF=388774.7
      YOFF=4095402.0
      XCOS=DCOS(THETA)
      XSIN=DSIN(THETA)
C  CALCULATE UTM COORDINATES
      X=XMOD-90.
      Y=YMOD-20.
      X=X*SCALE
      Y=Y*SCALE
      XROT=X*XCOS-Y*XSIN
      YROT=X*XSIN+Y*XCOS
      XUTM=XROT+XOFF
      YUTM=YROT+YOFF
      RETURN
      END
