astronoby 0.6.0 → 0.7.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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/.standard.yml +1 -0
- data/CHANGELOG.md +116 -0
- data/Gemfile.lock +45 -23
- data/README.md +42 -285
- data/UPGRADING.md +238 -0
- data/lib/astronoby/aberration.rb +56 -31
- data/lib/astronoby/angle.rb +20 -16
- data/lib/astronoby/angles/dms.rb +2 -2
- data/lib/astronoby/angles/hms.rb +2 -2
- data/lib/astronoby/bodies/earth.rb +56 -0
- data/lib/astronoby/bodies/jupiter.rb +11 -0
- data/lib/astronoby/bodies/mars.rb +11 -0
- data/lib/astronoby/bodies/mercury.rb +11 -0
- data/lib/astronoby/bodies/moon.rb +50 -290
- data/lib/astronoby/bodies/neptune.rb +11 -0
- data/lib/astronoby/bodies/saturn.rb +11 -0
- data/lib/astronoby/bodies/solar_system_body.rb +122 -0
- data/lib/astronoby/bodies/sun.rb +16 -220
- data/lib/astronoby/bodies/uranus.rb +11 -0
- data/lib/astronoby/bodies/venus.rb +11 -0
- data/lib/astronoby/constants.rb +13 -1
- data/lib/astronoby/coordinates/ecliptic.rb +2 -37
- data/lib/astronoby/coordinates/equatorial.rb +25 -7
- data/lib/astronoby/coordinates/horizontal.rb +0 -46
- data/lib/astronoby/corrections/light_time_delay.rb +90 -0
- data/lib/astronoby/deflection.rb +187 -0
- data/lib/astronoby/distance.rb +9 -0
- data/lib/astronoby/ephem.rb +39 -0
- data/lib/astronoby/equinox_solstice.rb +21 -18
- data/lib/astronoby/errors.rb +4 -0
- data/lib/astronoby/events/moon_phases.rb +2 -1
- data/lib/astronoby/events/rise_transit_set_calculator.rb +352 -0
- data/lib/astronoby/events/rise_transit_set_event.rb +13 -0
- data/lib/astronoby/events/rise_transit_set_events.rb +13 -0
- data/lib/astronoby/events/twilight_calculator.rb +166 -0
- data/lib/astronoby/events/twilight_event.rb +28 -0
- data/lib/astronoby/instant.rb +171 -0
- data/lib/astronoby/mean_obliquity.rb +23 -10
- data/lib/astronoby/nutation.rb +227 -42
- data/lib/astronoby/observer.rb +55 -0
- data/lib/astronoby/precession.rb +91 -17
- data/lib/astronoby/reference_frame.rb +49 -0
- data/lib/astronoby/reference_frames/apparent.rb +60 -0
- data/lib/astronoby/reference_frames/astrometric.rb +21 -0
- data/lib/astronoby/reference_frames/geometric.rb +20 -0
- data/lib/astronoby/reference_frames/mean_of_date.rb +38 -0
- data/lib/astronoby/reference_frames/topocentric.rb +82 -0
- data/lib/astronoby/true_obliquity.rb +2 -1
- data/lib/astronoby/util/maths.rb +70 -73
- data/lib/astronoby/util/time.rb +454 -31
- data/lib/astronoby/vector.rb +36 -0
- data/lib/astronoby/velocity.rb +116 -0
- data/lib/astronoby/version.rb +1 -1
- data/lib/astronoby.rb +26 -5
- metadata +61 -16
- data/.tool-versions +0 -1
- data/lib/astronoby/astronomical_models/ephemeride_lunaire_parisienne.rb +0 -143
- data/lib/astronoby/events/observation_events.rb +0 -285
- data/lib/astronoby/events/rise_transit_set_iteration.rb +0 -218
- data/lib/astronoby/events/twilight_events.rb +0 -121
- data/lib/astronoby/util/astrodynamics.rb +0 -60
data/UPGRADING.md
CHANGED
@@ -7,6 +7,244 @@ changes to it as long as a major version has not been released.
|
|
7
7
|
If you are already using Astronoby and wish to follow the changes to its
|
8
8
|
public API, please read the upgrading notes for each release.
|
9
9
|
|
10
|
+
## Upgrading from 0.6.0 to 0.7.0
|
11
|
+
|
12
|
+
## Signature change for `Sun` and `Moon`
|
13
|
+
|
14
|
+
Both classes are now initialized with the key arguments `ephem` and `instant`.
|
15
|
+
`ephem` comes from `Ephem.load` which provides the raw geometric data for Solar
|
16
|
+
System bodies. `instant` is an instance of `Instant`, the new concept for
|
17
|
+
representing an instant in time.
|
18
|
+
|
19
|
+
```rb
|
20
|
+
Ephem::IO::Download.call(name: "de421.bsp", target: "tmp/de421.bsp")
|
21
|
+
ephem = Astronoby::Ephem.load("tmp/de421.bsp")
|
22
|
+
|
23
|
+
time = Time.utc(2025, 6, 19, 12, 0, 0)
|
24
|
+
instant = Astronoby::Instant.from_time(time)
|
25
|
+
|
26
|
+
sun = Astronoby::Sun.new(instant: instant, ephem: ephem)
|
27
|
+
```
|
28
|
+
|
29
|
+
Learn more on [ephem].
|
30
|
+
|
31
|
+
[ephem]: https://github.com/rhannequin/astronoby/wiki/Ephem
|
32
|
+
|
33
|
+
## Drop of methods for `Sun`
|
34
|
+
|
35
|
+
`Sun` doesn't expose the following class and instance methods anymore:
|
36
|
+
* `::equation_of_time` (replaced with `#equation_of_time`)
|
37
|
+
* `#epoch` (replaced with `#instant`)
|
38
|
+
* `#true_ecliptic_coordinates` (replaced with `#ecliptic` on reference frames)
|
39
|
+
* `#apparent_ecliptic_coordinates` (replaced with `#ecliptic` on reference frames)
|
40
|
+
* `#horizontal_coordinates` (replaced with `#horizontal` on the Topocentric reference frame)
|
41
|
+
* `#observation_events`
|
42
|
+
* `#twilight_events`
|
43
|
+
* `#earth_distance` (replaced with `#distance` on referential frames)
|
44
|
+
* `#angular_size` (replaced with `#angular_diameter` on referential frames)
|
45
|
+
* `#true_anomaly`
|
46
|
+
* `#mean_anomaly`
|
47
|
+
* `#longitude_at_perigee`
|
48
|
+
* `#orbital_eccentricity`
|
49
|
+
|
50
|
+
Learn more on [reference frames].
|
51
|
+
|
52
|
+
[reference frames]: https://github.com/rhannequin/astronoby/wiki/Reference-Frames
|
53
|
+
|
54
|
+
## Drop of instance methods for `Moon`
|
55
|
+
|
56
|
+
`Moon` doesn't expose the following nstance methods anymore:
|
57
|
+
* `#apparent_ecliptic_coordinates` (replaced with `#ecliptic` on reference frames)
|
58
|
+
* `#apparent_equatorial_coordinates` (replaced with `#equatorial` on reference frames)
|
59
|
+
* `#horizontal_coordinates` (replaced with the Apparent and Topocentric reference frames)
|
60
|
+
* `#distance` (replaced with `#distance` on referential frames)
|
61
|
+
* `#mean_longitude`
|
62
|
+
* `#mean_elongation`
|
63
|
+
* `#mean_anomaly`
|
64
|
+
* `#argument_of_latitude`
|
65
|
+
* `#phase_angle`
|
66
|
+
* `#observation_events`
|
67
|
+
|
68
|
+
## Signature change for `Aberration`
|
69
|
+
|
70
|
+
`Aberration` is now initialized with the key arguments `astrometric_position`
|
71
|
+
and `observer_velocity`. `astrometric_position` is a position vector
|
72
|
+
(`Astronoby::Vector<Astronoby::Distance>`) available from any referential frame
|
73
|
+
with the `#position` method.`observer_velocity` is a velocity vector
|
74
|
+
(`Astronoby::Vector<Astronoby::Distance>`) available from any referential frame
|
75
|
+
with the `#velocity` method.
|
76
|
+
|
77
|
+
`observer_velocity` is meant to be a geometric velocity, while
|
78
|
+
`astrometric_position` is meant to be an astrometric position.
|
79
|
+
|
80
|
+
```rb
|
81
|
+
time = Time.utc(2025, 4, 1)
|
82
|
+
instant = Astronoby::Instant.from_time(time)
|
83
|
+
ephem = Astronoby::Ephem.load("de421.bsp")
|
84
|
+
earth = Astronoby::Earth.new(instant: instant, ephem: ephem)
|
85
|
+
mars = Astronoby::Mars.new(instant: instant, ephem: ephem)
|
86
|
+
earth_geometric_velocity = earth.geometric.velocity
|
87
|
+
mars_astrometric_position = mars.astrometric.position
|
88
|
+
|
89
|
+
aberration = Astronoby::Aberration.new(
|
90
|
+
astrometric_position: mars_astrometric_position,
|
91
|
+
observer_velocity: earth_geometric_velocity
|
92
|
+
)
|
93
|
+
```
|
94
|
+
|
95
|
+
## Signature change for `Angle#to_dms` and `Angle#to_hms`
|
96
|
+
|
97
|
+
`Angle#to_dms` and `Angle#to_hms` don't have arguments anymore. The angle value
|
98
|
+
is now taken from the object itself. This was a misbehavior in the previous
|
99
|
+
implementation.
|
100
|
+
|
101
|
+
```rb
|
102
|
+
angle = Astronoby::Angle.from_degrees(45.0)
|
103
|
+
dms = angle.to_dms
|
104
|
+
|
105
|
+
dms.format
|
106
|
+
# => "+45° 0′ 0.0″"
|
107
|
+
```
|
108
|
+
|
109
|
+
## Signature change for `EquinoxSolstice`
|
110
|
+
|
111
|
+
`EquinoxSolstice.new` now takes an additional argument expected to be an ephem
|
112
|
+
(`Astronoby::Ephem`).
|
113
|
+
|
114
|
+
## Signature change for `Nutation`
|
115
|
+
|
116
|
+
The expected `epoch` (`Astronoby::Epoch`) argument has been replaced by an
|
117
|
+
`instant` (`Astronoby::Instant`) key argument.
|
118
|
+
|
119
|
+
## Drop of `Nutation::for_ecliptic_longitude` and `Nutation::for_obliquity_of_the_ecliptic`
|
120
|
+
|
121
|
+
`Nutation::for_ecliptic_longitude` and `Nutation::for_obliquity_of_the_ecliptic`
|
122
|
+
methods have been removed. The `Nutation` class now exposes the
|
123
|
+
`#nutation_in_longitude` and `#nutation_in_obliquity` instance methods which
|
124
|
+
both return an angle (`Astronoby::Angle`).
|
125
|
+
|
126
|
+
## Signature change for `Precession`
|
127
|
+
|
128
|
+
The expected `coordinates` and `epoch` (`Astronoby::Epoch`) key arguments have
|
129
|
+
been replaced by an `instant` (`Astronoby::Instant`) key argument.
|
130
|
+
|
131
|
+
## Drop of `Precession#for_equatorial_coordinates` and `Precession#precess`
|
132
|
+
|
133
|
+
`Precession#for_equatorial_coordinates` and `Precession#precess` methods have
|
134
|
+
been refactoed into class methods.
|
135
|
+
|
136
|
+
## Drop of `Coordinates::Horizontal#to_equatorial`
|
137
|
+
|
138
|
+
`Coordinates::Horizontal#to_equatorial` has been removed as equatorial
|
139
|
+
coordinates are now available from the reference frames.
|
140
|
+
|
141
|
+
## Drop of instance methods for `Coordinates::Ecliptic`
|
142
|
+
|
143
|
+
`Coordinates::Ecliptic#to_true_equatorial` and
|
144
|
+
`Coordinates::Ecliptic#to_apparent_equatorial` have been removed as
|
145
|
+
equatorial coordinates are now available from the reference frames.
|
146
|
+
|
147
|
+
## Drop of `Coordinates::Equatorial#to_epoch`
|
148
|
+
|
149
|
+
`Coordinates::Equatorial#to_epoch` has been removed.
|
150
|
+
|
151
|
+
## Drop of `Events::ObservationEvents`
|
152
|
+
|
153
|
+
`Events::ObservationEvents` has been removed. The rising, transit and setting
|
154
|
+
times can now be calculated using `RiseTransitSetCalculator`.
|
155
|
+
|
156
|
+
```rb
|
157
|
+
ephem = Astronoby::Ephem.load("inpop19a.bsp")
|
158
|
+
observer = Astronoby::Observer.new(
|
159
|
+
latitude: Astronoby::Angle.from_degrees(48),
|
160
|
+
longitude: Astronoby::Angle.from_degrees(2)
|
161
|
+
)
|
162
|
+
date = Date.new(2025, 4, 24)
|
163
|
+
|
164
|
+
calculator = Astronoby::RiseTransitSetCalculator.new(
|
165
|
+
body: Astronoby::Sun,
|
166
|
+
observer: observer,
|
167
|
+
ephem: ephem
|
168
|
+
)
|
169
|
+
|
170
|
+
event = calculator.event_on(date)
|
171
|
+
|
172
|
+
event.rising_time
|
173
|
+
# => 2025-04-24 04:45:42 UTC
|
174
|
+
|
175
|
+
event.transit_time
|
176
|
+
# => 2025-04-24 11:50:04 UTC
|
177
|
+
|
178
|
+
event.setting_time
|
179
|
+
# => 2025-04-24 18:55:24 UTC
|
180
|
+
```
|
181
|
+
|
182
|
+
## Drop of `RiseTransitSetIteration`
|
183
|
+
|
184
|
+
`RiseTransitSetIteration` has been removed as it was only used by
|
185
|
+
`Events::ObservationEvents`.
|
186
|
+
|
187
|
+
## Drop of `Events::TwilightEvents`
|
188
|
+
|
189
|
+
`Events::TwilightEvents` has been removed. The twilight times can now be
|
190
|
+
calculated using `TwilightCalculator`.
|
191
|
+
|
192
|
+
```rb
|
193
|
+
ephem = Astronoby::Ephem.load("inpop19a.bsp")
|
194
|
+
observer = Astronoby::Observer.new(
|
195
|
+
latitude: Astronoby::Angle.from_degrees(48),
|
196
|
+
longitude: Astronoby::Angle.from_degrees(2)
|
197
|
+
)
|
198
|
+
date = Date.new(2025, 4, 24)
|
199
|
+
|
200
|
+
calculator = Astronoby::TwilightCalculator.new(
|
201
|
+
observer: observer,
|
202
|
+
ephem: ephem
|
203
|
+
)
|
204
|
+
|
205
|
+
event = calculator.event_on(date)
|
206
|
+
# Returns a Astronoby::TwilightEvent object
|
207
|
+
|
208
|
+
event.morning_astronomical_twilight_time
|
209
|
+
# => 2025-04-24 02:43:38 UTC
|
210
|
+
|
211
|
+
event.morning_nautical_twilight_time
|
212
|
+
# => 2025-04-24 03:30:45 UTC
|
213
|
+
|
214
|
+
event.morning_civil_twilight_time
|
215
|
+
# => 2025-04-24 04:12:38 UTC
|
216
|
+
|
217
|
+
event.evening_civil_twilight_time
|
218
|
+
# => 2025-04-24 19:27:34 UTC
|
219
|
+
|
220
|
+
event.evening_nautical_twilight_time
|
221
|
+
# => 2025-04-24 20:09:27 UTC
|
222
|
+
|
223
|
+
event.evening_astronomical_twilight_time
|
224
|
+
# => 2025-04-24 20:56:34 UTC
|
225
|
+
```
|
226
|
+
|
227
|
+
## Drop of `EphemerideLunaireParisienne`
|
228
|
+
|
229
|
+
`EphemerideLunaireParisienne` has been removed.
|
230
|
+
|
231
|
+
## Drop of `Util::Astrodynamics`
|
232
|
+
|
233
|
+
`Util::Astrodynamics` has been removed.
|
234
|
+
|
235
|
+
## Drop of `Util::Maths.interpolate` and `Util::Maths.normalize_angles_for_interpolation`
|
236
|
+
|
237
|
+
`Util::Maths.interpolate` and `Util::Maths.normalize_angles_for_interpolation`
|
238
|
+
have been removed.
|
239
|
+
|
240
|
+
## Drop of `Constants::SECONDS_PER_DEGREE`
|
241
|
+
|
242
|
+
`Constants::SECONDS_PER_DEGREE` has been removed.
|
243
|
+
|
244
|
+
## Upgrading from 0.5.0 to 0.6.0
|
245
|
+
|
246
|
+
No breaking changes.
|
247
|
+
|
10
248
|
## Upgrading from 0.4.0 to 0.5.0
|
11
249
|
|
12
250
|
### `Sun#horizontal_coordinates` method signature changed ([#69])
|
data/lib/astronoby/aberration.rb
CHANGED
@@ -1,47 +1,72 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Astronoby
|
4
|
+
# Applies relativistic aberration corrections to an astrometric position based
|
5
|
+
# on observer velocity.
|
4
6
|
class Aberration
|
5
|
-
|
7
|
+
# Source:
|
8
|
+
# Title: Explanatory Supplement to the Astronomical Almanac
|
9
|
+
# Authors: Sean E. Urban and P. Kenneth Seidelmann
|
10
|
+
# Edition: University Science Books
|
11
|
+
# Chapter: 7.2.3 - Aberration
|
6
12
|
|
7
|
-
|
8
|
-
new(coordinates, epoch).apply
|
9
|
-
end
|
13
|
+
LIGHT_SPEED = Astronoby::Velocity.light_speed.mps
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
15
|
+
# Initializes the aberration correction with position and observer velocity.
|
16
|
+
#
|
17
|
+
# @param astrometric_position [Astronoby::Vector<Astronoby::Distance>] The
|
18
|
+
# astrometric position vector.
|
19
|
+
# @param observer_velocity [Astronoby::Vector<Astronoby::Velocity>] The
|
20
|
+
# velocity vector of the observer.
|
21
|
+
def initialize(astrometric_position:, observer_velocity:)
|
22
|
+
@position = astrometric_position
|
23
|
+
@velocity = observer_velocity
|
24
|
+
@distance_meters = @position.norm.m
|
25
|
+
@observer_speed = @velocity.norm.mps
|
14
26
|
end
|
15
27
|
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
sun_longitude - @coordinates.longitude
|
25
|
-
).cos / @coordinates.latitude.cos / Constants::SECONDS_PER_DEGREE
|
26
|
-
)
|
28
|
+
# Computes the aberration-corrected position.
|
29
|
+
#
|
30
|
+
# @return [Astronoby::Vector<Astronoby::Distance>] The corrected position
|
31
|
+
# vector.
|
32
|
+
def corrected_position
|
33
|
+
beta = @observer_speed / LIGHT_SPEED
|
34
|
+
projected_velocity = beta * aberration_angle_cos
|
35
|
+
lorentz_factor_inv = lorentz_factor_inverse(beta)
|
27
36
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
)
|
37
|
+
velocity_correction =
|
38
|
+
velocity_correction_factor(projected_velocity) * velocity_mps
|
39
|
+
normalization_factor = 1.0 + projected_velocity
|
40
|
+
position_scaled = position_meters * lorentz_factor_inv
|
33
41
|
|
34
|
-
|
35
|
-
|
36
|
-
longitude: @coordinates.longitude + delta_longitude
|
42
|
+
Distance.vector_from_meters(
|
43
|
+
(position_scaled + velocity_correction) / normalization_factor
|
37
44
|
)
|
38
45
|
end
|
39
46
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
47
|
+
private
|
48
|
+
|
49
|
+
def aberration_angle_cos
|
50
|
+
denominator = [@distance_meters * @observer_speed, 1e-20].max
|
51
|
+
Util::Maths.dot_product(position_meters, velocity_mps) / denominator
|
52
|
+
end
|
53
|
+
|
54
|
+
def position_meters
|
55
|
+
@position.map(&:meters)
|
56
|
+
end
|
57
|
+
|
58
|
+
def velocity_mps
|
59
|
+
@velocity.map(&:mps)
|
60
|
+
end
|
61
|
+
|
62
|
+
def lorentz_factor_inverse(beta)
|
63
|
+
Math.sqrt(1.0 - beta**2)
|
64
|
+
end
|
65
|
+
|
66
|
+
def velocity_correction_factor(projected_velocity)
|
67
|
+
lorentz_inv = lorentz_factor_inverse(projected_velocity)
|
68
|
+
(1.0 + projected_velocity / (1.0 + lorentz_inv)) *
|
69
|
+
(@distance_meters / LIGHT_SPEED)
|
45
70
|
end
|
46
71
|
end
|
47
72
|
end
|
data/lib/astronoby/angle.rb
CHANGED
@@ -22,6 +22,10 @@ module Astronoby
|
|
22
22
|
from_radians(radians)
|
23
23
|
end
|
24
24
|
|
25
|
+
def from_degree_arcseconds(arcseconds)
|
26
|
+
from_dms(0, 0, arcseconds)
|
27
|
+
end
|
28
|
+
|
25
29
|
def from_hours(hours)
|
26
30
|
radians = hours * Constants::RADIAN_PER_HOUR
|
27
31
|
from_radians(radians)
|
@@ -120,10 +124,10 @@ module Astronoby
|
|
120
124
|
end
|
121
125
|
alias_method :eql?, :==
|
122
126
|
|
123
|
-
def str(format)
|
127
|
+
def str(format, precision: 4)
|
124
128
|
case format
|
125
|
-
when :dms then to_dms(
|
126
|
-
when :hms then to_hms(
|
129
|
+
when :dms then to_dms.format(precision: precision)
|
130
|
+
when :hms then to_hms.format(precision: precision)
|
127
131
|
else
|
128
132
|
raise UnsupportedFormatError.new(
|
129
133
|
"Expected a format between #{FORMATS.join(", ")}, got #{format}"
|
@@ -131,36 +135,36 @@ module Astronoby
|
|
131
135
|
end
|
132
136
|
end
|
133
137
|
|
134
|
-
def to_dms
|
135
|
-
sign =
|
136
|
-
absolute_degrees =
|
137
|
-
|
138
|
+
def to_dms
|
139
|
+
sign = degrees.negative? ? "-" : "+"
|
140
|
+
absolute_degrees = degrees.abs
|
141
|
+
deg = absolute_degrees.floor
|
138
142
|
decimal_minutes = Constants::MINUTES_PER_DEGREE *
|
139
|
-
(absolute_degrees -
|
143
|
+
(absolute_degrees - deg)
|
140
144
|
absolute_decimal_minutes = (
|
141
|
-
Constants::MINUTES_PER_DEGREE * (absolute_degrees -
|
145
|
+
Constants::MINUTES_PER_DEGREE * (absolute_degrees - deg)
|
142
146
|
).abs
|
143
147
|
minutes = decimal_minutes.floor
|
144
148
|
seconds = Constants::SECONDS_PER_MINUTE * (
|
145
149
|
absolute_decimal_minutes - absolute_decimal_minutes.floor
|
146
150
|
)
|
147
151
|
|
148
|
-
Dms.new(sign,
|
152
|
+
Dms.new(sign, deg, minutes, seconds)
|
149
153
|
end
|
150
154
|
|
151
|
-
def to_hms
|
152
|
-
absolute_hours =
|
153
|
-
|
154
|
-
decimal_minutes = Constants::MINUTES_PER_HOUR * (absolute_hours -
|
155
|
+
def to_hms
|
156
|
+
absolute_hours = hours.abs
|
157
|
+
hrs = absolute_hours.floor
|
158
|
+
decimal_minutes = Constants::MINUTES_PER_HOUR * (absolute_hours - hrs)
|
155
159
|
absolute_decimal_minutes = (
|
156
|
-
Constants::MINUTES_PER_HOUR * (absolute_hours -
|
160
|
+
Constants::MINUTES_PER_HOUR * (absolute_hours - hrs)
|
157
161
|
).abs
|
158
162
|
minutes = decimal_minutes.floor
|
159
163
|
seconds = Constants::SECONDS_PER_MINUTE * (
|
160
164
|
absolute_decimal_minutes - absolute_decimal_minutes.floor
|
161
165
|
)
|
162
166
|
|
163
|
-
Hms.new(
|
167
|
+
Hms.new(hrs, minutes, seconds)
|
164
168
|
end
|
165
169
|
end
|
166
170
|
end
|
data/lib/astronoby/angles/dms.rb
CHANGED
data/lib/astronoby/angles/hms.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Astronoby
|
4
|
+
class Earth < SolarSystemBody
|
5
|
+
def self.ephemeris_segments(ephem_source)
|
6
|
+
if ephem_source == ::Ephem::SPK::JPL_DE
|
7
|
+
[
|
8
|
+
[SOLAR_SYSTEM_BARYCENTER, EARTH_MOON_BARYCENTER],
|
9
|
+
[EARTH_MOON_BARYCENTER, EARTH]
|
10
|
+
]
|
11
|
+
elsif ephem_source == ::Ephem::SPK::INPOP
|
12
|
+
[
|
13
|
+
[SOLAR_SYSTEM_BARYCENTER, EARTH]
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def compute_astrometric(ephem)
|
21
|
+
Astrometric.new(
|
22
|
+
position: Vector[
|
23
|
+
Distance.zero,
|
24
|
+
Distance.zero,
|
25
|
+
Distance.zero
|
26
|
+
],
|
27
|
+
velocity: Vector[
|
28
|
+
Velocity.zero,
|
29
|
+
Velocity.zero,
|
30
|
+
Velocity.zero
|
31
|
+
],
|
32
|
+
instant: @instant,
|
33
|
+
center_identifier: EARTH,
|
34
|
+
target_body: self.class
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def compute_mean_of_date(ephem)
|
39
|
+
MeanOfDate.new(
|
40
|
+
position: Vector[
|
41
|
+
Distance.zero,
|
42
|
+
Distance.zero,
|
43
|
+
Distance.zero
|
44
|
+
],
|
45
|
+
velocity: Vector[
|
46
|
+
Velocity.zero,
|
47
|
+
Velocity.zero,
|
48
|
+
Velocity.zero
|
49
|
+
],
|
50
|
+
instant: @instant,
|
51
|
+
center_identifier: EARTH,
|
52
|
+
target_body: self.class
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|