Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More accurate rising, transit and setting times (#50)
This change is a complete refactoring of rising and setting times and azimuth. It is based on Astronomical Algorithms by Jean Meeus with a more complex but more accurate method than the ones used so far. It also introduces transit time and altitude. The overall precision of these events have been increased, especially for the Sun. Most of the times are accurate with the IMCCE within 2 minutes precision, with results sometimes accurate to a few seconds. More work may be needed in the future to increase the precision for distant stars, that should be in theory simpler to deal with but are less accurate for some reason (angles are off by a dozen minutes of arc). The following methods have been added to `Sun`: - `#rise_transit_set_times` - `#rise_set_azimuths` - `#transit_time` - `#transit_altitude` They all require an `observer` key argument. Memoization on the observer has been implemented so that each of these methods calls don't compute the values all over again. This change includes a breaking change: `Astronoby::Body` is dropped. It will probably be replaced by something like `DistantStar`, `Moon` and `Planet` in the future, in the same way we have `Sun`. ```rb date = Date.new(2015, 2, 5) epoch = Astronoby::Epoch.from_time(date) observer = Astronoby::Observer.new( latitude: Astronoby::Angle.from_degrees(38), longitude: Astronoby::Angle.from_degrees(-78) ) sun = Astronoby::Sun.new(epoch: epoch) sun.rising_time(observer: observer) # => 2015-02-05 12:12:59 UTC sun.rising_azimuth(observer: observer).str(:dms) # => "+109° 46′ 43.1427″" sun.transit_time(observer: observer) # => 2015-02-05 17:25:59 UTC sun.transit_altitude(observer: observer).str(:dms) # => "+36° 8′ 15.7669″" sun.setting_time(observer: observer) # => 2015-02-05 22:39:27 UTC sun.setting_azimuth(observer: observer).str(:dms) # => "+250° 23′ 33.6177″" # Also available in more compact forms: sun.rise_transit_set_times(observer: observer) # => [..., ..., ...] sun.rise_set_azimuths(observer: observer) # => [..., ...] ```
- Loading branch information
1 parent
c2869ad
commit 620477b
Showing
9 changed files
with
767 additions
and
566 deletions.
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.