forked from erget/wgrib2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
movect.f
executable file
·72 lines (72 loc) · 2.78 KB
/
movect.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
C-----------------------------------------------------------------------
SUBROUTINE MOVECT(FLAT,FLON,TLAT,TLON,CROT,SROT)
C$$$ SUBPROGRAM DOCUMENTATION BLOCK
C
C SUBPROGRAM: MOVECT MOVE A VECTOR ALONG A GREAT CIRCLE
C PRGMMR: IREDELL ORG: W/NMC23 DATE: 96-04-10
C
C ABSTRACT: THIS SUBPROGRAM PROVIDES THE ROTATION PARAMETERS
C TO MOVE A VECTOR ALONG A GREAT CIRCLE FROM ONE
C POSITION TO ANOTHER WHILE CONSERVING ITS ORIENTATION
C WITH RESPECT TO THE GREAT CIRCLE. THESE ROTATION
C PARAMETERS ARE USEFUL FOR VECTOR INTERPOLATION.
C
C PROGRAM HISTORY LOG:
C 96-04-10 IREDELL
C 1999-04-08 IREDELL GENERALIZE PRECISION
C
C USAGE: CALL MOVECT(FLAT,FLON,TLAT,TLON,CROT,SROT)
C
C INPUT ARGUMENT LIST:
C FLAT - REAL LATITUDE IN DEGREES FROM WHICH TO MOVE THE VECTOR
C FLON - REAL LONGITUDE IN DEGREES FROM WHICH TO MOVE THE VECTOR
C TLAT - REAL LATITUDE IN DEGREES TO WHICH TO MOVE THE VECTOR
C TLON - REAL LONGITUDE IN DEGREES TO WHICH TO MOVE THE VECTOR
C
C OUTPUT ARGUMENT LIST:
C CROT - REAL CLOCKWISE VECTOR ROTATION COSINE
C SROT - REAL CLOCKWISE VECTOR ROTATION SINE
C (UTO=CROT*UFROM-SROT*VFROM;
C VTO=SROT*UFROM+CROT*VFROM)
C
C REMARKS: THIS SUBPROGRAM IS CORRECT TO SEVEN DIGITS ON THE CRAYS.
C USE DOUBLE PRECISION IF BETTER PRECISION IS REQUIRED.
C
C ATTRIBUTES:
C LANGUAGE: FORTRAN 90
C
C$$$
INTEGER,PARAMETER:: KD=SELECTED_REAL_KIND(15,45)
REAL(KIND=KD):: PI,DPR,CRDLIM
REAL(KIND=KD):: CTLAT,STLAT,CFLAT,SFLAT,CDLON,SDLON,CRD
REAL(KIND=KD):: SRD2RN,STR,CTR,SFR,CFR
PARAMETER(PI=3.14159265358979,DPR=180./PI)
PARAMETER(CRDLIM=0.9999999)
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C COMPUTE COSINE OF THE RADIAL DISTANCE BETWEEN THE POINTS.
CTLAT=COS(TLAT/DPR)
STLAT=SIN(TLAT/DPR)
CFLAT=COS(FLAT/DPR)
SFLAT=SIN(FLAT/DPR)
CDLON=COS((FLON-TLON)/DPR)
SDLON=SIN((FLON-TLON)/DPR)
CRD=STLAT*SFLAT+CTLAT*CFLAT*CDLON
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C COMPUTE ROTATIONS AT BOTH POINTS WITH RESPECT TO THE GREAT CIRCLE
C AND COMBINE THEM TO GIVE THE TOTAL VECTOR ROTATION PARAMETERS.
IF(ABS(CRD).LE.CRDLIM) THEN
SRD2RN=-1/(1-CRD**2)
STR=CFLAT*SDLON
CTR=CFLAT*STLAT*CDLON-SFLAT*CTLAT
SFR=CTLAT*SDLON
CFR=CTLAT*SFLAT*CDLON-STLAT*CFLAT
CROT=SRD2RN*(CTR*CFR-STR*SFR)
SROT=SRD2RN*(CTR*SFR+STR*CFR)
C USE A DIFFERENT APPROXIMATION FOR NEARLY COINCIDENT POINTS.
C MOVING VECTORS TO ANTIPODAL POINTS IS AMBIGUOUS ANYWAY.
ELSE
CROT=CDLON
SROT=SDLON*STLAT
ENDIF
C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
END