lunation 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +37 -0
  4. data/CHANGELOG.md +3 -0
  5. data/CODE_OF_CONDUCT.md +84 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +114 -0
  8. data/Rakefile +12 -0
  9. data/config/jpl_horizons_lunar_ephemeris_1950_2050.csv +3654 -0
  10. data/config/periodic_terms_earth_nutation.yml +567 -0
  11. data/config/periodic_terms_earth_position_b0.yml +5 -0
  12. data/config/periodic_terms_earth_position_b1.yml +2 -0
  13. data/config/periodic_terms_earth_position_l0.yml +64 -0
  14. data/config/periodic_terms_earth_position_l1.yml +34 -0
  15. data/config/periodic_terms_earth_position_l2.yml +20 -0
  16. data/config/periodic_terms_earth_position_l3.yml +7 -0
  17. data/config/periodic_terms_earth_position_l4.yml +3 -0
  18. data/config/periodic_terms_earth_position_l5.yml +1 -0
  19. data/config/periodic_terms_earth_position_r0.yml +40 -0
  20. data/config/periodic_terms_earth_position_r1.yml +10 -0
  21. data/config/periodic_terms_earth_position_r2.yml +6 -0
  22. data/config/periodic_terms_earth_position_r3.yml +2 -0
  23. data/config/periodic_terms_earth_position_r4.yml +1 -0
  24. data/config/periodic_terms_moon_latitude.yml +300 -0
  25. data/config/periodic_terms_moon_longitude_distance.yml +360 -0
  26. data/lib/lunation/calculation/angle.rb +174 -0
  27. data/lib/lunation/calculation/earth_position_vsop87.rb +80 -0
  28. data/lib/lunation/calculation/horner.rb +26 -0
  29. data/lib/lunation/calculation/moon_illuminated_fraction.rb +51 -0
  30. data/lib/lunation/calculation/moon_position.rb +227 -0
  31. data/lib/lunation/calculation/nutation_and_obliquity.rb +121 -0
  32. data/lib/lunation/calculation/sun_position.rb +124 -0
  33. data/lib/lunation/calculation/timekeeping.rb +99 -0
  34. data/lib/lunation/calculation.rb +170 -0
  35. data/lib/lunation/version.rb +5 -0
  36. data/lib/lunation.rb +11 -0
  37. data/sig/lunation.rbs +4 -0
  38. metadata +82 -0
@@ -0,0 +1,124 @@
1
+ require_relative "nutation_and_obliquity"
2
+
3
+ module Lunation
4
+ class Calculation
5
+ module SunPosition
6
+ # (L0) Geometric mean longitude of the sun (25.2, A.A. p. 163)
7
+ # UNIT: Angle
8
+ def sun_mean_longitude
9
+ @sun_mean_longitude ||= begin
10
+ result = Horner.compute(time, [280.46646, 36_000.76983, 0.0003032])
11
+ Angle.from_decimal_degrees(result)
12
+ end
13
+ end
14
+
15
+ # (M) Sun mean_anomaly (25.3, A.A. p. 163)
16
+ # There is another, similar definition of the mean anomaly of the sun in
17
+ # (A.A. p. 144). This method seems to be slightly less precise.
18
+ # UNIT: Angle
19
+ def sun_mean_anomaly2
20
+ @sun_mean_anomaly2 ||= begin
21
+ result = Horner.compute(time, [357.52911, 35_999.05029, -0.0001537])
22
+ Angle.from_decimal_degrees(result)
23
+ end
24
+ end
25
+
26
+ # (e) eccentricity of the earth's orbit (25.4, A.A. p. 163)
27
+ # UNIT: Astronomical Units (AU)
28
+ def earth_orbit_eccentricity
29
+ @earth_orbit_eccentricity ||=
30
+ Horner.compute(time, [0.016708634, -0.000042037, -0.0000001267]).round(9)
31
+ end
32
+
33
+ # (C) Sun's equation of the center (A.A. p. 164)
34
+ # UNIT: Angle
35
+ def sun_equation_of_center
36
+ @sun_equation_of_center ||= begin
37
+ result = Horner.compute(time, [1.914602, -0.004817, -0.000014]) *
38
+ Math.sin(sun_mean_anomaly2.radians) +
39
+ (0.019993 - 0.000101 * time) * Math.sin(2 * sun_mean_anomaly2.radians) +
40
+ 0.000289 * Math.sin(3 * sun_mean_anomaly2.radians)
41
+ Angle.from_decimal_degrees(result, normalize: false)
42
+ end
43
+ end
44
+
45
+ # (☉) true longitude of the sun (A.A. p. 164)
46
+ # UNIT: Angle
47
+ def sun_true_longitude
48
+ @sun_true_longitude ||= sun_mean_longitude + sun_equation_of_center
49
+ end
50
+
51
+ # (v) true anomaly of the sun (A.A. p. 164)
52
+ # UNIT: Angle
53
+ def sun_anomaly
54
+ @sun_anomaly ||= sun_mean_anomaly2 + sun_equation_of_center
55
+ end
56
+
57
+ # (R) earth_sun_distance (25.5, A.A. p. 164)
58
+ # UNIT: Astronomical Units (AU)
59
+ def distance_between_earth_and_sun_in_astronomical_units
60
+ @distance_between_earth_and_sun_in_astronomical_units ||= begin
61
+ result = 1.000001018 * (1 - earth_orbit_eccentricity**2) / (1 + earth_orbit_eccentricity * Math.cos(sun_anomaly.radians))
62
+ result.round(7)
63
+ end
64
+ end
65
+
66
+ # (R) earth_sun_distance (25.5, A.A. p. 164)
67
+ # UNIT: Kilometers (km)
68
+ def distance_between_earth_and_sun_in_kilometers
69
+ @distance_between_earth_and_sun_in_kilometers ||=
70
+ (distance_between_earth_and_sun_in_astronomical_units * 149_597_870).floor
71
+ end
72
+
73
+ # (Ω) Longitude of the ascending node of the Moon's mean orbit on the ecliptic (low precision)
74
+ # A.A. p. 164
75
+ # UNIT: Angle
76
+ def longitude_of_ascending_node_low_precision
77
+ @longitude_of_ascending_node_low_precision ||=
78
+ Angle.from_decimal_degrees(125.04 - 1934.136 * time)
79
+ end
80
+
81
+ # (apparent λ0) Sun apparent longitude (A.A. p. 169)
82
+ # UNIT: Angle
83
+ def sun_ecliptic_longitude
84
+ @sun_ecliptic_longitude ||= begin
85
+ result = sun_true_longitude.decimal_degrees +
86
+ - 0.00569 +
87
+ - 0.00478 * Math.sin(longitude_of_ascending_node_low_precision.radians)
88
+ Angle.from_decimal_degrees(result)
89
+ end
90
+ end
91
+
92
+ # (corrected ε) corrected true obliquity of the ecliptic (A.A. p. 165)
93
+ # UNIT: Angle
94
+ def corrected_obliquity_of_ecliptic
95
+ @corrected_obliquity_of_ecliptic ||= begin
96
+ result = mean_obliquity_of_ecliptic.decimal_degrees +
97
+ 0.00256 * Math.cos(longitude_of_ascending_node.radians)
98
+ Angle.from_decimal_degrees(result)
99
+ end
100
+ end
101
+
102
+ # (α0) geocentric (apparent) right ascension of the sun (25.6 A.A. p. 165)
103
+ # UNIT: Angle
104
+ def sun_right_ascension
105
+ @sun_right_ascension ||= begin
106
+ numerator = Math.cos(corrected_obliquity_of_ecliptic.radians) *
107
+ Math.sin(sun_ecliptic_longitude.radians)
108
+ denominator = Math.cos(sun_ecliptic_longitude.radians)
109
+ Angle.from_radians(Math.atan2(numerator, denominator))
110
+ end
111
+ end
112
+
113
+ # (δ0) geocentric declination (of the sun) (13.4) A.A. p. 93
114
+ # UNIT: Angle
115
+ def sun_declination
116
+ @sun_declination ||= begin
117
+ result = Math.sin(corrected_obliquity_of_ecliptic.radians) *
118
+ Math.sin(sun_ecliptic_longitude.radians)
119
+ Angle.from_radians(Math.asin(result), normalize: false)
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,99 @@
1
+ module Lunation
2
+ class Calculation
3
+ module Timekeeping
4
+ SECONDS_PER_DAY = 86_400
5
+ EPOCH_J2000_JDE = 2_451_545 # expressed in terms of Julian Ephemeris Day
6
+ JULIAN_CENTURY_IN_DAYS = 36_525.0
7
+ # rubocop:disable Layout/LineLength
8
+ DELTA_T_500BC_500AD = [10_583.6, -1_014.41, 33.78311, -5.952053, -0.1798452, 0.022174192, 0.0090316521].freeze
9
+ DELTA_T_500AD_1600AD = [1_574.2, -556.01, 71.23472, 0.319781, -0.8503463, -0.005050998, 0.0083572073].freeze
10
+ DELTA_T_1600AD_1700AD = [120, -0.9808, -0.01532, 1 / 7_129.0].freeze
11
+ DELTA_T_1700AD_1800AD = [8.83, 0.1603, -0.0059285, 0.00013336, -1 / 1_174_000.0].freeze
12
+ DELTA_T_1800AD_1860AD = [13.72, -0.332447, 0.0068612, 0.0041116, -0.00037436, 0.0000121272, -0.0000001699, 0.000000000875].freeze
13
+ DELTA_T_1860AD_1900AD = [7.62, 0.5737, -0.251754, 0.01680668, -0.0004473624, 1 / 233_174.0].freeze
14
+ DELTA_T_1900AD_1920AD = [-2.79, 1.494119, -0.0598939, 0.0061966, -0.000197].freeze
15
+ DELTA_T_1920AD_1941AD = [21.20, 0.84493, -0.076100, 0.0020936].freeze
16
+ DELTA_T_1941AD_1961AD = [29.07, 0.407, -1 / 233.0, 1 / 2_547.0].freeze
17
+ DELTA_T_1961AD_1986AD = [45.45, 1.067, -1 / 260.0, -1 / 718.0].freeze
18
+ DELTA_T_1986AD_2005AD = [63.86, 0.3345, -0.060374, 0.0017275, 0.000651814, 0.00002373599].freeze
19
+ DELTA_T_2005AD_2050AD = [62.92, 0.32217, 0.005589].freeze
20
+ # rubocop:enable Layout/LineLength
21
+
22
+ # (T) time, measured in Julian centuries from the Epoch J2000.0 (22.1, A.A. p. 143)
23
+ # UNIT: centuries from the Epoch J2000.0
24
+ def time
25
+ @time ||=
26
+ ((julian_ephemeris_day - EPOCH_J2000_JDE) / JULIAN_CENTURY_IN_DAYS).round(12)
27
+ end
28
+
29
+ # ΔT Difference between Dynamical Time (TD) and Universal Time (UT, more commonly
30
+ # known as Greenwhich Time).
31
+ # The formula for ΔT was taken from a later paper written by Espenak and Meeus
32
+ # (https://eclipse.gsfc.nasa.gov/SEcat5/deltatpoly.html). ΔT is described less
33
+ # precisely in the book (A.A. p. 78-79, formulae 10.0 and 10.2).
34
+ # UNIT: seconds
35
+ def delta_t
36
+ @delta_t ||= begin
37
+ result = case datetime.year
38
+ when -1_999...-500
39
+ elapsed_years = (@decimal_year - 1_820) / 100
40
+ -20 + 32 * elapsed_years**2
41
+ when -500...500
42
+ Horner.compute(@decimal_year / 100.0, DELTA_T_500BC_500AD)
43
+ when 500...1_600
44
+ Horner.compute((@decimal_year - 1_000.0) / 100.0, DELTA_T_500AD_1600AD)
45
+ when 1_600...1_700
46
+ Horner.compute(@decimal_year - 1_600.0, DELTA_T_1600AD_1700AD)
47
+ when 1_700...1_800
48
+ Horner.compute(@decimal_year - 1_700.0, DELTA_T_1700AD_1800AD)
49
+ when 1_800...1_860
50
+ Horner.compute(@decimal_year - 1_800, DELTA_T_1800AD_1860AD)
51
+ when 1_860...1_900
52
+ Horner.compute(@decimal_year - 1_860, DELTA_T_1860AD_1900AD)
53
+ when 1_900...1_920
54
+ Horner.compute(@decimal_year - 1_900, DELTA_T_1900AD_1920AD)
55
+ when 1_920...1_941
56
+ Horner.compute(@decimal_year - 1_920, DELTA_T_1920AD_1941AD)
57
+ when 1_941...1_961
58
+ Horner.compute(@decimal_year - 1_950, DELTA_T_1941AD_1961AD)
59
+ when 1_961...1_986
60
+ Horner.compute(@decimal_year - 1_975, DELTA_T_1961AD_1986AD)
61
+ when 1_986...2_005
62
+ Horner.compute(@decimal_year - 2_000, DELTA_T_1986AD_2005AD)
63
+ when 2_005...2_050
64
+ Horner.compute(@decimal_year - 2_000, DELTA_T_2005AD_2050AD)
65
+ when 2_050...2_150
66
+ -20 + 32 * ((@decimal_year - 1_820) / 100)**2 - 0.5628 * (2_150 - @decimal_year)
67
+ when 2_150..3_000
68
+ -20 + 32 * @decimal_year**2
69
+ end
70
+ result.round(1)
71
+ end
72
+ end
73
+
74
+ # (TD) Dynamical time (A.A. p. 77)
75
+ # UNIT: ISO 8601 Date and time with offset
76
+ def dynamical_time
77
+ @dynamical_time ||= datetime + delta_t.round.to_f / SECONDS_PER_DAY
78
+ end
79
+
80
+ # (JDE) Julian ephemeris day (A.A. p. 59)
81
+ # UNIT: days, expressed as a floating point number
82
+ def julian_ephemeris_day
83
+ @julian_ephemeris_day ||= dynamical_time.ajd.to_f.round(5)
84
+ end
85
+
86
+ # (t) time, measured in Julian millennia from the epoch J2000.0 (32.1, A.A. p. 218)
87
+ # UNIT: millennia from the Epoch J2000.0
88
+ def time_millennia
89
+ @time_millennia ||= (time / 10.0).round(12)
90
+ end
91
+
92
+ # (U) Time measured in units of 10_000 Julian years from J2000.0 (A.A. p. 147)
93
+ # UNIT: 10_000 years (myriads) from the Epoch J2000.0
94
+ def time_myriads
95
+ @time_myriads ||= time / 100.0
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,170 @@
1
+ require "date"
2
+ require "yaml"
3
+ require_relative "calculation/earth_position_vsop87"
4
+ require_relative "calculation/moon_illuminated_fraction"
5
+ require_relative "calculation/nutation_and_obliquity"
6
+ require_relative "calculation/moon_position"
7
+ require_relative "calculation/sun_position"
8
+ require_relative "calculation/timekeeping"
9
+
10
+ module Lunation
11
+ class Calculation
12
+ include EarthPositionVSOP87
13
+ include MoonIlluminatedFraction
14
+ include NutationAndObliquity
15
+ include MoonPosition
16
+ include SunPosition
17
+ include Timekeeping
18
+
19
+ attr_reader :datetime, :decimal_year
20
+
21
+ def initialize(datetime = DateTime.now)
22
+ @datetime = datetime
23
+ @decimal_year = datetime.year + (datetime.month - 0.5) / 12.0
24
+ end
25
+
26
+ def to_h
27
+ {
28
+ corrected_obliquity_of_ecliptic: corrected_obliquity_of_ecliptic,
29
+ correction_eccentricity_of_earth: correction_eccentricity_of_earth,
30
+ correction_jupiter: correction_jupiter,
31
+ correction_latitude: correction_latitude,
32
+ correction_venus: correction_venus,
33
+ delta_t: delta_t,
34
+ distance_between_earth_and_moon: distance_between_earth_and_moon,
35
+ distance_between_earth_and_sun_in_astronomical_units: distance_between_earth_and_sun_in_astronomical_units,
36
+ distance_between_earth_and_sun_in_kilometers: distance_between_earth_and_sun_in_kilometers,
37
+ dynamical_time: dynamical_time,
38
+ earth_orbit_eccentricity: earth_orbit_eccentricity,
39
+ ecliptic_latitude_of_earth_using_vsop87: ecliptic_latitude_of_earth_using_vsop87,
40
+ ecliptic_longitude_of_earth_using_vsop87: ecliptic_longitude_of_earth_using_vsop87,
41
+ equatorial_horizontal_parallax: equatorial_horizontal_parallax,
42
+ julian_ephemeris_day: julian_ephemeris_day,
43
+ longitude_of_ascending_node_low_precision: longitude_of_ascending_node_low_precision,
44
+ longitude_of_ascending_node: longitude_of_ascending_node,
45
+ mean_obliquity_of_ecliptic: mean_obliquity_of_ecliptic,
46
+ moon_apparent_ecliptic_longitude: moon_apparent_ecliptic_longitude,
47
+ moon_argument_of_latitude_high_precision: moon_argument_of_latitude_high_precision,
48
+ moon_argument_of_latitude: moon_argument_of_latitude,
49
+ moon_declination: moon_declination,
50
+ moon_ecliptic_latitude: moon_ecliptic_latitude,
51
+ moon_ecliptic_longitude: moon_ecliptic_longitude,
52
+ moon_elongation_from_sun: moon_elongation_from_sun,
53
+ moon_heliocentric_distance: moon_heliocentric_distance,
54
+ moon_heliocentric_latitude: moon_heliocentric_latitude,
55
+ moon_heliocentric_longitude: moon_heliocentric_longitude,
56
+ moon_illuminated_fraction: moon_illuminated_fraction,
57
+ moon_mean_anomaly_high_precision: moon_mean_anomaly_high_precision,
58
+ moon_mean_anomaly: moon_mean_anomaly,
59
+ moon_mean_elongation_from_sun: moon_mean_elongation_from_sun,
60
+ moon_mean_elongation_from_sun_high_precision: moon_mean_elongation_from_sun_high_precision,
61
+ moon_mean_longitude: moon_mean_longitude,
62
+ moon_phase_angle: moon_phase_angle,
63
+ moon_position_angle_of_bright_limb: moon_position_angle_of_bright_limb,
64
+ moon_right_ascension: moon_right_ascension,
65
+ nutation_in_longitude: nutation_in_longitude,
66
+ nutation_in_obliquity: nutation_in_obliquity,
67
+ obliquity_of_ecliptic: obliquity_of_ecliptic,
68
+ radius_vector_of_earth_using_vsop87: radius_vector_of_earth_using_vsop87,
69
+ sun_anomaly: sun_anomaly,
70
+ sun_declination: sun_declination,
71
+ sun_ecliptic_longitude: sun_ecliptic_longitude,
72
+ sun_equation_of_center: sun_equation_of_center,
73
+ sun_mean_anomaly: sun_mean_anomaly,
74
+ sun_mean_anomaly2: sun_mean_anomaly2,
75
+ sun_mean_longitude: sun_mean_longitude,
76
+ sun_right_ascension: sun_right_ascension,
77
+ sun_true_longitude: sun_true_longitude,
78
+ time_millennia: time_millennia,
79
+ time_myriads: time_myriads,
80
+ time: time,
81
+ }
82
+ end
83
+
84
+ def to_s
85
+ <<-HEREDOC
86
+ DATE AND TIME (UT): #{datetime}
87
+ ----------------------------------------------------------------------------------
88
+ DECIMAL YEAR: #{decimal_year}
89
+ DELTA T: #{delta_t}
90
+ DYNAMICAL TIME: #{dynamical_time}
91
+ JULIAN EPHEMERIS DAY: #{julian_ephemeris_day}
92
+ JULIAN MYRIADS (10K YEARS) SINCE J2000: #{time_myriads}
93
+ TIME (JULIAN CENTURIES): #{time}
94
+ TIME (JULIAN MILLENNIA): #{time_millennia}
95
+
96
+ **********************************************************************************
97
+ NUTATION AND OBLIQUITY
98
+ **********************************************************************************
99
+
100
+ EARTH NUTATION IN LONGITUDE: #{nutation_in_longitude.decimal_degrees}°
101
+ ECLIPTIC MEAN OBLIQUITY: #{mean_obliquity_of_ecliptic.decimal_degrees}°
102
+ ECLIPTIC TRUE OBLIQUITY: #{obliquity_of_ecliptic.decimal_degrees}°
103
+ MOON ARGUMENT OF LATITUDE: #{moon_argument_of_latitude.decimal_degrees}°
104
+ MOON MEAN ANOMALY: #{moon_mean_anomaly.decimal_degrees}°
105
+ MOON MEAN ELONGATION FROM THE SUN: #{moon_mean_elongation_from_sun.decimal_degrees}°
106
+ LONGITUDE OF ASCENDING NODE: #{longitude_of_ascending_node.decimal_degrees}°
107
+ NUTATION IN OBLIQUITY: #{nutation_in_obliquity.decimal_degrees}°
108
+ SUN MEAN ANOMALY: #{sun_mean_anomaly.decimal_degrees}°
109
+
110
+ **********************************************************************************
111
+ POSITION OF THE SUN AND EARTH
112
+ **********************************************************************************
113
+
114
+ CORRECTED OBLIQUITY OF THE ECLIPTIC: #{corrected_obliquity_of_ecliptic.decimal_degrees}°
115
+ ECCENTRICITY OF THE EARTH'S ORBIT: #{earth_orbit_eccentricity}
116
+ EARTH-SUN DISTANCE (AU): #{distance_between_earth_and_sun_in_astronomical_units}
117
+ EARTH-SUN DISTANCE (KM): #{distance_between_earth_and_sun_in_kilometers}
118
+ LONGITUDE OF ASCENDING NODE (LOW PRECISION): #{longitude_of_ascending_node.decimal_degrees}°
119
+ SUN ECLIPTICAL LONGITUDE: #{sun_ecliptic_longitude.decimal_degrees}°
120
+ SUN EQUATION CENTER: #{sun_equation_of_center.decimal_degrees}°
121
+ SUN GEOCENTRIC DECLINATION: #{sun_declination.decimal_degrees}°
122
+ SUN GEOCENTRIC MEAN LONGITUDE: #{sun_mean_longitude.decimal_degrees}°
123
+ SUN GEOCENTRIC RIGHT ASCENSION: #{sun_right_ascension.decimal_degrees}°
124
+ SUN MEAN ANOMALY2: #{sun_mean_anomaly2.decimal_degrees}°
125
+ SUN TRUE ANOMALY: #{sun_anomaly.decimal_degrees}°
126
+ SUN TRUE LONGITUDE: #{sun_true_longitude.decimal_degrees}°
127
+
128
+ **********************************************************************************
129
+ POSITION OF THE MOON
130
+ **********************************************************************************
131
+
132
+ CORRECTION JUPITER: #{correction_jupiter.decimal_degrees}°
133
+ CORRECTION LATITUDE: #{correction_latitude.decimal_degrees}°
134
+ CORRECTION VENUS: #{correction_venus.decimal_degrees}°
135
+ CORRECTION EARTH ECCENTRICITY: #{correction_eccentricity_of_earth}
136
+ EARTH-MOON DISTANCE (KM): #{distance_between_earth_and_moon}
137
+ EQUITORIAL HORIZONTAL PARALLAX: #{equatorial_horizontal_parallax.decimal_degrees}°
138
+ MOON ARGUMENT OF LATITUDE: #{moon_argument_of_latitude_high_precision.decimal_degrees}°
139
+ MOON ECLIPTIC LATITUDE: #{moon_ecliptic_latitude.decimal_degrees}°
140
+ MOON ECLIPTIC LONGITUDE: #{moon_apparent_ecliptic_longitude.decimal_degrees}°
141
+ MOON GEOCENTRIC DECLINATION: #{moon_declination.decimal_degrees}°
142
+ MOON GEOCENTRIC LONGITUDE: #{moon_ecliptic_longitude.decimal_degrees}°
143
+ MOON GEOCENTRIC RIGHT ASCENSION: #{moon_right_ascension.decimal_degrees}°
144
+ MOON HELIOCENTRIC DISTANCE: #{moon_heliocentric_distance}
145
+ MOON HELIOCENTRIC LATITUDE: #{moon_heliocentric_latitude}
146
+ MOON HELIOCENTRIC LONGITUDE: #{moon_heliocentric_longitude}
147
+ MOON MEAN ANOMALY: #{moon_mean_anomaly_high_precision.decimal_degrees}°
148
+ MOON MEAN ELONGATION: #{moon_mean_elongation_from_sun_high_precision.decimal_degrees}°
149
+ MOON MEAN LONGITUDE: #{moon_mean_longitude.decimal_degrees}°
150
+
151
+ **********************************************************************************
152
+ MOON ILLUMINATED FRACTION
153
+ **********************************************************************************
154
+
155
+ MOON ELONGATION FROM SUN: #{moon_elongation_from_sun.decimal_degrees}°
156
+ MOON ILLUMINATED FRACTION: #{moon_illuminated_fraction}
157
+ MOON PHASE ANGLE: #{moon_phase_angle.decimal_degrees}°
158
+ MOON POSITION ANGLE OF BRIGHT LIMB #{moon_position_angle_of_bright_limb.decimal_degrees}°
159
+
160
+ **********************************************************************************
161
+ EARTH POSITION VSOP87
162
+ **********************************************************************************
163
+
164
+ EARTH ECLIPTICAL LATITUDE VSOP87: #{ecliptic_latitude_of_earth_using_vsop87.decimal_degrees}°
165
+ EARTH ECLIPTICAL LONGITUDE VSOP87: #{ecliptic_longitude_of_earth_using_vsop87.decimal_degrees}°
166
+ EARTH RADIUS VECTOR VSOP87: #{radius_vector_of_earth_using_vsop87}
167
+ HEREDOC
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lunation
4
+ VERSION = "0.1.0"
5
+ end
data/lib/lunation.rb ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lunation/version"
4
+ require_relative "lunation/calculation"
5
+ require_relative "lunation/calculation/angle"
6
+ require_relative "lunation/calculation/horner"
7
+
8
+ module Lunation
9
+ class Error < StandardError; end
10
+ # Your code goes here...
11
+ end
data/sig/lunation.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Lunation
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lunation
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ivo Kalverboer
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-12-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Lunation offers a Ruby implementation of Meeus's Astronomical Algorithms.
14
+ email:
15
+ - ivokalver@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - ".rubocop.yml"
22
+ - CHANGELOG.md
23
+ - CODE_OF_CONDUCT.md
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - config/jpl_horizons_lunar_ephemeris_1950_2050.csv
28
+ - config/periodic_terms_earth_nutation.yml
29
+ - config/periodic_terms_earth_position_b0.yml
30
+ - config/periodic_terms_earth_position_b1.yml
31
+ - config/periodic_terms_earth_position_l0.yml
32
+ - config/periodic_terms_earth_position_l1.yml
33
+ - config/periodic_terms_earth_position_l2.yml
34
+ - config/periodic_terms_earth_position_l3.yml
35
+ - config/periodic_terms_earth_position_l4.yml
36
+ - config/periodic_terms_earth_position_l5.yml
37
+ - config/periodic_terms_earth_position_r0.yml
38
+ - config/periodic_terms_earth_position_r1.yml
39
+ - config/periodic_terms_earth_position_r2.yml
40
+ - config/periodic_terms_earth_position_r3.yml
41
+ - config/periodic_terms_earth_position_r4.yml
42
+ - config/periodic_terms_moon_latitude.yml
43
+ - config/periodic_terms_moon_longitude_distance.yml
44
+ - lib/lunation.rb
45
+ - lib/lunation/calculation.rb
46
+ - lib/lunation/calculation/angle.rb
47
+ - lib/lunation/calculation/earth_position_vsop87.rb
48
+ - lib/lunation/calculation/horner.rb
49
+ - lib/lunation/calculation/moon_illuminated_fraction.rb
50
+ - lib/lunation/calculation/moon_position.rb
51
+ - lib/lunation/calculation/nutation_and_obliquity.rb
52
+ - lib/lunation/calculation/sun_position.rb
53
+ - lib/lunation/calculation/timekeeping.rb
54
+ - lib/lunation/version.rb
55
+ - sig/lunation.rbs
56
+ homepage: https://www.github.com/valerius/lunation
57
+ licenses:
58
+ - MIT
59
+ metadata:
60
+ homepage_uri: https://www.github.com/valerius/lunation
61
+ source_code_uri: https://www.github.com/valerius/lunation
62
+ changelog_uri: https://www.github.com/valerius/lunation/CHANGELOG.md
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 2.6.0
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubygems_version: 3.4.21
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Astronomical Algorithms in Ruby
82
+ test_files: []