when_exe 0.4.2 → 0.5.0

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 (144) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.ja.txt +8 -21
  3. data/LICENSE.txt +5 -27
  4. data/README.md +25 -79
  5. data/bin/.pryrc +9 -0
  6. data/bin/make_ttl.rb +3 -2
  7. data/bin/make_ttl.rb.config +3 -3
  8. data/lib/when_exe.rb +101 -5
  9. data/lib/when_exe/basictypes.rb +47 -16
  10. data/lib/when_exe/calendarnote.rb +27 -18
  11. data/lib/when_exe/calendartypes.rb +12 -50
  12. data/lib/when_exe/coordinates.rb +37 -391
  13. data/lib/when_exe/ephemeris.rb +53 -14
  14. data/lib/when_exe/ephemeris/eclipse.rb +8 -8
  15. data/lib/when_exe/ephemeris/moon.rb +333 -333
  16. data/lib/when_exe/ephemeris/notes.rb +29 -17
  17. data/lib/when_exe/ephemeris/phase_table.rb +825 -0
  18. data/lib/when_exe/ephemeris/term_table.rb +603 -0
  19. data/lib/when_exe/events.rb +1888 -0
  20. data/lib/when_exe/google_api.rb +26 -31
  21. data/lib/when_exe/icalendar.rb +129 -12
  22. data/lib/when_exe/inspect.rb +5 -5
  23. data/lib/when_exe/linkeddata.rb +43 -23
  24. data/lib/when_exe/locales/akt.rb +63 -0
  25. data/lib/when_exe/locales/encoding_conversion.rb +134 -134
  26. data/lib/when_exe/locales/iast.rb +90 -90
  27. data/lib/when_exe/locales/locale.rb +88 -18
  28. data/lib/when_exe/locales/transliteration_table.rb +62 -62
  29. data/lib/when_exe/mini_application.rb +14 -8
  30. data/lib/when_exe/namespace.rb +42 -0
  31. data/lib/when_exe/parts/enumerator.rb +16 -5
  32. data/lib/when_exe/parts/geometric_complex.rb +52 -2
  33. data/lib/when_exe/parts/method_cash.rb +229 -224
  34. data/lib/when_exe/parts/resource.rb +65 -35
  35. data/lib/when_exe/parts/timezone.rb +25 -34
  36. data/lib/when_exe/region/balinese.rb +5 -3
  37. data/lib/when_exe/region/chinese.rb +39 -11
  38. data/lib/when_exe/region/chinese/calendars.rb +1016 -1016
  39. data/lib/when_exe/region/chinese/epochs.rb +7 -7
  40. data/lib/when_exe/region/chinese/notes.rb +3 -3
  41. data/lib/when_exe/region/chinese/twins.rb +134 -11
  42. data/lib/when_exe/region/dee.rb +4 -4
  43. data/lib/when_exe/region/discordian.rb +1 -1
  44. data/lib/when_exe/region/geologicalage.rb +139 -128
  45. data/lib/when_exe/region/hanke_henry.rb +4 -4
  46. data/lib/when_exe/region/indian.rb +77 -8
  47. data/lib/when_exe/region/international_fixed.rb +3 -3
  48. data/lib/when_exe/region/islamic.rb +1 -1
  49. data/lib/when_exe/region/japanese.rb +12 -8
  50. data/lib/when_exe/region/japanese/calendars.rb +397 -397
  51. data/lib/when_exe/region/japanese/eclipses.rb +1194 -1194
  52. data/lib/when_exe/region/japanese/epochs.rb +8 -4
  53. data/lib/when_exe/region/japanese/location.rb +93 -0
  54. data/lib/when_exe/region/japanese/nihon_shoki.rb +70 -70
  55. data/lib/when_exe/region/japanese/notes.rb +57 -18
  56. data/lib/when_exe/region/japanese/residues.rb +33 -11
  57. data/lib/when_exe/region/japanese/twins.rb +27 -14
  58. data/lib/when_exe/region/japanese/weeks.rb +7 -7
  59. data/lib/when_exe/region/korean.rb +384 -384
  60. data/lib/when_exe/region/location.rb +40 -0
  61. data/lib/when_exe/region/martian.rb +1 -1
  62. data/lib/when_exe/region/mayan.rb +2 -2
  63. data/lib/when_exe/region/roman.rb +2 -2
  64. data/lib/when_exe/region/ryukyu.rb +101 -101
  65. data/lib/when_exe/region/saudi_arabian.rb +57 -0
  66. data/lib/when_exe/region/shire.rb +1 -1
  67. data/lib/when_exe/region/world.rb +3 -3
  68. data/lib/when_exe/region/zoroastrian.rb +1 -1
  69. data/lib/when_exe/spatial.rb +611 -0
  70. data/lib/when_exe/timestandard.rb +9 -7
  71. data/lib/when_exe/tmobjects.rb +34 -2
  72. data/lib/when_exe/tmposition.rb +225 -1322
  73. data/lib/when_exe/tmptypes.rb +1279 -0
  74. data/lib/when_exe/tmreference.rb +42 -7
  75. data/lib/when_exe/version.rb +3 -3
  76. data/test/events/example-datasets +6 -0
  77. data/test/events/history-dataset.csv +22 -0
  78. data/test/events/japanese-holiday-index.csv +28 -0
  79. data/test/events/japanese-holiday.csv +94 -0
  80. data/test/events/japanese-holiday.ttl +948 -0
  81. data/test/events/make_events_ttl.rb +18 -0
  82. data/test/events/mori_wikichoshi.csv +14 -0
  83. data/test/events/ndl_koyomi.csv +220 -0
  84. data/test/events/ndl_koyomi_index.csv +44 -0
  85. data/test/events/primeminister-dataset.csv +19 -0
  86. data/test/events/shogun-dataset.csv +22 -0
  87. data/test/events/test-history-dataset-edge-sparql.csv +26 -0
  88. data/test/events/test-history-dataset-edge.csv +27 -0
  89. data/test/events/test-history-dataset-sparql.csv +22 -0
  90. data/test/events/test-history-dataset.csv +23 -0
  91. data/test/events/test-history-events-edge.ttl +89 -0
  92. data/test/events/test-history-events.csv +6 -0
  93. data/test/examples/JapanHolidays.ics +2 -2
  94. data/test/examples/JapanHolidaysRFC6350.ics +3 -3
  95. data/test/examples/Residue.m17n +2 -2
  96. data/test/examples/Spatial.m17n +3 -3
  97. data/test/examples/Terms.m17n +3 -3
  98. data/test/scripts/8.ext.rb +6 -6
  99. data/test/scripts/8.rb +6 -6
  100. data/test/scripts/geometric_complex.rb +41 -41
  101. data/test/scripts/korea.rb +59 -59
  102. data/test/scripts/thai.rb +36 -36
  103. data/test/test.rb +6 -0
  104. data/test/test/basictypes.rb +431 -431
  105. data/test/test/calendarnote.rb +86 -86
  106. data/test/test/calendartypes.rb +97 -97
  107. data/test/test/coordinates.rb +399 -397
  108. data/test/test/ephemeris.rb +115 -115
  109. data/test/test/ephemeris/moon.rb +14 -14
  110. data/test/test/ephemeris/planets.rb +14 -14
  111. data/test/test/ephemeris/sun.rb +14 -14
  112. data/test/test/events.rb +32 -0
  113. data/test/test/google_api.rb +45 -32
  114. data/test/test/inspect.rb +153 -153
  115. data/test/test/parts.rb +488 -488
  116. data/test/test/region/armenian.rb +20 -20
  117. data/test/test/region/bahai.rb +58 -58
  118. data/test/test/region/balinese.rb +34 -34
  119. data/test/test/region/chinese.rb +229 -229
  120. data/test/test/region/christian.rb +226 -226
  121. data/test/test/region/coptic.rb +27 -27
  122. data/test/test/region/discordian.rb +20 -20
  123. data/test/test/region/french.rb +33 -33
  124. data/test/test/region/geologicalage.rb +17 -17
  125. data/test/test/region/indian.rb +14 -1
  126. data/test/test/region/iran.rb +54 -54
  127. data/test/test/region/islamic.rb +64 -54
  128. data/test/test/region/japanese.rb +281 -261
  129. data/test/test/region/jewish.rb +63 -63
  130. data/test/test/region/m17n.rb +21 -21
  131. data/test/test/region/mayan.rb +17 -16
  132. data/test/test/region/reforms.rb +2 -2
  133. data/test/test/region/residue.rb +7 -7
  134. data/test/test/region/shire.rb +58 -58
  135. data/test/test/region/swedish.rb +45 -45
  136. data/test/test/region/thai.rb +116 -116
  137. data/test/test/region/tibetan.rb +30 -30
  138. data/test/test/region/vietnamese.rb +102 -102
  139. data/test/test/region/zoroastrian.rb +58 -58
  140. data/test/test/timestandard.rb +81 -81
  141. data/test/test/tmobjects.rb +402 -402
  142. data/test/test/tmposition.rb +66 -4
  143. data/test/test/tmreference.rb +157 -157
  144. metadata +36 -93
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2011-2015 Takashi SUGA
3
+ Copyright (C) 2011-2021 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -26,6 +26,9 @@ module When::Ephemeris
26
26
  autoload :V50, 'when_exe/ephemeris/v50'
27
27
  autoload :Hindu, 'when_exe/region/indian'
28
28
 
29
+ autoload :SolarFormulaWithTable, 'when_exe/ephemeris/term_table'
30
+ autoload :LunarFormulaWithTable, 'when_exe/ephemeris/phase_table'
31
+
29
32
  include Math
30
33
 
31
34
  DAY = 86400.0 # 日 / 秒
@@ -642,7 +645,7 @@ module When::Ephemeris
642
645
  # @return [When::Ephemeris::Coords]
643
646
  #
644
647
  def rh_to_h(t, loc)
645
- rotate_y(loc.lat / (360.0*When::Coordinates::Spatial::DEGREE) - 0.25)
648
+ rotate_y(loc.lat / (360.0*loc.degree) - 0.25)
646
649
  end
647
650
 
648
651
  # 赤道座標 -> 地平座標
@@ -655,7 +658,7 @@ module When::Ephemeris
655
658
  #
656
659
  def r_to_h(t, loc)
657
660
  rotate_z(-loc.local_sidereal_time(t) / 24).
658
- rotate_y(loc.lat / (360.0*When::Coordinates::Spatial::DEGREE) - 0.25)
661
+ rotate_y(loc.lat / (360.0*loc.degree) - 0.25)
659
662
  end
660
663
 
661
664
  # 球面の余弦 spherical law of cosines
@@ -1342,7 +1345,7 @@ module When::Ephemeris
1342
1345
  #
1343
1346
  def day_event(t, event, target=When.Resource('_ep:Sun'), height=nil)
1344
1347
  # 時刻の初期値
1345
- dl = @location.long / (360.0 * When::Coordinates::Spatial::DEGREE)
1348
+ dl = @location.long / (360.0 * @location.degree)
1346
1349
  t0 = (+t + dl).round - dl
1347
1350
  dt = _coords(t0, When::Coordinates::Spatial::EQUATORIAL, target).phi -
1348
1351
  @location.local_sidereal_time(t0) / 24.0 + 0.25 * (event||0)
@@ -1526,8 +1529,8 @@ module When::Ephemeris
1526
1529
  # difference of ecliptic longitude between zenith and target star
1527
1530
  # when the event happens
1528
1531
  pos = _coords(+t, When::Coordinates::Spatial::EQUATORIAL, target)
1529
- long = @location.long / When::Coordinates::Spatial::DEGREE
1530
- lat = @location.lat / When::Coordinates::Spatial::DEGREE
1532
+ long = @location.long / @location.degree
1533
+ lat = @location.lat / @location.degree
1531
1534
  dp = (sind(hs) - sind(lat) * sinc(pos.theta)) /
1532
1535
  (cosd(lat) * cosc(pos.theta))
1533
1536
 
@@ -1574,7 +1577,7 @@ module When::Ephemeris
1574
1577
  seed[:precision] = nil
1575
1578
  seed[:clock] ||= When::TM::Clock.local_time
1576
1579
  t = When::TM::JulianDate._d_to_t(d)
1577
- seed[:frame].jul_trans(@is_dynamical ? When::TM::JulianDate.dynamical_time(t) :
1580
+ seed[:frame].jul_trans(@is_dynamical ? When::TM::JulianDate.dynamical_time(t, {:time_standard=>seed[:time_standard]}) :
1578
1581
  When::TM::JulianDate.universal_time(t), seed)
1579
1582
  end
1580
1583
 
@@ -1595,8 +1598,8 @@ module When::Ephemeris
1595
1598
  # @sun_1m = t = CYCLE_1M日 までの太陽年番号の比例定数
1596
1599
  def _normalize(args=[], options={})
1597
1600
  @location = When.Resource(@location, '_l:') if @location.kind_of?(String)
1598
- @long, @lat, @alt = [@location.long / When::Coordinates::Spatial::DEGREE,
1599
- @location.lat / When::Coordinates::Spatial::DEGREE,
1601
+ @long, @lat, @alt = [@location.long / @location.degree,
1602
+ @location.lat / @location.degree,
1600
1603
  @location.alt] if @location
1601
1604
  @formula ||= '1L'
1602
1605
  @time_standard ||= 'dynamical'
@@ -1775,6 +1778,43 @@ module When::Ephemeris
1775
1778
  end
1776
1779
  end
1777
1780
 
1781
+ #
1782
+ # 一部表引き
1783
+ #
1784
+ class FormulaWithTable < Formula
1785
+
1786
+ private
1787
+
1788
+ # 周期番号 -> 日時
1789
+ #
1790
+ # @param [Numeric] cn 周期番号
1791
+ # @param [Numeric] time0 日時の初期近似値
1792
+ #
1793
+ # @return [Numeric] ユリウス日
1794
+ #
1795
+ def cn_to_time_(cn, time0=nil)
1796
+ count = ((cn - self.class::CycleBase) * self.class::CycleUnit / 360.0).floor
1797
+ return super unless count >= 0
1798
+ degree = (cn * self.class::CycleUnit) % 360
1799
+ degree = degree.round if (degree - degree.round).abs < 1.5E-8
1800
+ if degree == 360
1801
+ degree = 0
1802
+ count += 1
1803
+ end
1804
+ epoch = self.class::Epoch[degree]
1805
+ return super unless epoch
1806
+ delta = self.class::Delta[degree][count]
1807
+ return super unless delta
1808
+ epoch + count * self.class::CyclePeriod + delta * 1E-9
1809
+ end
1810
+
1811
+ # オブジェクトの正規化
1812
+ def _normalize(args=[], options={})
1813
+ @formula = self.class::FormulaType
1814
+ super
1815
+ end
1816
+ end
1817
+
1778
1818
  #
1779
1819
  # Luni-Solar Calendar Formula for Mean Lunation Type
1780
1820
  #
@@ -1919,7 +1959,7 @@ module When::Ephemeris
1919
1959
  @year_epoch = @year_epoch.to_f
1920
1960
  else
1921
1961
  @year_epoch = 0
1922
- @year_epoch = @longitude_shift -_mean_sun_(@epoch_shift).to_i
1962
+ @year_epoch = @longitude_shift - _mean_sun_(@epoch_shift).to_i
1923
1963
  end
1924
1964
  @cycle_precision ||= 1.0E-8
1925
1965
  @cycle_precision = @cycle_precision.to_f
@@ -1933,7 +1973,7 @@ module When::Ephemeris
1933
1973
  @month_epoch = @month_epoch.to_f
1934
1974
  else
1935
1975
  @month_epoch = 0
1936
- @month_epoch = @longitude_shift -_mean_moon_(@epoch_shift).to_i
1976
+ @month_epoch = @longitude_shift - _mean_moon_(@epoch_shift).to_i
1937
1977
  end
1938
1978
  extend LunarMethod
1939
1979
  else
@@ -1943,9 +1983,8 @@ module When::Ephemeris
1943
1983
  end
1944
1984
 
1945
1985
  # 通法
1946
- @denominator = @year_length.denominator if @year_length.kind_of?(Rational)
1947
- @denominator = [@denominator||0, @lunation_length.denominator].max if @lunation_length.kind_of?(Rational)
1948
-
1986
+ @denominator = @denominator.to_i if @denominator
1987
+ @denominator ||= [@year_length, @lunation_length].map {|length| length.kind_of?(Rational) ? length.denominator : 0}.max
1949
1988
  super
1950
1989
  end
1951
1990
  end
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  =begin
3
- Copyright (C) 2014-2015 Takashi SUGA
3
+ Copyright (C) 2014-2016 Takashi SUGA
4
4
 
5
5
  You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
6
  =end
@@ -16,14 +16,14 @@ class When::Coordinates::Spatial
16
16
  # 日食の情報
17
17
  #
18
18
  # @param [When::TM::TemporalPosition] date
19
- # @param [Range<When::TM::TemporalPosition>] date
19
+ # @param [::Range<When::TM::TemporalPosition>] date
20
20
  # @param [Block] block
21
21
  #
22
- # @return [Array<String, Numeric, Array<Array<Numeric or When::TM::TemporalPosition, String>>>] 食の情報(のArray(dateRangeの場合))
22
+ # @return [Array<String, Numeric, Array<Array<Numeric or When::TM::TemporalPosition, String>>>] 食の情報(のArray(dateが::Rangeの場合))
23
23
  # @see When::Coordinates::Spatial#eclipse_info
24
24
  #
25
25
  def solar_eclipse(date, &block)
26
- if date.kind_of?(Range)
26
+ if date.kind_of?(::Range)
27
27
  last = date.last.to_i
28
28
  last -= 1 if date.exclude_end?
29
29
  first = date.first.to_i
@@ -51,16 +51,16 @@ class When::Coordinates::Spatial
51
51
  # 月食の情報
52
52
  #
53
53
  # @param [When::TM::TemporalPosition] date
54
- # @param [Range<When::TM::TemporalPosition>] date
55
- # @note Rangeの場合夜半より翌日に向けmargin経過時点より前は前日扱い
54
+ # @param [::Range<When::TM::TemporalPosition>] date
55
+ # @note ::Rangeの場合夜半より翌日に向けmargin経過時点より前は前日扱い
56
56
  # @param [When::TM::Duration] margin
57
57
  # @param [Block] block
58
58
  #
59
- # @return [Array<String, Numeric, Array<Array<Numeric or When::TM::TemporalPosition, String>>>] 食の情報(のArray(dateRangeの場合))
59
+ # @return [Array<String, Numeric, Array<Array<Numeric or When::TM::TemporalPosition, String>>>] 食の情報(のArray(dateが::Rangeの場合))
60
60
  # @see When::Coordinates::Spatial#eclipse_info
61
61
  #
62
62
  def lunar_eclipse(date, margin=When::PT6H, &block)
63
- if date.kind_of?(Range)
63
+ if date.kind_of?(::Range)
64
64
  last = date.last.to_i
65
65
  last -= 1 if date.exclude_end?
66
66
  first = date.first.to_i
@@ -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