OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
ephem.f
Go to the documentation of this file.
1  SUBROUTINE ephem(ISUN,IMOON,ISRP,T,ES,EM)
2 C VERSION OF 1/31/87
3 C PURPOSE
4 C COMPUTES THE ORBITAL ELEMENTS OF A SUN AND/OR A MOON
5 C INPUT ARGUMENTS
6 C ISUN = SEE SUBROUTINE ASAP
7 C IMOON = SEE SUBROUTINE ASAP
8 C ISRP = SEE SUBROUTINE ASAP
9 C T = CURRENT JULIAN TIME (SEC)
10 C ES(3) = INCLINATION OF THE SUN (RAD)
11 C OUTPUT ARGUMENTS
12 C ES(6) = MEAN ANOMALY OF THE SUN AT T (RAD)
13 C ES(7) = MEAN MOTION OF THE SUN (RAD/SEC)
14 C EM = SEVEN ORBITAL ELEMENTS OF THE MOON AT T IN EARTH MEAN
15 C EQUATOR AND EQUINOX OF EPOCH
16 C (1) = SEMI-MAJOR AXIS (KM)
17 C (2) = ECCENTRICITY
18 C (3) = INCLINATION (RAD)
19 C (4) = LONGITUDE OF ASCENDING NODE (RAD)
20 C (5) = ARGUMENT OF PERIAPSIS (RAD)
21 C (6) = MEAN ANOMALY AT T (RAD)
22 C (7) = MEAN MOTION (RAD/SEC)
23 C CALL SUBROUTINES
24 C NONE
25 C REFERENCES
26 C JPL EM 312/87-153, 20 APRIL 1987
27 C EXPLANATORY SUPPLEMENT TO THE ASTRONOMICAL EPHEMERIS AND THE
28 C AMERICAN EPHEMERIS AND NAUTICAL ALMANAC
29 C ANALYSIS
30 C JOHNNY H. KWOK - JPL
31 C PROGRAMMER
32 C JOHNNY H. KWOK - JPL
33 C MODIFICATIONS
34 C NONE
35 C COMMENTS
36 C FOR MERCURY, VENUS, AND MARS, THERE IS NO LUNI-PERTURBATION, USER
37 C SHOULD INPUT THE SUN'S ORBITAL ELEMENTS RELATIVE TO PLANET EQUATOR
38 C OF EPOCH. THE INERTIAL X-AXIS COULD BE PLANET EQUINOX OR THE
39 C DIRECTION OF THE PRIME MERIDIAN AT SOME EPOCH SUCH AS DEFINED BY
40 C THE IAU. FOR EARTH, THE ORBITAL ELEMENTS OF THE MOON VARIES TOO
41 C MUCH TO USE TWO-BODY EPHEMERIS. USER MAY USE THE MEAN LUNAR
42 C EPHEMERIS BUILT INTO THE PROGRAM. THE SHORT PERIOD VARIATIONS OF
43 C THE MOON MAY INTRODUCE AN ERROR UP TO TWO DEGREES. AS FOR THE SUN,
44 C THE MEAN ORBITAL ELEMENTS OF THE SUN RELATIVE TO EARTH EQUATOR AND
45 C EQUINOX ARE BUILT IN ALSO. BUT SINCE THEY DON'T CHANGE AS RAPIDLY
46 C AS THOSE OF THE MOON, THEY ARE INITIALIZE ELSEWHERE AND THEN HELD
47 C FIXED FOR THE DURATION OF THE TRAJECTORY PROPAGATION
48 C
49  IMPLICIT DOUBLE PRECISION (a-h,o-z)
50  dimension es(7),em(7)
51  DATA rjd/2.41502d6/
52  DATA pi,tpi/3.141592653589793d0,6.283185307179586d0/
53  DATA ans,anm/1.720196977d-2,.22997150294101d0/
54  DATA dts/8.64d4/
55  dt=t/dts-rjd
56  dt1=dt*1.d-4
57  dt2=dt1*dt1
58  dt3=dt1*dt2
59 C
60 C SUN RELATIVE TO EARTH IN MEAN EQUATOR OF DATE
61 C
62  IF (isun.EQ.1.OR.isrp.EQ.1) THEN
63  es(6)=dmod(6.256583575d0+ans*dt
64  1 -1.9548d-7*dt2-1.22d-9*dt3,tpi)
65  es(7)=ans/dts
66  ENDIF
67 C
68 C MOON IN EARTH MEAN EQUINOX OF DATE
69 C
70  IF (imoon.EQ.1) THEN
71  em(1)=3.844d5
72  em(2)=5.4900489d-2
73  em(3)=8.980410805d-2
74  em(4)=4.523601515d0-9.242202942d-4*dt+2.71748d-6*dt2+8.73d-10*dt3
75  em(5)=5.835151539d0+1.944368001d-3*dt-1.35071d-5*dt2-4.538d-9*dt3
76  1 -em(4)
77  em(6)=4.719966572d0+anm*dt-1.4835d-6*dt2
78  1 +6.80678d-10*dt3-em(4)-em(5)
79  DO 130 i=4,6
80  130 em(i)=dmod(em(i),tpi)
81  em(7)=anm/dts
82 C
83 C CONVERT TO EARTH MEAN EQUATOR OF DATE
84 C
85  se=dsin(es(3))
86  ce=dcos(es(3))
87  si=dsin(em(3))
88  ci=dcos(em(3))
89  so=dsin(em(4))
90  co=dcos(em(4))
91  ca=si*se*co-ce*ci
92  alpha=dacos(ca)
93  em(3)=pi-alpha
94  sa=dsin(alpha)
95  sw=so*si/sa
96  sd=so*se/sa
97  sso=dsign(1.d0,so)
98  swso=sw*so*sso
99  cwso=(sw*ce*co+sd*ci)*sso
100  em(4)=datan2(swso,cwso)
101  sdso=sd*so*sso
102  cdso=(sd*co*ci+sw*ce)*sso
103  del=datan2(sdso,cdso)
104  em(5)=em(5)+del
105  ENDIF
106  RETURN
107  END
subroutine ephem(ISUN, IMOON, ISRP, T, ES, EM)
Definition: ephem.f:2
#define pi
Definition: vincenty.c:23