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

Handle Sun's sunrise and sunset azimuth #39

Merged
merged 2 commits into from
Mar 22, 2024
Merged

Conversation

rhannequin
Copy link
Owner

@rhannequin rhannequin commented Mar 18, 2024

Knowing when the Sun rises or sets is interesting, but it can also be
interesting to know where on the horizon these events are going to
happen.

The location of the Sun on the horizon's axis is the azimuth.

This change adds support of the computing the azimuth angle of the Sun's
at sunrise and sunset.

Sun#rising_azimuth and Sun#setting_azimuth can return nil as the
Sun sometimes never rises or never sets at some places on Earth, like
locations close to the poles.

date = Date.new(2015, 2, 5)
epoch = Astronoby::Epoch.from_time(date)
observer = Astronoby::Observer.new(
  latitude: Astronoby::Angle.as_degrees(38),
  longitude: Astronoby::Angle.as_degrees(-78)
)
sun = Astronoby::Sun.new(epoch: epoch)

sun.setting_azimuth(observer: observer)&.str(:dms)

@rhannequin rhannequin self-assigned this Mar 18, 2024
Knowing when the Sun rises or sets is interesting, but it can also be
interesting to know _where_ on the horizon these events are going to
happen.

The location of the Sun on the horizon's axis is the azimuth.

This change adds support of the computing the azimuth angle of the Sun's
at sunrise and sunset.

`Sun#rising_azimuth` and `Sun#setting_azimuth` can return `nil` as the
Sun sometimes never rises or never sets at some places on Earth, like
locations close to the poles.

```rb
date = Date.new(2015, 2, 5)
epoch = Astronoby::Epoch.from_time(date)
observer = Astronoby::Observer.new(
  latitude: Astronoby::Angle.as_degrees(38),
  longitude: Astronoby::Angle.as_degrees(-78)
)
sun = Astronoby::Sun.new(epoch: epoch)

sun.setting_azimuth(observer: observer)&.str(:dms)
```
@rhannequin rhannequin changed the title Sun's rising and setting azimuth Handle Sun's sunrise and sunset azimuth Mar 19, 2024
@rhannequin rhannequin marked this pull request as ready for review March 19, 2024 14:16
@rhannequin rhannequin merged commit 09e3762 into main Mar 22, 2024
8 checks passed
rhannequin added a commit that referenced this pull request Mar 24, 2024
## 0.2.0 - 2024-03-24

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

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

### Features

* Angle comparison ([#21])
* Add `#distance` and `#angular_size` to `Astronoby::Sun` ([#30])
* Add geocentric parallax `Astronoby::GeocentricParallax` ([#31])
* Ability to calculate equinoxes and solstices times ([#32])
* Round rising and setting times to the second ([#38])
* Provide sunrise and sunset times ([#35])
* Provide sunrise and sunset azimuths ([#39])
* Ability to calculate the equation of time ([#40])

### Breaking changes

* **breaking:** Accurate setting and rising times for punctual bodies ([#29])
* **breaking:** Drop `Astronoby::Util::Time` in favor of
  `Astronoby::GreenwichSiderealTime` and `Astonoby::LocalSiderealTime` ([#36])

### Improvements

* Add Dependabot for Bundler and GitHub Actions ([#24])
* Add bundler-audit GitHub Action ([#25])
* Bump actions/checkout from 3 to 4 ([#26])
* Bump standard from 1.29.0 to 1.35.1 ([#27], [#37])
* Bump rspec from 3.12.0 to 3.13.0 ([#28])

[#21]: #21
[#24]: #24
[#25]: #25
[#26]: #26
[#27]: #27
[#28]: #28
[#29]: #29
[#30]: #30
[#31]: #31
[#32]: #32
[#35]: #35
[#36]: #36
[#37]: #37
[#38]: #38
[#39]: #39
[#40]: #40
@rhannequin rhannequin deleted the sun-rising-setting-azimuth branch March 29, 2024 16:06
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