OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
gha2000.py
Go to the documentation of this file.
1 def gha2000(iyr,day):
2  # converted from gha2000.f
3  # This subroutine computes the Greenwich hour angle in degrees for the
4  # input time. It uses the model referenced in The Astronomical Almanac
5  # for 1984, Section S (Supplement) and documented in "Exact
6  # closed-form geolocation algorithm for Earth survey sensors", by
7  # F.S. Patt and W.W. Gregg, Int. Journal of Remote Sensing, 1993.
8  # It includes the correction to mean sideral time for nutation
9  # as well as precession.
10 
11  # Calling Arguments
12 
13  # Name Type I/O Description
14  # iyr I*4 I Year (four digits)
15  # day R*8 I Day (time of day as fraction)
16  # gha R*8 O Greenwich hour angle (degrees)
17 
18 
19  # Subprograms referenced:
20  # JD Computes Julian day from calendar date
21  # EPHPARMS Computes mean solar longitude and anomaly and
22  # mean lunar lontitude and ascending node
23  # NUTATE Compute nutation corrections to lontitude and
24  # obliquity
25  #
26  # Program written by: Frederick S. Patt
27  # General Sciences Corporation
28  # November 2, 1992
29  # Liang Hong, 3/24/2020, array calculation
30 
31  #common /nutcm/dpsi,eps,nutime
32  #common /gconst/pi,radeg,re,rem,f,omf2,omegae
33  #data imon/1/,nutime/-9999/
34  imon = 1
35 
36  import numpy as np
37  from hawknav.jd import jd
38 
39  # Compute days since J2000
40  iday = np.fix(day)
41  fday = day - iday
42  jday = jd(iyr,imon,iday)
43  t = jday - 2451545.5 + fday
44 
45  # Compute Greenwich Mean Sidereal Time (degrees)
46  gmst = 100.4606184 + 0.9856473663*t + 2.908e-13*np.multiply(t,t)
47 
48  # Check if need to compute nutation correction for this day
49  [xls,gs,xlm,omega] = ephparms(t)
50  [dpsi,eps,epsm] = nutate(t,xls,gs,xlm,omega)
51 
52  # Include apparent time correction and time-of-day
53  gha = gmst + np.multiply(dpsi, np.cos(np.deg2rad(eps))) + fday*360.0
54  gha = gha + 360.0
55  gha = np.mod(gha,360)
56 
57  return gha
58 
59 def ephparms(t):
60 
61  # This subroutine computes ephemeris parameters used by other Mission
62  # Operations routines: the solar mean longitude and mean anomaly, and
63  # the lunar mean longitude and mean ascending node. It uses the model
64  # referenced in The Astronomical Almanac for 1984, Section S
65  # (Supplement) and documented and documented in "Exact closed-form
66  # geolocation algorithm for Earth survey sensors", by F.S. Patt and
67  # W.W. Gregg, Int. Journal of Remote Sensing, 1993. These parameters
68  # are used to compute the solar longitude and the nutation in
69  # longitude and obliquity.
70 
71  # Calling Arguments
72 
73  # Name Type I/O Description
74 
75  # t R*8 I Time in days since January 1, 2000 at
76  # 12 hours UT
77  # xls R*8 O Mean solar longitude (degrees)
78  # gs R*8 O Mean solar anomaly (degrees)
79  # xlm R*8 O Mean lunar longitude (degrees)
80  # omega R*8 O Ascending node of mean lunar orbit
81  # (degrees)
82 
83 
84  # Program written by: Frederick S. Patt
85  # General Sciences Corporation
86  # November 2, 1992
87  # Liang Hong, 3/24/2020, array calculation
88 
89  import numpy as np
90 
91  # Sun Mean Longitude
92  xls = 280.46592 + 0.9856473516*t
93  xls = np.mod(xls,360)
94 
95  # Sun Mean Anomaly
96  gs = 357.52772 + 0.9856002831*t
97  gs = np.mod(gs,360)
98 
99  # Moon Mean Longitude
100  xlm = 218.31643 + 13.17639648*t
101  xlm = np.mod(xlm,360)
102 
103  # Ascending Node of Moon's Mean Orbit
104  omega = 125.04452 - 0.0529537648*t
105  omega = np.mod(omega,360)
106 
107  return [xls,gs,xlm,omega]
108 
109 def nutate(t,xls,gs,xlm,omega):
110 
111  # This subroutine computes the nutation in longitude and the obliquity
112  # of the ecliptic corrected for nutation. It uses the model referenced
113  # in The Astronomical Almanac for 1984, Section S (Supplement) and
114  # documented in "Exact closed-form geolocation algorithm for Earth
115  # survey sensors", by F.S. Patt and W.W. Gregg, Int. Journal of
116  # Remote Sensing, 1993. These parameters are used to compute the
117  # apparent time correction to the Greenwich Hour Angle and for the
118  # calculation of the geocentric Sun vector. The input ephemeris
119  # parameters are computed using subroutine ephparms. Terms are
120  # included to 0.1 arcsecond.
121 
122  # Calling Arguments
123 
124  # Name Type I/O Description
125 
126  # t R*8 I Time in days since January 1, 2000 at
127  # 12 hours UT
128  # xls R*8 I Mean solar longitude (degrees)
129  # gs R*8 I Mean solar anomaly (degrees)
130  # xlm R*8 I Mean lunar longitude (degrees)
131  # Omega R*8 I Ascending node of mean lunar orbit
132  # (degrees)
133  # dPsi R*8 O Nutation in longitude (degrees)
134  # Eps R*8 O Obliquity of the Ecliptic (degrees)
135  # (includes nutation in obliquity)
136 
137 
138  # Program written by: Frederick S. Patt
139  # General Sciences Corporation
140  # October 21, 1992
141 
142  # Modification History:
143 
144  import numpy as np
145 
146  xls_rad = np.deg2rad(xls)
147  gs_rad = np.deg2rad(gs)
148  xlm_rad = np.deg2rad(xlm)
149  omega_rad = np.deg2rad(omega)
150 
151  # Nutation in Longitude
152  dpsi = - 17.1996 * np.sin(omega_rad) + 0.2062 * np.sin(2.0*omega_rad) - 1.3187 * np.sin(2.0*xls_rad) + 0.1426 * np.sin(gs_rad) - 0.2274 * np.sin(2.0*xlm_rad)
153 
154  # Mean Obliquity of the Eclipti#
155  epsm = 23.439291 - 3.560e-7*t
156 
157  # Nutation in Obliquity
158  deps = 9.2025 * np.cos(omega_rad) + 0.5736 * np.cos(2.0*xls_rad)
159 
160  # True Obliquity of the Ecliptic
161  eps = epsm + deps/3600.0
162 
163  dpsi = dpsi/3600.0
164 
165  return [dpsi,eps,epsm]
def gha2000(iyr, day)
Definition: gha2000.py:1
def ephparms(t)
Definition: gha2000.py:59
def nutate(t, xls, gs, xlm, omega)
Definition: gha2000.py:109
Definition: jd.py:1