lunation 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +18 -0
- data/CHANGELOG.md +8 -0
- data/config/periodic_terms_earth_nutation.yml +63 -567
- data/config/periodic_terms_moon_latitude.yml +60 -300
- data/config/periodic_terms_moon_longitude_distance.yml +60 -360
- data/lib/lunation/calculation/angle.rb +9 -6
- data/lib/lunation/calculation/earth_position_vsop87.rb +1 -1
- data/lib/lunation/calculation/moon_illuminated_fraction.rb +3 -2
- data/lib/lunation/calculation/moon_position.rb +47 -45
- data/lib/lunation/calculation/nutation_and_obliquity.rb +17 -17
- data/lib/lunation/calculation/sun_position.rb +6 -3
- data/lib/lunation/calculation/timekeeping.rb +14 -13
- data/lib/lunation/calculation.rb +5 -1
- data/lib/lunation/version.rb +1 -1
- metadata +3 -3
@@ -1,360 +1,60 @@
|
|
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
|
-
- moon_mean_elongation: 0
|
62
|
-
sun_mean_anomaly: 1
|
63
|
-
moon_mean_anomaly: -1
|
64
|
-
moon_argument_of_latitude: 0
|
65
|
-
sine_coefficient: -40923
|
66
|
-
cosine_coefficient: -129620
|
67
|
-
- moon_mean_elongation: 1
|
68
|
-
sun_mean_anomaly: 0
|
69
|
-
moon_mean_anomaly: 0
|
70
|
-
moon_argument_of_latitude: 0
|
71
|
-
sine_coefficient: -34720
|
72
|
-
cosine_coefficient: 108743
|
73
|
-
- moon_mean_elongation: 0
|
74
|
-
sun_mean_anomaly: 1
|
75
|
-
moon_mean_anomaly: 1
|
76
|
-
moon_argument_of_latitude: 0
|
77
|
-
sine_coefficient: -30383
|
78
|
-
cosine_coefficient: 104755
|
79
|
-
- moon_mean_elongation: 2
|
80
|
-
sun_mean_anomaly: 0
|
81
|
-
moon_mean_anomaly: 0
|
82
|
-
moon_argument_of_latitude: -2
|
83
|
-
sine_coefficient: 15327
|
84
|
-
cosine_coefficient: 10321
|
85
|
-
- moon_mean_elongation: 0
|
86
|
-
sun_mean_anomaly: 0
|
87
|
-
moon_mean_anomaly: 1
|
88
|
-
moon_argument_of_latitude: 2
|
89
|
-
sine_coefficient: -12528
|
90
|
-
cosine_coefficient: null
|
91
|
-
- moon_mean_elongation: 0
|
92
|
-
sun_mean_anomaly: 0
|
93
|
-
moon_mean_anomaly: 1
|
94
|
-
moon_argument_of_latitude: -2
|
95
|
-
sine_coefficient: 10980
|
96
|
-
cosine_coefficient: 79661
|
97
|
-
- moon_mean_elongation: 4
|
98
|
-
sun_mean_anomaly: 0
|
99
|
-
moon_mean_anomaly: -1
|
100
|
-
moon_argument_of_latitude: 0
|
101
|
-
sine_coefficient: 10675
|
102
|
-
cosine_coefficient: -34782
|
103
|
-
- moon_mean_elongation: 0
|
104
|
-
sun_mean_anomaly: 0
|
105
|
-
moon_mean_anomaly: 3
|
106
|
-
moon_argument_of_latitude: 0
|
107
|
-
sine_coefficient: 10034
|
108
|
-
cosine_coefficient: -23210
|
109
|
-
- moon_mean_elongation: 4
|
110
|
-
sun_mean_anomaly: 0
|
111
|
-
moon_mean_anomaly: -2
|
112
|
-
moon_argument_of_latitude: 0
|
113
|
-
sine_coefficient: 8548
|
114
|
-
cosine_coefficient: -21636
|
115
|
-
- moon_mean_elongation: 2
|
116
|
-
sun_mean_anomaly: 1
|
117
|
-
moon_mean_anomaly: -1
|
118
|
-
moon_argument_of_latitude: 0
|
119
|
-
sine_coefficient: -7888
|
120
|
-
cosine_coefficient: 24208
|
121
|
-
- moon_mean_elongation: 2
|
122
|
-
sun_mean_anomaly: 1
|
123
|
-
moon_mean_anomaly: 0
|
124
|
-
moon_argument_of_latitude: 0
|
125
|
-
sine_coefficient: -6766
|
126
|
-
cosine_coefficient: 30824
|
127
|
-
- moon_mean_elongation: 1
|
128
|
-
sun_mean_anomaly: 0
|
129
|
-
moon_mean_anomaly: -1
|
130
|
-
moon_argument_of_latitude: 0
|
131
|
-
sine_coefficient: -5163
|
132
|
-
cosine_coefficient: -8379
|
133
|
-
- moon_mean_elongation: 1
|
134
|
-
sun_mean_anomaly: 1
|
135
|
-
moon_mean_anomaly: 0
|
136
|
-
moon_argument_of_latitude: 0
|
137
|
-
sine_coefficient: 4987
|
138
|
-
cosine_coefficient: -16675
|
139
|
-
- moon_mean_elongation: 2
|
140
|
-
sun_mean_anomaly: -1
|
141
|
-
moon_mean_anomaly: 1
|
142
|
-
moon_argument_of_latitude: 0
|
143
|
-
sine_coefficient: 4036
|
144
|
-
cosine_coefficient: -12831
|
145
|
-
- moon_mean_elongation: 2
|
146
|
-
sun_mean_anomaly: 0
|
147
|
-
moon_mean_anomaly: 2
|
148
|
-
moon_argument_of_latitude: 0
|
149
|
-
sine_coefficient: 3994
|
150
|
-
cosine_coefficient: -10445
|
151
|
-
- moon_mean_elongation: 4
|
152
|
-
sun_mean_anomaly: 0
|
153
|
-
moon_mean_anomaly: 0
|
154
|
-
moon_argument_of_latitude: 0
|
155
|
-
sine_coefficient: 3861
|
156
|
-
cosine_coefficient: -11650
|
157
|
-
- moon_mean_elongation: 2
|
158
|
-
sun_mean_anomaly: 0
|
159
|
-
moon_mean_anomaly: -3
|
160
|
-
moon_argument_of_latitude: 0
|
161
|
-
sine_coefficient: 3665
|
162
|
-
cosine_coefficient: 14403
|
163
|
-
- moon_mean_elongation: 0
|
164
|
-
sun_mean_anomaly: 1
|
165
|
-
moon_mean_anomaly: -2
|
166
|
-
moon_argument_of_latitude: 0
|
167
|
-
sine_coefficient: -2689
|
168
|
-
cosine_coefficient: -7003
|
169
|
-
- moon_mean_elongation: 2
|
170
|
-
sun_mean_anomaly: 0
|
171
|
-
moon_mean_anomaly: -1
|
172
|
-
moon_argument_of_latitude: 2
|
173
|
-
sine_coefficient: -2602
|
174
|
-
cosine_coefficient: null
|
175
|
-
- moon_mean_elongation: 2
|
176
|
-
sun_mean_anomaly: -1
|
177
|
-
moon_mean_anomaly: -2
|
178
|
-
moon_argument_of_latitude: 0
|
179
|
-
sine_coefficient: 2390
|
180
|
-
cosine_coefficient: 10056
|
181
|
-
- moon_mean_elongation: 1
|
182
|
-
sun_mean_anomaly: 0
|
183
|
-
moon_mean_anomaly: 1
|
184
|
-
moon_argument_of_latitude: 0
|
185
|
-
sine_coefficient: -2348
|
186
|
-
cosine_coefficient: 6322
|
187
|
-
- moon_mean_elongation: 2
|
188
|
-
sun_mean_anomaly: -2
|
189
|
-
moon_mean_anomaly: 0
|
190
|
-
moon_argument_of_latitude: 0
|
191
|
-
sine_coefficient: 2236
|
192
|
-
cosine_coefficient: -9884
|
193
|
-
- moon_mean_elongation: 0
|
194
|
-
sun_mean_anomaly: 1
|
195
|
-
moon_mean_anomaly: 2
|
196
|
-
moon_argument_of_latitude: 0
|
197
|
-
sine_coefficient: -2120
|
198
|
-
cosine_coefficient: 5751
|
199
|
-
- moon_mean_elongation: 0
|
200
|
-
sun_mean_anomaly: 2
|
201
|
-
moon_mean_anomaly: 0
|
202
|
-
moon_argument_of_latitude: 0
|
203
|
-
sine_coefficient: -2069
|
204
|
-
cosine_coefficient: null
|
205
|
-
- moon_mean_elongation: 2
|
206
|
-
sun_mean_anomaly: -2
|
207
|
-
moon_mean_anomaly: -1
|
208
|
-
moon_argument_of_latitude: 0
|
209
|
-
sine_coefficient: 2048
|
210
|
-
cosine_coefficient: -4950
|
211
|
-
- moon_mean_elongation: 2
|
212
|
-
sun_mean_anomaly: 0
|
213
|
-
moon_mean_anomaly: 1
|
214
|
-
moon_argument_of_latitude: -2
|
215
|
-
sine_coefficient: -1773
|
216
|
-
cosine_coefficient: 4130
|
217
|
-
- moon_mean_elongation: 2
|
218
|
-
sun_mean_anomaly: 0
|
219
|
-
moon_mean_anomaly: 0
|
220
|
-
moon_argument_of_latitude: 2
|
221
|
-
sine_coefficient: -1595
|
222
|
-
cosine_coefficient: null
|
223
|
-
- moon_mean_elongation: 4
|
224
|
-
sun_mean_anomaly: -1
|
225
|
-
moon_mean_anomaly: -1
|
226
|
-
moon_argument_of_latitude: 0
|
227
|
-
sine_coefficient: 1215
|
228
|
-
cosine_coefficient: -3958
|
229
|
-
- moon_mean_elongation: 0
|
230
|
-
sun_mean_anomaly: 0
|
231
|
-
moon_mean_anomaly: 2
|
232
|
-
moon_argument_of_latitude: 2
|
233
|
-
sine_coefficient: -1110
|
234
|
-
cosine_coefficient: null
|
235
|
-
- moon_mean_elongation: 3
|
236
|
-
sun_mean_anomaly: 0
|
237
|
-
moon_mean_anomaly: -1
|
238
|
-
moon_argument_of_latitude: 0
|
239
|
-
sine_coefficient: -892
|
240
|
-
cosine_coefficient: 3258
|
241
|
-
- moon_mean_elongation: 2
|
242
|
-
sun_mean_anomaly: 1
|
243
|
-
moon_mean_anomaly: 1
|
244
|
-
moon_argument_of_latitude: 0
|
245
|
-
sine_coefficient: -810
|
246
|
-
cosine_coefficient: 2616
|
247
|
-
- moon_mean_elongation: 4
|
248
|
-
sun_mean_anomaly: -1
|
249
|
-
moon_mean_anomaly: -2
|
250
|
-
moon_argument_of_latitude: 0
|
251
|
-
sine_coefficient: 759
|
252
|
-
cosine_coefficient: -1897
|
253
|
-
- moon_mean_elongation: 0
|
254
|
-
sun_mean_anomaly: 2
|
255
|
-
moon_mean_anomaly: -1
|
256
|
-
moon_argument_of_latitude: 0
|
257
|
-
sine_coefficient: -713
|
258
|
-
cosine_coefficient: -2117
|
259
|
-
- moon_mean_elongation: 2
|
260
|
-
sun_mean_anomaly: 2
|
261
|
-
moon_mean_anomaly: -1
|
262
|
-
moon_argument_of_latitude: 0
|
263
|
-
sine_coefficient: -700
|
264
|
-
cosine_coefficient: 2354
|
265
|
-
- moon_mean_elongation: 2
|
266
|
-
sun_mean_anomaly: 1
|
267
|
-
moon_mean_anomaly: -2
|
268
|
-
moon_argument_of_latitude: 0
|
269
|
-
sine_coefficient: 691
|
270
|
-
cosine_coefficient: null
|
271
|
-
- moon_mean_elongation: 2
|
272
|
-
sun_mean_anomaly: -1
|
273
|
-
moon_mean_anomaly: 0
|
274
|
-
moon_argument_of_latitude: -2
|
275
|
-
sine_coefficient: 596
|
276
|
-
cosine_coefficient: null
|
277
|
-
- moon_mean_elongation: 4
|
278
|
-
sun_mean_anomaly: 0
|
279
|
-
moon_mean_anomaly: 1
|
280
|
-
moon_argument_of_latitude: 0
|
281
|
-
sine_coefficient: 549
|
282
|
-
cosine_coefficient: -1423
|
283
|
-
- moon_mean_elongation: 0
|
284
|
-
sun_mean_anomaly: 0
|
285
|
-
moon_mean_anomaly: 4
|
286
|
-
moon_argument_of_latitude: 0
|
287
|
-
sine_coefficient: 537
|
288
|
-
cosine_coefficient: -1117
|
289
|
-
- moon_mean_elongation: 4
|
290
|
-
sun_mean_anomaly: -1
|
291
|
-
moon_mean_anomaly: 0
|
292
|
-
moon_argument_of_latitude: 0
|
293
|
-
sine_coefficient: 520
|
294
|
-
cosine_coefficient: -1571
|
295
|
-
- moon_mean_elongation: 1
|
296
|
-
sun_mean_anomaly: 0
|
297
|
-
moon_mean_anomaly: -2
|
298
|
-
moon_argument_of_latitude: 0
|
299
|
-
sine_coefficient: -487
|
300
|
-
cosine_coefficient: -1739
|
301
|
-
- moon_mean_elongation: 2
|
302
|
-
sun_mean_anomaly: 1
|
303
|
-
moon_mean_anomaly: 0
|
304
|
-
moon_argument_of_latitude: -2
|
305
|
-
sine_coefficient: -399
|
306
|
-
cosine_coefficient: null
|
307
|
-
- moon_mean_elongation: 0
|
308
|
-
sun_mean_anomaly: 0
|
309
|
-
moon_mean_anomaly: 2
|
310
|
-
moon_argument_of_latitude: -2
|
311
|
-
sine_coefficient: -381
|
312
|
-
cosine_coefficient: -4421
|
313
|
-
- moon_mean_elongation: 1
|
314
|
-
sun_mean_anomaly: 1
|
315
|
-
moon_mean_anomaly: 1
|
316
|
-
moon_argument_of_latitude: 0
|
317
|
-
sine_coefficient: 351
|
318
|
-
cosine_coefficient: null
|
319
|
-
- moon_mean_elongation: 3
|
320
|
-
sun_mean_anomaly: 0
|
321
|
-
moon_mean_anomaly: -2
|
322
|
-
moon_argument_of_latitude: 0
|
323
|
-
sine_coefficient: -340
|
324
|
-
cosine_coefficient: null
|
325
|
-
- moon_mean_elongation: 4
|
326
|
-
sun_mean_anomaly: 0
|
327
|
-
moon_mean_anomaly: -3
|
328
|
-
moon_argument_of_latitude: 0
|
329
|
-
sine_coefficient: 330
|
330
|
-
cosine_coefficient: null
|
331
|
-
- moon_mean_elongation: 2
|
332
|
-
sun_mean_anomaly: -1
|
333
|
-
moon_mean_anomaly: 2
|
334
|
-
moon_argument_of_latitude: 0
|
335
|
-
sine_coefficient: 327
|
336
|
-
cosine_coefficient: null
|
337
|
-
- moon_mean_elongation: 0
|
338
|
-
sun_mean_anomaly: 2
|
339
|
-
moon_mean_anomaly: 1
|
340
|
-
moon_argument_of_latitude: 0
|
341
|
-
sine_coefficient: -323
|
342
|
-
cosine_coefficient: 1165
|
343
|
-
- moon_mean_elongation: 1
|
344
|
-
sun_mean_anomaly: 1
|
345
|
-
moon_mean_anomaly: -1
|
346
|
-
moon_argument_of_latitude: 0
|
347
|
-
sine_coefficient: 299
|
348
|
-
cosine_coefficient: null
|
349
|
-
- moon_mean_elongation: 2
|
350
|
-
sun_mean_anomaly: 0
|
351
|
-
moon_mean_anomaly: 3
|
352
|
-
moon_argument_of_latitude: 0
|
353
|
-
sine_coefficient: 294
|
354
|
-
cosine_coefficient: null
|
355
|
-
- moon_mean_elongation: 2
|
356
|
-
sun_mean_anomaly: 0
|
357
|
-
moon_mean_anomaly: -1
|
358
|
-
moon_argument_of_latitude: -2
|
359
|
-
sine_coefficient: null
|
360
|
-
cosine_coefficient: 8752
|
1
|
+
- [0, 0, 1, 0, 6288774, -20905355]
|
2
|
+
- [2, 0, -1, 0, 1274027, -3699111]
|
3
|
+
- [2, 0, 0, 0, 658314, -2955968]
|
4
|
+
- [0, 0, 2, 0, 213618, -569925]
|
5
|
+
- [0, 1, 0, 0, -185116, 48888]
|
6
|
+
- [0, 0, 0, 2, -114332, -3149]
|
7
|
+
- [2, 0, -2, 0, 58793, 246158]
|
8
|
+
- [2, -1, -1, 0, 57066, -152138]
|
9
|
+
- [2, 0, 1, 0, 53322, -170733]
|
10
|
+
- [2, -1, 0, 0, 45758, -204586]
|
11
|
+
- [0, 1, -1, 0, -40923, -129620]
|
12
|
+
- [1, 0, 0, 0, -34720, 108743]
|
13
|
+
- [0, 1, 1, 0, -30383, 104755]
|
14
|
+
- [2, 0, 0, -2, 15327, 10321]
|
15
|
+
- [0, 0, 1, 2, -12528, null]
|
16
|
+
- [0, 0, 1, -2, 10980, 79661]
|
17
|
+
- [4, 0, -1, 0, 10675, -34782]
|
18
|
+
- [0, 0, 3, 0, 10034, -23210]
|
19
|
+
- [4, 0, -2, 0, 8548, -21636]
|
20
|
+
- [2, 1, -1, 0, -7888, 24208]
|
21
|
+
- [2, 1, 0, 0, -6766, 30824]
|
22
|
+
- [1, 0, -1, 0, -5163, -8379]
|
23
|
+
- [1, 1, 0, 0, 4987, -16675]
|
24
|
+
- [2, -1, 1, 0, 4036, -12831]
|
25
|
+
- [2, 0, 2, 0, 3994, -10445]
|
26
|
+
- [4, 0, 0, 0, 3861, -11650]
|
27
|
+
- [2, 0, -3, 0, 3665, 14403]
|
28
|
+
- [0, 1, -2, 0, -2689, -7003]
|
29
|
+
- [2, 0, -1, 2, -2602, null]
|
30
|
+
- [2, -1, -2, 0, 2390, 10056]
|
31
|
+
- [1, 0, 1, 0, -2348, 6322]
|
32
|
+
- [2, -2, 0, 0, 2236, -9884]
|
33
|
+
- [0, 1, 2, 0, -2120, 5751]
|
34
|
+
- [0, 2, 0, 0, -2069, null]
|
35
|
+
- [2, -2, -1, 0, 2048, -4950]
|
36
|
+
- [2, 0, 1, -2, -1773, 4130]
|
37
|
+
- [2, 0, 0, 2, -1595, null]
|
38
|
+
- [4, -1, -1, 0, 1215, -3958]
|
39
|
+
- [0, 0, 2, 2, -1110, null]
|
40
|
+
- [3, 0, -1, 0, -892, 3258]
|
41
|
+
- [2, 1, 1, 0, -810, 2616]
|
42
|
+
- [4, -1, -2, 0, 759, -1897]
|
43
|
+
- [0, 2, -1, 0, -713, -2117]
|
44
|
+
- [2, 2, -1, 0, -700, 2354]
|
45
|
+
- [2, 1, -2, 0, 691, null]
|
46
|
+
- [2, -1, 0, -2, 596, null]
|
47
|
+
- [4, 0, 1, 0, 549, -1423]
|
48
|
+
- [0, 0, 4, 0, 537, -1117]
|
49
|
+
- [4, -1, 0, 0, 520, -1571]
|
50
|
+
- [1, 0, -2, 0, -487, -1739]
|
51
|
+
- [2, 1, 0, -2, -399, null]
|
52
|
+
- [0, 0, 2, -2, -381, -4421]
|
53
|
+
- [1, 1, 1, 0, 351, null]
|
54
|
+
- [3, 0, -2, 0, -340, null]
|
55
|
+
- [4, 0, -3, 0, 330, null]
|
56
|
+
- [2, -1, 2, 0, 327, null]
|
57
|
+
- [0, 2, 1, 0, -323, 1165]
|
58
|
+
- [1, 1, -1, 0, 299, null]
|
59
|
+
- [2, 0, 3, 0, 294, null]
|
60
|
+
- [2, 0, -1, -2, null, 8752]
|
@@ -40,7 +40,7 @@ module Lunation
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def decimal_hours
|
43
|
-
@decimal_hours ||= decimal_degrees
|
43
|
+
@decimal_hours ||= decimal_degrees.fdiv(15)
|
44
44
|
end
|
45
45
|
|
46
46
|
def decimal_minutes
|
@@ -95,7 +95,9 @@ module Lunation
|
|
95
95
|
|
96
96
|
def from_decimal_degrees(decimal_degrees, normalize: true)
|
97
97
|
new(
|
98
|
-
decimal_degrees: (
|
98
|
+
decimal_degrees: (
|
99
|
+
normalize ? decimal_degrees % 360 : decimal_degrees
|
100
|
+
).round(9),
|
99
101
|
radians: decimal_degrees_to_radians(decimal_degrees, normalize: normalize)
|
100
102
|
)
|
101
103
|
end
|
@@ -149,7 +151,8 @@ module Lunation
|
|
149
151
|
end
|
150
152
|
|
151
153
|
private def decimal_degrees_to_radians(decimal_degrees, normalize: true)
|
152
|
-
result = (normalize ? decimal_degrees % 360 : decimal_degrees) *
|
154
|
+
result = (normalize ? decimal_degrees % 360 : decimal_degrees) *
|
155
|
+
Math::PI / 180.0
|
153
156
|
result.round(9)
|
154
157
|
end
|
155
158
|
|
@@ -159,7 +162,7 @@ module Lunation
|
|
159
162
|
decimal_arcseconds,
|
160
163
|
normalize: true
|
161
164
|
)
|
162
|
-
result = degrees + arcminutes
|
165
|
+
result = degrees + arcminutes.fdiv(60) + decimal_arcseconds.fdiv(3600)
|
163
166
|
(normalize ? result % 360 : result).round(9)
|
164
167
|
end
|
165
168
|
|
@@ -169,7 +172,7 @@ module Lunation
|
|
169
172
|
decimal_seconds,
|
170
173
|
normalize: true
|
171
174
|
)
|
172
|
-
result = hours * 15.0 + minutes
|
175
|
+
result = hours * 15.0 + minutes.fdiv(4.0) + decimal_seconds.fdiv(240.0)
|
173
176
|
(normalize ? result % 360 : result).round(9)
|
174
177
|
end
|
175
178
|
|
@@ -177,7 +180,7 @@ module Lunation
|
|
177
180
|
decimal_arcseconds,
|
178
181
|
normalize: true
|
179
182
|
)
|
180
|
-
result = decimal_arcseconds
|
183
|
+
result = decimal_arcseconds.fdiv(3600.0)
|
181
184
|
(normalize ? result % 360 : result).round(9)
|
182
185
|
end
|
183
186
|
end
|
@@ -58,7 +58,7 @@ module Lunation
|
|
58
58
|
second_series = reduce_periodic_terms(PERIODIC_TERMS_B1)
|
59
59
|
|
60
60
|
Angle.from_radians(
|
61
|
-
(first_series + second_series * time_millennia)
|
61
|
+
(first_series + second_series * time_millennia).fdiv(100_000_000),
|
62
62
|
normalize: false
|
63
63
|
)
|
64
64
|
end
|
@@ -5,14 +5,15 @@ module Lunation
|
|
5
5
|
# UNIT: fraction (decimal)
|
6
6
|
def moon_illuminated_fraction
|
7
7
|
@moon_illuminated_fraction ||=
|
8
|
-
(
|
8
|
+
(1 + moon_phase_angle.cos).fdiv(2).round(4)
|
9
9
|
end
|
10
10
|
|
11
11
|
# (i) phase angle of the moon (48.3, A.A. p. 346)
|
12
12
|
# UNIT: Angle
|
13
13
|
def moon_phase_angle
|
14
14
|
@moon_phase_angle ||= begin
|
15
|
-
numerator = distance_between_earth_and_sun_in_kilometers *
|
15
|
+
numerator = distance_between_earth_and_sun_in_kilometers *
|
16
|
+
moon_elongation_from_sun.sin
|
16
17
|
denominator = distance_between_earth_and_moon -
|
17
18
|
distance_between_earth_and_sun_in_kilometers * moon_elongation_from_sun.cos
|
18
19
|
Angle.from_radians(Math.atan2(numerator, denominator))
|
@@ -4,14 +4,14 @@ module Lunation
|
|
4
4
|
class Calculation
|
5
5
|
module MoonPosition
|
6
6
|
# rubocop:disable Layout/LineLength
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
MOON_MEAN_LONGITUDE_CONSTANTS = [218.3164477, 481_267.88123421, -0.0015786, 1
|
12
|
-
MOON_MEAN_ELONGATION_CONSTANTS = [297.8501921, 445_267.1114034, -0.0018819, 1
|
13
|
-
MOON_MEAN_ANOMALY_CONSTANTS = [134.9633964, 477_198.8675055, 0.0087414, 1
|
14
|
-
MOON_ARGUMENT_OF_LATITUDE_CONSTANTS = [93.2720950, 483_202.0175233, -0.0036539, -1
|
7
|
+
MOON_LONGITUDE_AND_DISTANCE_PERIOD_TERMS_PATH = File.expand_path("../../../config/periodic_terms_moon_longitude_distance.yml", __dir__).freeze
|
8
|
+
MOON_LATITUDE_PERIOD_TERMS_PATH = File.expand_path("../../../config/periodic_terms_moon_latitude.yml", __dir__).freeze
|
9
|
+
MOON_LONGITUDE_AND_DISTANCE_PERIOD_TERMS = YAML.load_file(MOON_LONGITUDE_AND_DISTANCE_PERIOD_TERMS_PATH).freeze
|
10
|
+
MOON_LATITUDE_PERIOD_TERMS = YAML.load_file(MOON_LATITUDE_PERIOD_TERMS_PATH).freeze
|
11
|
+
MOON_MEAN_LONGITUDE_CONSTANTS = [218.3164477, 481_267.88123421, -0.0015786, 1.fdiv(538_841), -1.fdiv(65_194_000)].freeze
|
12
|
+
MOON_MEAN_ELONGATION_CONSTANTS = [297.8501921, 445_267.1114034, -0.0018819, 1.fdiv(545_868), -1.fdiv(113_065_000)].freeze
|
13
|
+
MOON_MEAN_ANOMALY_CONSTANTS = [134.9633964, 477_198.8675055, 0.0087414, 1.fdiv(69_699), -1.fdiv(14_712_000)].freeze
|
14
|
+
MOON_ARGUMENT_OF_LATITUDE_CONSTANTS = [93.2720950, 483_202.0175233, -0.0036539, -1.fdiv(3_526_000), 1.fdiv(863_310_000)].freeze
|
15
15
|
CORRECTION_ECCENTRICITY_OF_EARTH_CONSTANTS = [1, -0.002516, -0.0000074].freeze
|
16
16
|
FIXED_DISTANCE_BETWEEN_EARTH_AND_MOON = 385_000.56
|
17
17
|
RADIUS_OF_EARTH = 6378.14
|
@@ -77,22 +77,22 @@ module Lunation
|
|
77
77
|
# UNIT: decimal degrees
|
78
78
|
def moon_heliocentric_longitude
|
79
79
|
@moon_heliocentric_longitude ||= begin
|
80
|
-
result =
|
80
|
+
result = MOON_LONGITUDE_AND_DISTANCE_PERIOD_TERMS.inject(0.0) do |acc, elem|
|
81
81
|
sine_argument = Angle.from_decimal_degrees(
|
82
|
-
elem[
|
83
|
-
elem[
|
84
|
-
elem[
|
85
|
-
elem[
|
82
|
+
elem[0] * moon_mean_elongation_from_sun_high_precision.decimal_degrees +
|
83
|
+
elem[1] * sun_mean_anomaly2.decimal_degrees +
|
84
|
+
elem[2] * moon_mean_anomaly_high_precision.decimal_degrees +
|
85
|
+
elem[3] * moon_argument_of_latitude_high_precision.decimal_degrees
|
86
86
|
)
|
87
87
|
|
88
|
-
if elem[
|
88
|
+
if elem[4].nil?
|
89
89
|
next acc
|
90
|
-
elsif [1, -1].include?(elem[
|
91
|
-
acc + elem[
|
92
|
-
elsif [-2, 2].include?(elem[
|
93
|
-
acc + elem[
|
90
|
+
elsif [1, -1].include?(elem[1])
|
91
|
+
acc + elem[4] * correction_eccentricity_of_earth * sine_argument.sin
|
92
|
+
elsif [-2, 2].include?(elem[1])
|
93
|
+
acc + elem[4] * correction_eccentricity_of_earth**2 * sine_argument.sin
|
94
94
|
else
|
95
|
-
acc + elem[
|
95
|
+
acc + elem[4] * sine_argument.sin
|
96
96
|
end
|
97
97
|
end + 3958 * correction_venus.sin +
|
98
98
|
1962 * (moon_mean_longitude - moon_argument_of_latitude_high_precision).sin +
|
@@ -105,22 +105,22 @@ module Lunation
|
|
105
105
|
# UNIT: decimal degrees
|
106
106
|
def moon_heliocentric_latitude
|
107
107
|
@moon_heliocentric_latitude ||= begin
|
108
|
-
result =
|
108
|
+
result = MOON_LATITUDE_PERIOD_TERMS.inject(0.0) do |acc, elem|
|
109
109
|
sine_argument = Angle.from_decimal_degrees(
|
110
|
-
elem[
|
111
|
-
elem[
|
112
|
-
elem[
|
113
|
-
elem[
|
110
|
+
elem[0] * moon_mean_elongation_from_sun_high_precision.decimal_degrees +
|
111
|
+
elem[1] * sun_mean_anomaly2.decimal_degrees +
|
112
|
+
elem[2] * moon_mean_anomaly_high_precision.decimal_degrees +
|
113
|
+
elem[3] * moon_argument_of_latitude_high_precision.decimal_degrees
|
114
114
|
)
|
115
115
|
|
116
|
-
if elem[
|
116
|
+
if elem[4].nil?
|
117
117
|
next acc
|
118
|
-
elsif [1, -1].include?(elem[
|
119
|
-
acc + elem[
|
120
|
-
elsif [-2, 2].include?(elem[
|
121
|
-
acc + elem[
|
118
|
+
elsif [1, -1].include?(elem[1])
|
119
|
+
acc + elem[4] * correction_eccentricity_of_earth * sine_argument.sin
|
120
|
+
elsif [-2, 2].include?(elem[1])
|
121
|
+
acc + elem[4] * correction_eccentricity_of_earth**2 * sine_argument.sin
|
122
122
|
else
|
123
|
-
acc + elem[
|
123
|
+
acc + elem[4] * sine_argument.sin
|
124
124
|
end
|
125
125
|
end - 2235 * moon_mean_longitude.sin +
|
126
126
|
382 * correction_latitude.sin +
|
@@ -136,22 +136,22 @@ module Lunation
|
|
136
136
|
# UNIT: 1000 km
|
137
137
|
def moon_heliocentric_distance
|
138
138
|
@moon_heliocentric_distance ||= begin
|
139
|
-
result =
|
139
|
+
result = MOON_LONGITUDE_AND_DISTANCE_PERIOD_TERMS.inject(0.0) do |acc, elem|
|
140
140
|
cosine_argument = Angle.from_decimal_degrees(
|
141
|
-
elem[
|
142
|
-
elem[
|
143
|
-
elem[
|
144
|
-
elem[
|
141
|
+
elem[0] * moon_mean_elongation_from_sun_high_precision.decimal_degrees +
|
142
|
+
elem[1] * sun_mean_anomaly2.decimal_degrees +
|
143
|
+
elem[2] * moon_mean_anomaly_high_precision.decimal_degrees +
|
144
|
+
elem[3] * moon_argument_of_latitude_high_precision.decimal_degrees
|
145
145
|
)
|
146
146
|
|
147
|
-
if elem[
|
147
|
+
if elem[5].nil?
|
148
148
|
next acc
|
149
|
-
elsif [1, -1].include?(elem[
|
150
|
-
acc + elem[
|
151
|
-
elsif [-2, 2].include?(elem[
|
152
|
-
acc + elem[
|
149
|
+
elsif [1, -1].include?(elem[1])
|
150
|
+
acc + elem[5] * correction_eccentricity_of_earth * cosine_argument.cos
|
151
|
+
elsif [-2, 2].include?(elem[1])
|
152
|
+
acc + elem[5] * correction_eccentricity_of_earth**2 * cosine_argument.cos
|
153
153
|
else
|
154
|
-
acc + elem[
|
154
|
+
acc + elem[5] * cosine_argument.cos
|
155
155
|
end
|
156
156
|
end
|
157
157
|
result.round
|
@@ -162,7 +162,8 @@ module Lunation
|
|
162
162
|
# UNIT: Angle
|
163
163
|
def moon_ecliptic_longitude
|
164
164
|
@moon_ecliptic_longitude ||= Angle.from_decimal_degrees(
|
165
|
-
moon_mean_longitude.decimal_degrees +
|
165
|
+
moon_mean_longitude.decimal_degrees +
|
166
|
+
moon_heliocentric_longitude.fdiv(1_000_000)
|
166
167
|
)
|
167
168
|
end
|
168
169
|
|
@@ -170,7 +171,7 @@ module Lunation
|
|
170
171
|
# UNIT: Angle
|
171
172
|
def moon_ecliptic_latitude
|
172
173
|
@moon_ecliptic_latitude ||= Angle.from_decimal_degrees(
|
173
|
-
moon_heliocentric_latitude
|
174
|
+
moon_heliocentric_latitude.fdiv(1_000_000),
|
174
175
|
normalize: false
|
175
176
|
)
|
176
177
|
end
|
@@ -180,7 +181,7 @@ module Lunation
|
|
180
181
|
def distance_between_earth_and_moon
|
181
182
|
@distance_between_earth_and_moon ||= begin
|
182
183
|
result = FIXED_DISTANCE_BETWEEN_EARTH_AND_MOON +
|
183
|
-
(
|
184
|
+
moon_heliocentric_distance.fdiv(1_000)
|
184
185
|
result.round(1)
|
185
186
|
end
|
186
187
|
end
|
@@ -196,7 +197,8 @@ module Lunation
|
|
196
197
|
# (apparent λ) Moon apparent longitude (A.A. p. 343)
|
197
198
|
# UNIT: Angle
|
198
199
|
def moon_apparent_ecliptic_longitude
|
199
|
-
@moon_apparent_ecliptic_longitude ||=
|
200
|
+
@moon_apparent_ecliptic_longitude ||=
|
201
|
+
moon_ecliptic_longitude + nutation_in_longitude
|
200
202
|
end
|
201
203
|
|
202
204
|
# (α) geocentric (apparent) right ascension of the moon (13.3 A.A. p. 93)
|