when_exe 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -23
  3. data/lib/when_exe/ephemeris/moon.rb +333 -333
  4. data/lib/when_exe/linkeddata.rb +0 -1
  5. data/lib/when_exe/locales/encoding_conversion.rb +134 -134
  6. data/lib/when_exe/locales/iast.rb +90 -90
  7. data/lib/when_exe/locales/transliteration_table.rb +62 -62
  8. data/lib/when_exe/parts/method_cash.rb +224 -224
  9. data/lib/when_exe/region/chinese/calendars.rb +1016 -1016
  10. data/lib/when_exe/region/geologicalage.rb +1 -1
  11. data/lib/when_exe/region/japanese/calendars.rb +397 -397
  12. data/lib/when_exe/region/japanese/eclipses.rb +1194 -1194
  13. data/lib/when_exe/region/japanese/nihon_shoki.rb +70 -70
  14. data/lib/when_exe/region/korean.rb +384 -384
  15. data/lib/when_exe/region/ryukyu.rb +101 -101
  16. data/lib/when_exe/tmposition.rb +2 -2
  17. data/lib/when_exe/tmreference.rb +3 -3
  18. data/lib/when_exe/version.rb +1 -1
  19. data/test/scripts/geometric_complex.rb +41 -41
  20. data/test/scripts/korea.rb +59 -59
  21. data/test/scripts/thai.rb +36 -36
  22. data/test/test/basictypes.rb +431 -431
  23. data/test/test/calendarnote.rb +86 -86
  24. data/test/test/calendartypes.rb +97 -97
  25. data/test/test/coordinates.rb +397 -397
  26. data/test/test/ephemeris.rb +115 -115
  27. data/test/test/ephemeris/moon.rb +14 -14
  28. data/test/test/ephemeris/planets.rb +14 -14
  29. data/test/test/ephemeris/sun.rb +14 -14
  30. data/test/test/inspect.rb +153 -153
  31. data/test/test/parts.rb +488 -488
  32. data/test/test/region/armenian.rb +20 -20
  33. data/test/test/region/bahai.rb +58 -58
  34. data/test/test/region/balinese.rb +34 -34
  35. data/test/test/region/chinese.rb +229 -229
  36. data/test/test/region/christian.rb +226 -226
  37. data/test/test/region/coptic.rb +27 -27
  38. data/test/test/region/discordian.rb +20 -20
  39. data/test/test/region/french.rb +33 -33
  40. data/test/test/region/geologicalage.rb +17 -17
  41. data/test/test/region/iran.rb +54 -54
  42. data/test/test/region/islamic.rb +54 -54
  43. data/test/test/region/japanese.rb +261 -261
  44. data/test/test/region/jewish.rb +63 -63
  45. data/test/test/region/shire.rb +58 -58
  46. data/test/test/region/swedish.rb +45 -45
  47. data/test/test/region/thai.rb +116 -116
  48. data/test/test/region/tibetan.rb +30 -30
  49. data/test/test/region/vietnamese.rb +102 -102
  50. data/test/test/region/zoroastrian.rb +58 -58
  51. data/test/test/timestandard.rb +81 -81
  52. data/test/test/tmobjects.rb +402 -402
  53. data/test/test/tmreference.rb +157 -157
  54. metadata +4 -88
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b40bf07a801ef6ae19fa3821c5768cda89f95e7e
4
- data.tar.gz: acafb3787334e8a37dca4d7429489b6d390ed17a
3
+ metadata.gz: 998dcc3b7edcecbaf257f25edffa72dd804c81d2
4
+ data.tar.gz: d1ef9fc9d2e5cfa7028686bcf95b1858d0b22377
5
5
  SHA512:
6
- metadata.gz: c4be4641f8831f194acab492a26170ebe4f54fb00f5c98dd1dfc5982f88ea3bea077a6ce5778f5691f02a3b8d95e9538826191ebcd88235490d967a3a6efda44
7
- data.tar.gz: e4d27604acb85c99db321ec99bfc04b456f99656439aecfcd9534e54ae6fb1e6ab844673a2b10d8369a3b0f18968bb9ffc6faa9be1136ffa202d360b559c462f
6
+ metadata.gz: d3edceec6df251506db82ff2369ecf1f2d906a757de0620e9b9f94ae649dfee4fd4fddfee4bc92ffbb7f6078ccea0e894bfe76e18d9cd9c9a7a685324e67b064
7
+ data.tar.gz: f3b89b561f445a9e35789840aed52acf217a78412fded5022dbb6df8687df963df721e60e72c301d210fcfd2f8de155e6db26c20b404cb33b85818750ffd3adb
data/README.md CHANGED
@@ -224,23 +224,24 @@ Example Usage
224
224
  # @prefix xsd: <http://www.w3.org/2001/XMLSchema> .
225
225
  #
226
226
  # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge> a <http://hosi.org/ts/When/TM/OrdinalReferenceSystem>;
227
- # rdfs:member <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::冥王代>,
228
- # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::始生代>,
229
- # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代>,
230
- # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::顕生代> .
227
+ # rdfs:member <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Hadean>,
228
+ # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Archean>,
229
+ # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Proterozoic>,
230
+ # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Phanerozoic> .
231
231
  #
232
- # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::冥王代> a <http://hosi.org/ts/When/TM/OrdinalEra>;
233
- # ts:begin "-4600000000";
234
- # ts:end "-4000000000";
235
- # ts:label <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::冥王代::冥王代> .
232
+ # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Archean> a <http://hosi.org/ts/When/TM/OrdinalEra>;
233
+ # ts:begin "-4000000000";
234
+ # ts:end "-2500000000";
235
+ # ts:label <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Archean::Archean>;
236
+ # rdfs:member <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Archean::Eoarchean>,
237
+ # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Archean::Paleoarchean>,
238
+ # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Archean::Mesoarchean>,
239
+ # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Archean::Neoarchean> .
236
240
  #
237
- # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代> a <http://hosi.org/ts/When/TM/OrdinalEra>;
238
- # ts:begin "-2500000000";
239
- # ts:end "-542000000";
240
- # ts:label <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代::原生代>;
241
- # rdfs:member <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代::前期>,
242
- # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代::中期>,
243
- # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::原生代::後期> .
241
+ # <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Archean::Eoarchean> a <http://hosi.org/ts/When/TM/OrdinalEra>;
242
+ # ts:begin "-4000000000";
243
+ # ts:end "-3600000000";
244
+ # ts:label <http://hosi.org/When/TM/OrdinalReferenceSystem/GeologicalAge::Archean::Eoarchean::Eoarchean> .
244
245
  # <..snip..>
245
246
  end
246
247
 
@@ -249,7 +250,7 @@ Example Usage
249
250
  # https://rubygems.org/gems/sparql is required for this section's operations.
250
251
  # Please install sparql before operation.
251
252
 
252
- require 'sparql'
253
+ require 'sparql/client'
253
254
  PREFIXES = When::Parts::Resource.namespace_prefixes(
254
255
  '_co:Common', '_co:Common?V=0618', '_m:Calendar', '_m:Japanese', '_n:Japanese/Notes')
255
256
 
@@ -301,15 +302,15 @@ Example Usage
301
302
  # Please install google-api-client and add authorization file 'google-api.yaml' before operation.
302
303
 
303
304
  require 'google/api_client'
304
- require "yaml"
305
+ require 'yaml'
305
306
  oauth_yaml = YAML.load_file('google-api.yaml')
306
- client = Google::APIClient.new(:application_name => "when_exe",
307
+ client = Google::APIClient.new(:application_name => 'when_exe',
307
308
  :application_version => When::VERSION)
308
- client.authorization.client_id = oauth_yaml["client_id"]
309
- client.authorization.client_secret = oauth_yaml["client_secret"]
310
- client.authorization.scope = oauth_yaml["scope"]
311
- client.authorization.refresh_token = oauth_yaml["refresh_token"]
312
- client.authorization.access_token = oauth_yaml["access_token"]
309
+ client.authorization.client_id = oauth_yaml['client_id']
310
+ client.authorization.client_secret = oauth_yaml['client_secret']
311
+ client.authorization.scope = oauth_yaml['scope']
312
+ client.authorization.refresh_token = oauth_yaml['refresh_token']
313
+ client.authorization.access_token = oauth_yaml['access_token']
313
314
  service = client.discovered_api('calendar', 'v3')
314
315
  calendar = When::GoogleAPI::Calendar.list(client, service,
315
316
  'en.japanese#holiday@group.v.calendar.google.com')
@@ -1,333 +1,333 @@
1
- # -*- coding: utf-8 -*-
2
- =begin
3
- Copyright (C) 2011-2014 Takashi SUGA
4
-
5
- You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
- =end
7
-
8
- require 'when_exe/ephemeris/sun'
9
- module When
10
- module Ephemeris
11
-
12
- #------------------------------------------
13
- # 月と地球の本影 計算用データ
14
- #------------------------------------------
15
-
16
- # 月の地心黄経
17
- # @private
18
- P0dL =
19
- [[SIN , 93.8 , -1.33 , 0.0040 ],
20
- [SIN , 248.6 , -19.34 , 0.0020 ],
21
- [SIN , 66.0 , 0.2 , 0.0006 ],
22
- [SIN , 249.0 , -19.3 , 0.0006 ]]
23
- # @private
24
- P0L =
25
- [[LIN , 124.8757417 , 4812.6788201 , -1.330000E-7],
26
- [SINL , 338.9158263 , 4771.9886313 , 6.2887 ,+8.99400E-7], # 中心差
27
- [SIN , 107.236832 , -4133.3536154, 1.2740 ,+1.22612E-6], # 出差
28
- [SIN , 51.678963 , 8905.3422467, 0.6583 ,-0.32672E-6], # 二均差
29
- [SIN , 317.831653 , 9543.9772627, 0.2136 ,+1.7988E-6 ], # 中心差 x 2
30
- [SIN , 176.528826 , 359.990504 , 0.1856 ,-1.561E-8 ], # 年差
31
-
32
- [SIN , 292.463 , 9664.0403505, 0.1143 ,-0.6812E-6 ],
33
- [SIN , 86.16 , 638.63475182, 0.0588 ,+2.1256E-6 ],
34
- [SIN , 103.78 , -3773.36305278, 0.0572 ,-1.22769E-6],
35
- [SIN , 30.58 , 13677.331 , 0.0533 ],
36
- [SIN , 124.86 , -8545.352 , 0.0459 ],
37
-
38
- [SIN , 342.38 , 4411.998 , 0.0410 ],
39
- [SIN , 25.83 , 4452.671 , 0.0348 ], # 月角差( 二均差 / 2)
40
- [SIN , 155.45 , 5131.979 , 0.0305 ],
41
- [SIN , 240.79 , 758.698 , 0.0153 ],
42
- [SIN , 271.38 , 14436.029 , 0.0125 ],
43
-
44
- [SIN , 226.45 , -4892.052 , 0.0110 ],
45
- [SIN , 55.58 , -13038.696 , 0.0107 ],
46
- [SIN , 296.75 , 14315.966 , 0.0100 ],
47
- [SIN , 34.5 , -8266.71 , 0.0085 ],
48
- [SIN , 290.7 , -4493.34 , 0.0079 ],
49
-
50
- [SIN , 228.2 , 9265.33 , 0.0068 ],
51
- [SIN , 133.1 , 319.32 , 0.0052 ],
52
- [SIN , 202.4 , 4812.66 , 0.0050 ],
53
- [SIN , 68.6 , -19.34 , 0.0048 ],
54
- [SIN , 34.1 , 13317.34 , 0.0040 ],
55
-
56
- [SIN , 9.5 , 18449.32 , 0.0040 ],
57
- [SIN , 93.8 , -1.33 , 0.0040 ],
58
- [SIN , 103.3 , 17810.68 , 0.0039 ],
59
- [SIN , 65.1 , 5410.62 , 0.0037 ],
60
- [SIN , 321.3 , 9183.99 , 0.0027 ],
61
-
62
- [SIN , 174.8 , -13797.39 , 0.0026 ],
63
- [SIN , 82.7 , 998.63 , 0.0024 ],
64
- [SIN , 4.7 , 9224.66 , 0.0024 ],
65
- [SIN , 121.4 , -8185.36 , 0.0022 ],
66
- [SIN , 134.4 , 9903.97 , 0.0021 ],
67
-
68
- [SIN , 173.1 , 719.98 , 0.0021 ],
69
- [SIN , 100.3 , -3413.37 , 0.0021 ],
70
- [SIN , 248.6 , -19.34 , 0.0020 ],
71
- [SIN , 98.1 , 4013.29 , 0.0018 ],
72
- [SIN , 344.1 , 18569.38 , 0.0016 ],
73
-
74
- [SIN , 52.1 , -12678.71 , 0.0012 ],
75
- [SIN , 250.3 , 19208.02 , 0.0011 ],
76
- [SIN , 81.0 , -8586.0 , 0.0009 ],
77
- [SIN , 207.0 , 14037.3 , 0.0008 ],
78
- [SIN , 31.0 , -7906.7 , 0.0008 ],
79
-
80
- [SIN , 346.0 , 4052.0 , 0.0007 ],
81
- [SIN , 294.0 , -4853.3 , 0.0007 ],
82
- [SIN , 90.0 , 278.6 , 0.0007 ],
83
- [SIN , 237.0 , 1118.7 , 0.0006 ],
84
- [SIN , 82.0 , 22582.7 , 0.0005 ],
85
-
86
- [SIN , 276.0 , 19088.0 , 0.0005 ],
87
- [SIN , 73.0 , -17450.7 , 0.0005 ],
88
- [SIN , 112.0 , 5091.3 , 0.0005 ],
89
- [SIN , 116.0 , -398.7 , 0.0004 ],
90
- [SIN , 25.0 , -120.1 , 0.0004 ],
91
-
92
- [SIN , 181.0 , 9584.7 , 0.0004 ],
93
- [SIN , 18.0 , 720.0 , 0.0004 ],
94
- [SIN , 60.0 , -3814.0 , 0.0003 ],
95
- [SIN , 13.0 , -3494.7 , 0.0003 ],
96
- [SIN , 13.0 , 18089.3 , 0.0003 ],
97
-
98
- [SIN , 152.0 , 5492.0 , 0.0003 ],
99
- [SIN , 317.0 , -40.7 , 0.0003 ],
100
- [SIN , 348.0 , 23221.3 , 0.0003 ]]
101
- # 月の地心黄緯
102
- # @private
103
- P0dB =
104
- [[SIN , 68.64 , -19.341 , 0.0267 ],
105
- [SIN , 342.0 , -19.36 , 0.0043 ],
106
- [SIN , 93.8 , -1.33 , 0.0040 ],
107
- [SIN , 248.6 , -19.34 , 0.0020 ],
108
- [SIN , 358.0 , -19.4 , 0.0005 ]]
109
- # @private
110
- P0B =
111
- [[SINL , 236.231 , 4832.0201248, 5.1281218,-0.3406E-6 ],
112
- [SIN , 215.147 , 9604.0088 , 0.2806 ],
113
- [SIN , 77.316 , 60.0316 , 0.2777 ],
114
- [SIN , 4.563 , -4073.3220 , 0.1732 ],
115
- [SIN , 308.98 , 8965.374 , 0.0554 ],
116
-
117
- [SIN , 343.48 , 698.667 , 0.0463 ],
118
- [SIN , 287.90 , 13737.362 , 0.0326 ],
119
- [SIN , 194.06 , 14375.997 , 0.0172 ],
120
- [SIN , 25.6 , -8845.31 , 0.0093 ],
121
- [SIN , 98.4 , -4711.96 , 0.0088 ],
122
-
123
- [SIN , 1.1 , -3713.33 , 0.0082 ],
124
- [SIN , 322.4 , 5470.66 , 0.0043 ],
125
- [SIN , 266.8 , 18509.35 , 0.0042 ],
126
- [SIN , 188.0 , -4433.31 , 0.0034 ],
127
- [SIN , 312.5 , 8605.38 , 0.0025 ],
128
-
129
- [SIN , 291.4 , 13377.37 , 0.0022 ],
130
- [SIN , 340.0 , 1058.66 , 0.0021 ],
131
- [SIN , 218.6 , 9244.02 , 0.0019 ],
132
- [SIN , 291.8 , -8206.68 , 0.0018 ],
133
- [SIN , 52.8 , 5192.01 , 0.0018 ],
134
-
135
- [SIN , 168.7 , 14496.06 , 0.0017 ],
136
- [SIN , 73.8 , 420.02 , 0.0016 ],
137
- [SIN , 262.1 , 9284.69 , 0.0015 ],
138
- [SIN , 31.7 , 9964.00 , 0.0015 ],
139
- [SIN , 260.8 , -299.96 , 0.0014 ],
140
-
141
- [SIN , 239.7 , 4472.03 , 0.0013 ],
142
- [SIN , 30.4 , 379.35 , 0.0013 ],
143
- [SIN , 304.9 , 4812.68 , 0.0012 ],
144
- [SIN , 12.4 , -4851.36 , 0.0012 ],
145
- [SIN , 173.0 , 19147.99 , 0.0011 ],
146
-
147
- [SIN , 312.9 , -12978.66 , 0.0010 ],
148
- [SIN , 1.0 , 17870.7 , 0.0008 ],
149
- [SIN , 190.0 , 9724.1 , 0.0008 ],
150
- [SIN , 22.0 , 13098.7 , 0.0007 ],
151
- [SIN , 117.0 , 5590.7 , 0.0006 ],
152
-
153
- [SIN , 47.0 , -13617.3 , 0.0006 ],
154
- [SIN , 22.0 , -8485.3 , 0.0005 ],
155
- [SIN , 150.0 , 4193.4 , 0.0005 ],
156
- [SIN , 119.0 , -9483.9 , 0.0004 ],
157
- [SIN , 246.0 , 23281.3 , 0.0004 ],
158
-
159
- [SIN , 301.0 , 10242.6 , 0.0004 ],
160
- [SIN , 126.0 , 9325.4 , 0.0004 ],
161
- [SIN , 104.0 , 14097.4 , 0.0004 ],
162
- [SIN , 340.0 , 22642.7 , 0.0003 ],
163
- [SIN , 270.0 , 18149.4 , 0.0003 ],
164
-
165
- [SIN , 358.0 , -3353.3 , 0.0003 ],
166
- [SIN , 148.0 , 19268.0 , 0.0003 ]]
167
- # 月の視差
168
- # @private
169
- P0P =
170
- [[COS , 338.92 , 4771.98849108, 0.0518 ,+9.19178E-7],
171
- [COS , 287.2 , -4133.35355678, 0.0095 ,+1.2262E-6 ],
172
- [COS , 51.7 , 8905.34223034, 0.0078 ,-0.3268E-6 ],
173
- [COS , 317.8 , 9543.97698216, 0.0028 ,+1.7988E-6 ],
174
- [COS , 31.0 , 13677.3 , 0.0009 ],
175
-
176
- [COS , 305.0 , -8545.4 , 0.0005 ],
177
- [COS , 284.0 , -3773.4 , 0.0004 ],
178
- [COS , 342.0 , 4412.0 , 0.0003 ]]
179
-
180
- #
181
- # The Moon
182
- #
183
- class Moon < Datum
184
-
185
- class << self
186
-
187
- include Ephemeris
188
-
189
- # 月の真黄経 / CIRCLE
190
- #
191
- # @param [Numeric] t ユリウス日(Terrestrial Time)
192
- # @param [When::TM::TemporalPosition] t
193
- #
194
- # @return [Numeric]
195
- #
196
- def true_longitude(t)
197
- y = julian_year_from_1975(+t)
198
- return trigonometric(y, P0L, sind(trigonometric(y, P0dL))) / 360.0 + 38770.0
199
- end
200
-
201
- # 月の真黄緯/ CIRCLE
202
- #
203
- # @param [Numeric] t ユリウス日(Terrestrial Time)
204
- # @param [When::TM::TemporalPosition] t
205
- #
206
- # @return [Numeric]
207
- #
208
- def latitude(t)
209
- y = julian_year_from_1975(+t)
210
- return trigonometric(y, P0B, trigonometric(y, P0dB)) / 360.0
211
- end
212
-
213
- # 月の距離 / km
214
- #
215
- # @param [Numeric] t ユリウス日(Terrestrial Time)
216
- # @param [When::TM::TemporalPosition] t
217
- #
218
- # @return [Numeric]
219
- #
220
- def pi(t)
221
- return 6378.14 / ((trigonometric(julian_year_from_1975(+t), P0P) + 0.9507)*DEG)
222
- end
223
-
224
- # 月の平均黄経 / CIRCLE
225
- #
226
- # @param [Numeric] t ユリウス日(Terrestrial Time)
227
- # @param [When::TM::TemporalPosition] t
228
- #
229
- # @return [Numeric]
230
- #
231
- def mean_longitude(t)
232
- return trigonometric(julian_year_from_1975(+t), P0L, 0.0, 1) / 360.0 + 38770.0
233
- end
234
- end
235
-
236
- # 月の位置 (黄道座標)
237
- #
238
- # @param [Numeric] t ユリウス日(Terrestrial Time)
239
- # @param [When::TM::TemporalPosition] t
240
- #
241
- # @return [When::Ephemeris::Coords]
242
- #
243
- def _coords(t)
244
- t = +t
245
- Coords.polar(Moon.true_longitude(t),
246
- Moon.latitude(t),
247
- Moon.pi(t)/AU,
248
- Moon.mean_longitude(t)) +
249
- When.Resource('_ep:Earth')._coords(t)
250
- end
251
-
252
- # 真黄経 / CIRCLE
253
- #
254
- # @param [Numeric] t ユリウス日(Terrestrial Time)
255
- # @param [When::TM::TemporalPosition] t
256
- #
257
- # @return [Numeric]
258
- #
259
- def true_longitude(t)
260
- Moon.true_longitude(t)
261
- end
262
-
263
- # 平均黄経 / CIRCLE
264
- #
265
- # @param [Numeric] t ユリウス日(Terrestrial Time)
266
- # @param [When::TM::TemporalPosition] t
267
- #
268
- # @return [Numeric]
269
- #
270
- def mean_longitude(t)
271
- Moon.mean_longitude(t)
272
- end
273
-
274
- # 平均運動 / (DEG/YEAR)
275
- #
276
- # @return [Numeric]
277
- #
278
- def mean_motion
279
- P0L[0][2]
280
- end
281
-
282
- #
283
- # オブジェクトの生成
284
- # @private
285
- def initialize(*args)
286
- options = [args.pop] if args[-1].kind_of?(Hash)
287
- surface_radius, aberration, luminosity, *rest = args
288
- surface_radius ||= 1738.1
289
- aberration ||= 0.00020
290
- luminosity ||= 0.40
291
- args = [surface_radius, aberration, luminosity] + rest
292
- args += options if options
293
- super(*args)
294
- end
295
- end
296
-
297
- #
298
- # The Shadow of the Earth
299
- #
300
- class Shadow < Earth
301
-
302
- # 地球の影の位置 (黄道座標)
303
- #
304
- # @param [Numeric] t ユリウス日(Terrestrial Time)
305
- # @param [When::TM::TemporalPosition] t
306
- #
307
- # @return [When::Ephemeris::Coords]
308
- #
309
- def _coords(t)
310
- t = +t
311
- radius = Sun.pi(t) + Moon.pi(t)/AU
312
- dl = 0.5 + @aberration / radius / 360 # 略算式に含まれる光行差をキャンセルする
313
- Coords.polar(Sun.true_longitude(t)+dl, 0, radius, Sun.mean_longitude(t)+dl)
314
- end
315
-
316
- # 地球の影の視半径 / CIRCLE
317
- #
318
- # @param [Numeric] t ユリウス日(Terrestrial Time)
319
- # @param [When::TM::TemporalPosition] t
320
- # @param [When::Coordinates::Spatial] base 観測地
321
- #
322
- # @return [Numeric]
323
- #
324
- def apparent_radius(t, base=nil)
325
- t = +t
326
- radius = Sun.pi(t) * AU
327
- (asin(surface_radius/Moon.pi(t)) -
328
- asin(Ephemeris::Sun::Radius/radius) +
329
- asin(surface_radius/radius)) * 1.02 / CIRCLE
330
- end
331
- end
332
- end
333
- end
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ Copyright (C) 2011-2014 Takashi SUGA
4
+
5
+ You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
+ =end
7
+
8
+ require 'when_exe/ephemeris/sun'
9
+ module When
10
+ module Ephemeris
11
+
12
+ #------------------------------------------
13
+ # 月と地球の本影 計算用データ
14
+ #------------------------------------------
15
+
16
+ # 月の地心黄経
17
+ # @private
18
+ P0dL =
19
+ [[SIN , 93.8 , -1.33 , 0.0040 ],
20
+ [SIN , 248.6 , -19.34 , 0.0020 ],
21
+ [SIN , 66.0 , 0.2 , 0.0006 ],
22
+ [SIN , 249.0 , -19.3 , 0.0006 ]]
23
+ # @private
24
+ P0L =
25
+ [[LIN , 124.8757417 , 4812.6788201 , -1.330000E-7],
26
+ [SINL , 338.9158263 , 4771.9886313 , 6.2887 ,+8.99400E-7], # 中心差
27
+ [SIN , 107.236832 , -4133.3536154, 1.2740 ,+1.22612E-6], # 出差
28
+ [SIN , 51.678963 , 8905.3422467, 0.6583 ,-0.32672E-6], # 二均差
29
+ [SIN , 317.831653 , 9543.9772627, 0.2136 ,+1.7988E-6 ], # 中心差 x 2
30
+ [SIN , 176.528826 , 359.990504 , 0.1856 ,-1.561E-8 ], # 年差
31
+
32
+ [SIN , 292.463 , 9664.0403505, 0.1143 ,-0.6812E-6 ],
33
+ [SIN , 86.16 , 638.63475182, 0.0588 ,+2.1256E-6 ],
34
+ [SIN , 103.78 , -3773.36305278, 0.0572 ,-1.22769E-6],
35
+ [SIN , 30.58 , 13677.331 , 0.0533 ],
36
+ [SIN , 124.86 , -8545.352 , 0.0459 ],
37
+
38
+ [SIN , 342.38 , 4411.998 , 0.0410 ],
39
+ [SIN , 25.83 , 4452.671 , 0.0348 ], # 月角差( 二均差 / 2)
40
+ [SIN , 155.45 , 5131.979 , 0.0305 ],
41
+ [SIN , 240.79 , 758.698 , 0.0153 ],
42
+ [SIN , 271.38 , 14436.029 , 0.0125 ],
43
+
44
+ [SIN , 226.45 , -4892.052 , 0.0110 ],
45
+ [SIN , 55.58 , -13038.696 , 0.0107 ],
46
+ [SIN , 296.75 , 14315.966 , 0.0100 ],
47
+ [SIN , 34.5 , -8266.71 , 0.0085 ],
48
+ [SIN , 290.7 , -4493.34 , 0.0079 ],
49
+
50
+ [SIN , 228.2 , 9265.33 , 0.0068 ],
51
+ [SIN , 133.1 , 319.32 , 0.0052 ],
52
+ [SIN , 202.4 , 4812.66 , 0.0050 ],
53
+ [SIN , 68.6 , -19.34 , 0.0048 ],
54
+ [SIN , 34.1 , 13317.34 , 0.0040 ],
55
+
56
+ [SIN , 9.5 , 18449.32 , 0.0040 ],
57
+ [SIN , 93.8 , -1.33 , 0.0040 ],
58
+ [SIN , 103.3 , 17810.68 , 0.0039 ],
59
+ [SIN , 65.1 , 5410.62 , 0.0037 ],
60
+ [SIN , 321.3 , 9183.99 , 0.0027 ],
61
+
62
+ [SIN , 174.8 , -13797.39 , 0.0026 ],
63
+ [SIN , 82.7 , 998.63 , 0.0024 ],
64
+ [SIN , 4.7 , 9224.66 , 0.0024 ],
65
+ [SIN , 121.4 , -8185.36 , 0.0022 ],
66
+ [SIN , 134.4 , 9903.97 , 0.0021 ],
67
+
68
+ [SIN , 173.1 , 719.98 , 0.0021 ],
69
+ [SIN , 100.3 , -3413.37 , 0.0021 ],
70
+ [SIN , 248.6 , -19.34 , 0.0020 ],
71
+ [SIN , 98.1 , 4013.29 , 0.0018 ],
72
+ [SIN , 344.1 , 18569.38 , 0.0016 ],
73
+
74
+ [SIN , 52.1 , -12678.71 , 0.0012 ],
75
+ [SIN , 250.3 , 19208.02 , 0.0011 ],
76
+ [SIN , 81.0 , -8586.0 , 0.0009 ],
77
+ [SIN , 207.0 , 14037.3 , 0.0008 ],
78
+ [SIN , 31.0 , -7906.7 , 0.0008 ],
79
+
80
+ [SIN , 346.0 , 4052.0 , 0.0007 ],
81
+ [SIN , 294.0 , -4853.3 , 0.0007 ],
82
+ [SIN , 90.0 , 278.6 , 0.0007 ],
83
+ [SIN , 237.0 , 1118.7 , 0.0006 ],
84
+ [SIN , 82.0 , 22582.7 , 0.0005 ],
85
+
86
+ [SIN , 276.0 , 19088.0 , 0.0005 ],
87
+ [SIN , 73.0 , -17450.7 , 0.0005 ],
88
+ [SIN , 112.0 , 5091.3 , 0.0005 ],
89
+ [SIN , 116.0 , -398.7 , 0.0004 ],
90
+ [SIN , 25.0 , -120.1 , 0.0004 ],
91
+
92
+ [SIN , 181.0 , 9584.7 , 0.0004 ],
93
+ [SIN , 18.0 , 720.0 , 0.0004 ],
94
+ [SIN , 60.0 , -3814.0 , 0.0003 ],
95
+ [SIN , 13.0 , -3494.7 , 0.0003 ],
96
+ [SIN , 13.0 , 18089.3 , 0.0003 ],
97
+
98
+ [SIN , 152.0 , 5492.0 , 0.0003 ],
99
+ [SIN , 317.0 , -40.7 , 0.0003 ],
100
+ [SIN , 348.0 , 23221.3 , 0.0003 ]]
101
+ # 月の地心黄緯
102
+ # @private
103
+ P0dB =
104
+ [[SIN , 68.64 , -19.341 , 0.0267 ],
105
+ [SIN , 342.0 , -19.36 , 0.0043 ],
106
+ [SIN , 93.8 , -1.33 , 0.0040 ],
107
+ [SIN , 248.6 , -19.34 , 0.0020 ],
108
+ [SIN , 358.0 , -19.4 , 0.0005 ]]
109
+ # @private
110
+ P0B =
111
+ [[SINL , 236.231 , 4832.0201248, 5.1281218,-0.3406E-6 ],
112
+ [SIN , 215.147 , 9604.0088 , 0.2806 ],
113
+ [SIN , 77.316 , 60.0316 , 0.2777 ],
114
+ [SIN , 4.563 , -4073.3220 , 0.1732 ],
115
+ [SIN , 308.98 , 8965.374 , 0.0554 ],
116
+
117
+ [SIN , 343.48 , 698.667 , 0.0463 ],
118
+ [SIN , 287.90 , 13737.362 , 0.0326 ],
119
+ [SIN , 194.06 , 14375.997 , 0.0172 ],
120
+ [SIN , 25.6 , -8845.31 , 0.0093 ],
121
+ [SIN , 98.4 , -4711.96 , 0.0088 ],
122
+
123
+ [SIN , 1.1 , -3713.33 , 0.0082 ],
124
+ [SIN , 322.4 , 5470.66 , 0.0043 ],
125
+ [SIN , 266.8 , 18509.35 , 0.0042 ],
126
+ [SIN , 188.0 , -4433.31 , 0.0034 ],
127
+ [SIN , 312.5 , 8605.38 , 0.0025 ],
128
+
129
+ [SIN , 291.4 , 13377.37 , 0.0022 ],
130
+ [SIN , 340.0 , 1058.66 , 0.0021 ],
131
+ [SIN , 218.6 , 9244.02 , 0.0019 ],
132
+ [SIN , 291.8 , -8206.68 , 0.0018 ],
133
+ [SIN , 52.8 , 5192.01 , 0.0018 ],
134
+
135
+ [SIN , 168.7 , 14496.06 , 0.0017 ],
136
+ [SIN , 73.8 , 420.02 , 0.0016 ],
137
+ [SIN , 262.1 , 9284.69 , 0.0015 ],
138
+ [SIN , 31.7 , 9964.00 , 0.0015 ],
139
+ [SIN , 260.8 , -299.96 , 0.0014 ],
140
+
141
+ [SIN , 239.7 , 4472.03 , 0.0013 ],
142
+ [SIN , 30.4 , 379.35 , 0.0013 ],
143
+ [SIN , 304.9 , 4812.68 , 0.0012 ],
144
+ [SIN , 12.4 , -4851.36 , 0.0012 ],
145
+ [SIN , 173.0 , 19147.99 , 0.0011 ],
146
+
147
+ [SIN , 312.9 , -12978.66 , 0.0010 ],
148
+ [SIN , 1.0 , 17870.7 , 0.0008 ],
149
+ [SIN , 190.0 , 9724.1 , 0.0008 ],
150
+ [SIN , 22.0 , 13098.7 , 0.0007 ],
151
+ [SIN , 117.0 , 5590.7 , 0.0006 ],
152
+
153
+ [SIN , 47.0 , -13617.3 , 0.0006 ],
154
+ [SIN , 22.0 , -8485.3 , 0.0005 ],
155
+ [SIN , 150.0 , 4193.4 , 0.0005 ],
156
+ [SIN , 119.0 , -9483.9 , 0.0004 ],
157
+ [SIN , 246.0 , 23281.3 , 0.0004 ],
158
+
159
+ [SIN , 301.0 , 10242.6 , 0.0004 ],
160
+ [SIN , 126.0 , 9325.4 , 0.0004 ],
161
+ [SIN , 104.0 , 14097.4 , 0.0004 ],
162
+ [SIN , 340.0 , 22642.7 , 0.0003 ],
163
+ [SIN , 270.0 , 18149.4 , 0.0003 ],
164
+
165
+ [SIN , 358.0 , -3353.3 , 0.0003 ],
166
+ [SIN , 148.0 , 19268.0 , 0.0003 ]]
167
+ # 月の視差
168
+ # @private
169
+ P0P =
170
+ [[COS , 338.92 , 4771.98849108, 0.0518 ,+9.19178E-7],
171
+ [COS , 287.2 , -4133.35355678, 0.0095 ,+1.2262E-6 ],
172
+ [COS , 51.7 , 8905.34223034, 0.0078 ,-0.3268E-6 ],
173
+ [COS , 317.8 , 9543.97698216, 0.0028 ,+1.7988E-6 ],
174
+ [COS , 31.0 , 13677.3 , 0.0009 ],
175
+
176
+ [COS , 305.0 , -8545.4 , 0.0005 ],
177
+ [COS , 284.0 , -3773.4 , 0.0004 ],
178
+ [COS , 342.0 , 4412.0 , 0.0003 ]]
179
+
180
+ #
181
+ # The Moon
182
+ #
183
+ class Moon < Datum
184
+
185
+ class << self
186
+
187
+ include Ephemeris
188
+
189
+ # 月の真黄経 / CIRCLE
190
+ #
191
+ # @param [Numeric] t ユリウス日(Terrestrial Time)
192
+ # @param [When::TM::TemporalPosition] t
193
+ #
194
+ # @return [Numeric]
195
+ #
196
+ def true_longitude(t)
197
+ y = julian_year_from_1975(+t)
198
+ return trigonometric(y, P0L, sind(trigonometric(y, P0dL))) / 360.0 + 38770.0
199
+ end
200
+
201
+ # 月の真黄緯/ CIRCLE
202
+ #
203
+ # @param [Numeric] t ユリウス日(Terrestrial Time)
204
+ # @param [When::TM::TemporalPosition] t
205
+ #
206
+ # @return [Numeric]
207
+ #
208
+ def latitude(t)
209
+ y = julian_year_from_1975(+t)
210
+ return trigonometric(y, P0B, trigonometric(y, P0dB)) / 360.0
211
+ end
212
+
213
+ # 月の距離 / km
214
+ #
215
+ # @param [Numeric] t ユリウス日(Terrestrial Time)
216
+ # @param [When::TM::TemporalPosition] t
217
+ #
218
+ # @return [Numeric]
219
+ #
220
+ def pi(t)
221
+ return 6378.14 / ((trigonometric(julian_year_from_1975(+t), P0P) + 0.9507)*DEG)
222
+ end
223
+
224
+ # 月の平均黄経 / CIRCLE
225
+ #
226
+ # @param [Numeric] t ユリウス日(Terrestrial Time)
227
+ # @param [When::TM::TemporalPosition] t
228
+ #
229
+ # @return [Numeric]
230
+ #
231
+ def mean_longitude(t)
232
+ return trigonometric(julian_year_from_1975(+t), P0L, 0.0, 1) / 360.0 + 38770.0
233
+ end
234
+ end
235
+
236
+ # 月の位置 (黄道座標)
237
+ #
238
+ # @param [Numeric] t ユリウス日(Terrestrial Time)
239
+ # @param [When::TM::TemporalPosition] t
240
+ #
241
+ # @return [When::Ephemeris::Coords]
242
+ #
243
+ def _coords(t)
244
+ t = +t
245
+ Coords.polar(Moon.true_longitude(t),
246
+ Moon.latitude(t),
247
+ Moon.pi(t)/AU,
248
+ Moon.mean_longitude(t)) +
249
+ When.Resource('_ep:Earth')._coords(t)
250
+ end
251
+
252
+ # 真黄経 / CIRCLE
253
+ #
254
+ # @param [Numeric] t ユリウス日(Terrestrial Time)
255
+ # @param [When::TM::TemporalPosition] t
256
+ #
257
+ # @return [Numeric]
258
+ #
259
+ def true_longitude(t)
260
+ Moon.true_longitude(t)
261
+ end
262
+
263
+ # 平均黄経 / CIRCLE
264
+ #
265
+ # @param [Numeric] t ユリウス日(Terrestrial Time)
266
+ # @param [When::TM::TemporalPosition] t
267
+ #
268
+ # @return [Numeric]
269
+ #
270
+ def mean_longitude(t)
271
+ Moon.mean_longitude(t)
272
+ end
273
+
274
+ # 平均運動 / (DEG/YEAR)
275
+ #
276
+ # @return [Numeric]
277
+ #
278
+ def mean_motion
279
+ P0L[0][2]
280
+ end
281
+
282
+ #
283
+ # オブジェクトの生成
284
+ # @private
285
+ def initialize(*args)
286
+ options = [args.pop] if args[-1].kind_of?(Hash)
287
+ surface_radius, aberration, luminosity, *rest = args
288
+ surface_radius ||= 1738.1
289
+ aberration ||= 0.00020
290
+ luminosity ||= 0.40
291
+ args = [surface_radius, aberration, luminosity] + rest
292
+ args += options if options
293
+ super(*args)
294
+ end
295
+ end
296
+
297
+ #
298
+ # The Shadow of the Earth
299
+ #
300
+ class Shadow < Earth
301
+
302
+ # 地球の影の位置 (黄道座標)
303
+ #
304
+ # @param [Numeric] t ユリウス日(Terrestrial Time)
305
+ # @param [When::TM::TemporalPosition] t
306
+ #
307
+ # @return [When::Ephemeris::Coords]
308
+ #
309
+ def _coords(t)
310
+ t = +t
311
+ radius = Sun.pi(t) + Moon.pi(t)/AU
312
+ dl = 0.5 + @aberration / radius / 360 # 略算式に含まれる光行差をキャンセルする
313
+ Coords.polar(Sun.true_longitude(t)+dl, 0, radius, Sun.mean_longitude(t)+dl)
314
+ end
315
+
316
+ # 地球の影の視半径 / CIRCLE
317
+ #
318
+ # @param [Numeric] t ユリウス日(Terrestrial Time)
319
+ # @param [When::TM::TemporalPosition] t
320
+ # @param [When::Coordinates::Spatial] base 観測地
321
+ #
322
+ # @return [Numeric]
323
+ #
324
+ def apparent_radius(t, base=nil)
325
+ t = +t
326
+ radius = Sun.pi(t) * AU
327
+ (asin(surface_radius/Moon.pi(t)) -
328
+ asin(Ephemeris::Sun::Radius/radius) +
329
+ asin(surface_radius/radius)) * 1.02 / CIRCLE
330
+ end
331
+ end
332
+ end
333
+ end