Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monthly Moon phases #82

Merged
merged 1 commit into from
May 31, 2024
Merged

Monthly Moon phases #82

merged 1 commit into from
May 31, 2024

Conversation

rhannequin
Copy link
Owner

This change introduces multiple new objects to be able to get all the phase times for a given month.

The Moon phases are: New Moon, First Quarter, Full Moon and Last Quarter.

Because the average lunar month is approximatively 29.5 days, most of the time there are only one of each phase per month. This also means that in some configuration, it is possible to have only 3 phases in a month, or to have a phase happening twice in a month, giving 5 phases:

  • February 2012 had only a Full Moon, Last Quarter and New Moon
  • May 2024 had two Last Quarter

For this reason, this change generates an array of unknown length, containing a Astronoby::MoonPhase object for each phase happening in the month.

The algorithm provided by Jean Meeus report having a mean margin error of 3 seconds, which has been confirmed from a few comparisons with the IMCCE.

The new Astronoby::MoonPhase object only exposes the time and phase name of the event. In the future, it could be interesting to add more methods like #full_moon? or similar.

Astronoby::Events::MoonPhases contains all the logic and exposes the final list. This list can also be accessed through Astronoby::Moon for ease of use.

moon_phases = Astronoby::Moon.monthly_phase_events(year: 2024, month: 1)

moon_phases.first.phase
# => :last_quarter

moon_phases.first.time
# => 2024-01-04 03:30:26 UTC

@trevorturk
Copy link

🙌🥇🥳

@rhannequin rhannequin force-pushed the moon-phase-angle-illuminated-fraction branch from da0f5de to d8410b4 Compare May 24, 2024 08:38
@rhannequin rhannequin force-pushed the moon-phase-angle-illuminated-fraction branch from d8410b4 to aca2641 Compare May 24, 2024 09:47
@rhannequin rhannequin force-pushed the moon-phase-angle-illuminated-fraction branch from aca2641 to 7daf326 Compare May 27, 2024 18:51
@rhannequin rhannequin force-pushed the moon-phase-angle-illuminated-fraction branch from 7daf326 to bf02e4c Compare May 30, 2024 08:51
Base automatically changed from moon-phase-angle-illuminated-fraction to main May 31, 2024 08:25
This change introduces multiple new objects to be able to get all the
phase times for a given month.

The Moon phases are: New Moon, First Quarter, Full Moon and Last
Quarter.

Because the average lunar month is approximatively 29.5 days, most of
the time there are only one of each phase per month. This also means
that in some configuration, it is possible to have only 3 phases in a
month, or to have a phase happening twice in a month, giving 5 phases:
* February 2012 had only a Full Moon, Last Quarter and New Moon
* May 2024 had two Last Quarter

For this reason, this change generates an array of unknown length,
containing a `Astronoby::MoonPhase` object for each phase happening in
the month.

The algorithm provided by Jean Meeus report having a mean margin error
of 3 seconds, which has been confirmed from a few comparisons with the
IMCCE.

The new `Astronoby::MoonPhase` object only exposes the `time` and
`phase` name of the event. In the future, it could be interesting to add
more methods like `#full_moon?` or similar.

`Astronoby::Events::MoonPhases` contains all the logic and exposes the
final list. This list can also be accessed through `Astronoby::Moon` for
ease of use.

```rb
moon_phases = Astronoby::Moon.monthly_phase_events(year: 2024, month: 1)

moon_phases.first.phase
 # => :last_quarter

moon_phases.first.time
 # => 2024-01-04 03:30:26 UTC
```
@rhannequin rhannequin merged commit e9a0202 into main May 31, 2024
24 checks passed
@rhannequin rhannequin deleted the moon-phases branch May 31, 2024 23:31
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.

2 participants