Skip to content

Introduce observation events for Moon#86

Merged
rhannequin merged 1 commit intomainfrom
moonrise-moonset-times
Jun 5, 2024
Merged

Introduce observation events for Moon#86
rhannequin merged 1 commit intomainfrom
moonrise-moonset-times

Conversation

@rhannequin
Copy link
Owner

Like the Sun, the Moon is a candidate for events defined in Astronoby::Events::ObservationEvents, such as rising, transit and setting times, or rising and setting azimuths, or transit altitude.

This adds Astronoby::Moon#observation_events method, with an observer as parameter.

This change also refactors how observation events are computed, introducing a loop to increase precision, as explained in Astronomical Algorithms.

From a few tests, the error margin with the IMCCE is around 2 minutes maximum.

time = Time.utc(2024, 5, 31)
observer = Astronoby::Observer.new(
  latitude: Astronoby::Angle.zero,
  longitude: Astronoby::Angle.zero
)
moon = Astronoby::Moon.new(time: time)

observation_events = moon.observation_events(observer: observer)

observation_events.rising_time
# => 2024-05-31 00:29:50 UTC

observation_events.transit_time
# => 2024-05-31 06:41:22 UTC

observation_events.setting_time
# => 2024-05-31 12:52:48 UTC

observation_events.rising_azimuth.str(:dms)
# => "+98° 47′ 20.2285″"

observation_events.transit_altitude.str(:dms)
# => "+83° 2′ 9.8145″"

observation_events.setting_azimuth.str(:dms)
# => "+264° 35′ 11.0134″"

@rhannequin rhannequin self-assigned this May 31, 2024
@rhannequin rhannequin force-pushed the factorize-moon-phases-periodic-terms branch from c29347d to 2de743f Compare May 31, 2024 23:35
Base automatically changed from factorize-moon-phases-periodic-terms to main May 31, 2024 23:40
Like the Sun, the Moon is a candidate for events defined in
`Astronoby::Events::ObservationEvents`, such as rising, transit and
setting times, or rising and setting azimuths, or transit altitude.

This adds `Astronoby::Moon#observation_events` method, with an
`observer` as parameter.

This change also refactors how observation events are computed,
introducing a loop to increase precision, as explained in _Astronomical
Algorithms_.
@rhannequin rhannequin force-pushed the moonrise-moonset-times branch from a221266 to 70fa4d5 Compare May 31, 2024 23:40
@rhannequin rhannequin merged commit 34334fd into main Jun 5, 2024
@rhannequin rhannequin deleted the moonrise-moonset-times branch June 5, 2024 19:36
rhannequin added a commit that referenced this pull request Jun 11, 2024
 ## 0.5.0 - 2024-06-11

_If you are upgrading: please see [UPGRADING.md]._

[UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md

 ### Features

* Make `Sun#mean_anomaly` public ([#72])
* Moon ecliptic coordinates ([#73])
* Moon apparent geocentric equatorial coordinates ([#75])
* Moon horizontal coordinates ([#76])
* Assume Moon's equatorial coordinates are geocentric ([#77])
* Use observer object for geocentric parallax ([#79])
* Moon's phase angle and illuminated fraction ([#80])
* Monthly Moon phases ([#82])
* Rationalize negative degree angles ([#83])
* Factorize Moon phases periodic terms ([#85])
* Introduce observation events for Moon ([#86])

[#72]: #72
[#73]: #73
[#75]: #75
[#76]: #76
[#77]: #77
[#79]: #79
[#80]: #80
[#82]: #82
[#83]: #83
[#85]: #85
[#86]: #86

 ### Improvements

* Create FUNDING.yml ([#70])
* Bump standard from 1.35.1 to 1.36.0 ([#71])
* Bump rexml from 3.2.6 to 3.2.8 ([#74])
* Expand the number of tested Ruby versions ([#84])
* Add Ruby 3.1.6 and 3.3.2 coverage ([#88])
* Improve and update documentation ([#87])
* Update UPGRADING.md ([#89])

[#70]: #70
[#71]: #71
[#74]: #74
[#84]: #84
[#88]: #88
[#87]: #87
[#89]: #89

 ### Backward-incompatible changes

* Use Observer in Horizontal coordinates ([#69])
* Introduce `Astronoby::Distance` value object ([#78])

[#69]: #69
[#78]: #78

**Full Changelog**: v0.4.0...v0.5.0
rhannequin added a commit that referenced this pull request Jun 11, 2024
### Features

* Make `Sun#mean_anomaly` public ([#72])
* Moon ecliptic coordinates ([#73])
* Moon apparent geocentric equatorial coordinates ([#75])
* Moon horizontal coordinates ([#76])
* Assume Moon's equatorial coordinates are geocentric ([#77])
* Use observer object for geocentric parallax ([#79])
* Moon's phase angle and illuminated fraction ([#80])
* Monthly Moon phases ([#82])
* Rationalize negative degree angles ([#83])
* Factorize Moon phases periodic terms ([#85])
* Introduce observation events for Moon ([#86])

[#72]: #72
[#73]: #73
[#75]: #75
[#76]: #76
[#77]: #77
[#79]: #79
[#80]: #80
[#82]: #82
[#83]: #83
[#85]: #85
[#86]: #86

### Improvements

* Create FUNDING.yml ([#70])
* Bump standard from 1.35.1 to 1.36.0 ([#71])
* Bump rexml from 3.2.6 to 3.2.8 ([#74])
* Expand the number of tested Ruby versions ([#84])
* Add Ruby 3.1.6 and 3.3.2 coverage ([#88])
* Improve and update documentation ([#87])
* Update UPGRADING.md ([#89])

[#70]: #70
[#71]: #71
[#74]: #74
[#84]: #84
[#88]: #88
[#87]: #87
[#89]: #89

### Backward-incompatible changes

* Use Observer in Horizontal coordinates ([#69])
* Introduce `Astronoby::Distance` value object ([#78])

[#69]: #69
[#78]: #78

**Full Changelog**: v0.4.0...v0.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant