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
Add twilight times #49
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Due to the atmospheric refraction, the sky remains bright for some time before the sunset and after the sunrise. This brightness of the sky is called twilight and decreases proportionally to the Sun's angular distance below the observer's horizon. Between the day and the night, three different twilights are defined: * Civil twilight: when the Sun's between 0° and 6° below the horizon * Nautical twilight: when the Sun's between 6° and 12° below the horizon * Astronomical twilight: when the Sun's between 12° and 18° below the horizon This change introduces 6 new methods to `Astronoby::Sun` to provide the instant in time (UTC) of each of these twilight changes: * `#morning_civil_twilight_time`: when the morning civil twilight starts * `#evening_civil_twilight_time`: when the evening civil twilight ends * `#morning_nautical_twilight_time`: when the morning nautical twilight starts * `#evening_nautical_twilight_time`: when the evening nautical twilight ends * `#morning_astronomical_twilight_time`: when the night ends and the morning astronomical twilight starts * `#evening_astronomical_twilight_time`: when the evening astronomical twilight ends and the night starts On latitudes close to the poles, the night never completely falls for some days in the year. When this happens, these methods will return `nil` instead of a time.
rhannequin
added a commit
that referenced
this pull request
Apr 29, 2024
## What's Changed _If you are upgrading: please see [UPGRADING.md]._ [UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md ### Bug fixes * Fix ecliptic to equatorial epoch ([#56]) [#56]: #56 ### Features * Add twilight times ([#49]) * Add interpolation method ([#52]) * Add decimal_hour_to_time util ([#53]) * Calculate leap seconds for an instant ([#54]) * Add `Angle#-@` ([#55]) * Enable equivalence and hash equality to `Observer` ([#57]) * Twilight events dedicated class ([#61]) [#49]: #49 [#52]: #52 [#53]: #53 [#54]: #54 [#55]: #55 [#57]: #57 [#61]: #61 ### Improvements * Upgrade bundler from 2.3.11 to 2.5.7 by @dorianmariecom ([#45]) * Drop `BigDecimal` ([#46]) * Bump rake from 13.1.0 to 13.2.0 ([#47]) * Increase Ruby versions support ([#48]) * Bump rake from 13.2.0 to 13.2.1 ([#51]) * Dedicated constants class ([#62]) * Improve accuracy of equation of time ([#63]) * Twilight times better accuracy ([#65]) * Update UPGRADING.md ([#66]) * release: Bump version to 0.4.0 ([#67]) [#45]: #45 [#46]: #46 [#47]: #47 [#48]: #48 [#51]: #51 [#62]: #62 [#63]: #63 [#65]: #65 [#66]: #66 [#67]: #67 ### Backward-incompatible changes * More accurate rising, transit and setting times ([#50]) * Observation events dedicated and centralized class ([#60]) * Change `Astronoby::Sun` constructor ([#64]) [#50]: #50 [#60]: #60 [#64]: #64 ## New Contributors * @dorianmariecom made their first contribution in [#45] [#45]: #45 **Full Changelog**: v0.3.0...v0.4.0
rhannequin
added a commit
that referenced
this pull request
Apr 29, 2024
## What's Changed _If you are upgrading: please see [UPGRADING.md]._ [UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md ### Bug fixes * Fix ecliptic to equatorial epoch ([#56]) [#56]: #56 ### Features * Add twilight times ([#49]) * Add interpolation method ([#52]) * Add decimal_hour_to_time util ([#53]) * Calculate leap seconds for an instant ([#54]) * Add `Angle#-@` ([#55]) * Enable equivalence and hash equality to `Observer` ([#57]) * Twilight events dedicated class ([#61]) [#49]: #49 [#52]: #52 [#53]: #53 [#54]: #54 [#55]: #55 [#57]: #57 [#61]: #61 ### Improvements * Upgrade bundler from 2.3.11 to 2.5.7 by @dorianmariecom ([#45]) * Drop `BigDecimal` ([#46]) * Bump rake from 13.1.0 to 13.2.0 ([#47]) * Increase Ruby versions support ([#48]) * Bump rake from 13.2.0 to 13.2.1 ([#51]) * Dedicated constants class ([#62]) * Improve accuracy of equation of time ([#63]) * Twilight times better accuracy ([#65]) * Update UPGRADING.md ([#66]) * release: Bump version to 0.4.0 ([#67]) [#45]: #45 [#46]: #46 [#47]: #47 [#48]: #48 [#51]: #51 [#62]: #62 [#63]: #63 [#65]: #65 [#66]: #66 [#67]: #67 ### Backward-incompatible changes * More accurate rising, transit and setting times ([#50]) * Observation events dedicated and centralized class ([#60]) * Change `Astronoby::Sun` constructor ([#64]) [#50]: #50 [#60]: #60 [#64]: #64 ## New Contributors * @dorianmariecom made their first contribution in [#45] [#45]: #45 **Full Changelog**: v0.3.0...v0.4.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Due to the atmospheric refraction, the sky remains bright for some time before the sunset and after the sunrise. This brightness of the sky is called twilight and decreases proportionally to the Sun's angular distance below the observer's horizon.
Between the day and the night, three different twilights are defined:
Source: @timeanddate.com
This change introduces 6 new methods to
Astronoby::Sun
to provide the instant in time (UTC) of each of these twilight changes:#morning_civil_twilight_time
: when the morning civil twilight starts#evening_civil_twilight_time
: when the evening civil twilight ends#morning_nautical_twilight_time
: when the morning nautical twilight starts#evening_nautical_twilight_time
: when the evening nautical twilight ends#morning_astronomical_twilight_time
: when the night ends and the morning astronomical twilight starts#evening_astronomical_twilight_time
: when the evening astronomical twilight ends and the night starts