astronoby 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +132 -0
- data/Gemfile.lock +19 -17
- data/README.md +195 -25
- data/UPGRADING.md +72 -0
- data/lib/astronoby/aberration.rb +7 -5
- data/lib/astronoby/angle.rb +26 -34
- data/lib/astronoby/astronomical_models/ephemeride_lunaire_parisienne.rb +143 -0
- data/lib/astronoby/astronomical_models/moon_phases_periodic_terms.rb +249 -0
- data/lib/astronoby/bodies/moon.rb +335 -0
- data/lib/astronoby/bodies/sun.rb +129 -132
- data/lib/astronoby/constants.rb +31 -0
- data/lib/astronoby/coordinates/ecliptic.rb +4 -4
- data/lib/astronoby/coordinates/equatorial.rb +7 -5
- data/lib/astronoby/coordinates/horizontal.rb +24 -12
- data/lib/astronoby/distance.rb +83 -0
- data/lib/astronoby/epoch.rb +0 -2
- data/lib/astronoby/equinox_solstice.rb +3 -2
- data/lib/astronoby/events/moon_phases.rb +143 -0
- data/lib/astronoby/events/observation_events.rb +259 -0
- data/lib/astronoby/events/rise_transit_set_iteration.rb +215 -0
- data/lib/astronoby/events/twilight_events.rb +121 -0
- data/lib/astronoby/geocentric_parallax.rb +36 -56
- data/lib/astronoby/mean_obliquity.rb +2 -2
- data/lib/astronoby/moon_phase.rb +43 -0
- data/lib/astronoby/nutation.rb +5 -3
- data/lib/astronoby/observer.rb +39 -18
- data/lib/astronoby/precession.rb +1 -1
- data/lib/astronoby/refraction.rb +8 -10
- data/lib/astronoby/time/greenwich_sidereal_time.rb +18 -29
- data/lib/astronoby/time/local_sidereal_time.rb +4 -4
- data/lib/astronoby/util/maths.rb +72 -0
- data/lib/astronoby/util/time.rb +88 -0
- data/lib/astronoby/util/trigonometry.rb +4 -4
- data/lib/astronoby/version.rb +1 -1
- data/lib/astronoby.rb +12 -1
- metadata +15 -4
- data/lib/astronoby/body.rb +0 -155
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43ef390a6ab6a498edbf148b2af44c906daf73ff9ba61b5aafeadd828fb550e4
|
4
|
+
data.tar.gz: b2cf0743676aa49f95f24c62b3d5d759553014bc52114260a71ecedfb9e6c1cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 052bfebf4ddaf6ef3f24883fec090a831d38a9e4124dd5f561d6b1dd7074b6385502396edddd5496ab6066ff93acab4f220ec3aaa244ad0638c0b65fbaace55f
|
7
|
+
data.tar.gz: fe37ac2714328893b068ba958e37a3b057a76ddfa1b299a35f22be005687d3168d20e98ebe571db519bd6cf69227cc0f0dc4c0889dd9ca5bb9d1abb2b1ee550d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,137 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.5.0 - 2024-06-11
|
4
|
+
|
5
|
+
_If you are upgrading: please see [UPGRADING.md]._
|
6
|
+
|
7
|
+
[UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* Make `Sun#mean_anomaly` public ([#72])
|
12
|
+
* Moon ecliptic coordinates ([#73])
|
13
|
+
* Moon apparent geocentric equatorial coordinates ([#75])
|
14
|
+
* Moon horizontal coordinates ([#76])
|
15
|
+
* Assume Moon's equatorial coordinates are geocentric ([#77])
|
16
|
+
* Use observer object for geocentric parallax ([#79])
|
17
|
+
* Moon's phase angle and illuminated fraction ([#80])
|
18
|
+
* Monthly Moon phases ([#82])
|
19
|
+
* Rationalize negative degree angles ([#83])
|
20
|
+
* Factorize Moon phases periodic terms ([#85])
|
21
|
+
* Introduce observation events for Moon ([#86])
|
22
|
+
|
23
|
+
[#72]: https://github.com/rhannequin/astronoby/pull/72
|
24
|
+
[#73]: https://github.com/rhannequin/astronoby/pull/73
|
25
|
+
[#75]: https://github.com/rhannequin/astronoby/pull/75
|
26
|
+
[#76]: https://github.com/rhannequin/astronoby/pull/76
|
27
|
+
[#77]: https://github.com/rhannequin/astronoby/pull/77
|
28
|
+
[#79]: https://github.com/rhannequin/astronoby/pull/79
|
29
|
+
[#80]: https://github.com/rhannequin/astronoby/pull/80
|
30
|
+
[#82]: https://github.com/rhannequin/astronoby/pull/82
|
31
|
+
[#83]: https://github.com/rhannequin/astronoby/pull/83
|
32
|
+
[#85]: https://github.com/rhannequin/astronoby/pull/85
|
33
|
+
[#86]: https://github.com/rhannequin/astronoby/pull/86
|
34
|
+
|
35
|
+
### Improvements
|
36
|
+
|
37
|
+
* Create FUNDING.yml ([#70])
|
38
|
+
* Bump standard from 1.35.1 to 1.36.0 ([#71])
|
39
|
+
* Bump rexml from 3.2.6 to 3.2.8 ([#74])
|
40
|
+
* Expand the number of tested Ruby versions ([#84])
|
41
|
+
* Add Ruby 3.1.6 and 3.3.2 coverage ([#88])
|
42
|
+
* Improve and update documentation ([#87])
|
43
|
+
* Update UPGRADING.md ([#89])
|
44
|
+
|
45
|
+
[#70]: https://github.com/rhannequin/astronoby/pull/70
|
46
|
+
[#71]: https://github.com/rhannequin/astronoby/pull/71
|
47
|
+
[#74]: https://github.com/rhannequin/astronoby/pull/74
|
48
|
+
[#84]: https://github.com/rhannequin/astronoby/pull/84
|
49
|
+
[#88]: https://github.com/rhannequin/astronoby/pull/88
|
50
|
+
[#87]: https://github.com/rhannequin/astronoby/pull/87
|
51
|
+
[#89]: https://github.com/rhannequin/astronoby/pull/89
|
52
|
+
|
53
|
+
### Backward-incompatible changes
|
54
|
+
|
55
|
+
* Use Observer in Horizontal coordinates ([#69])
|
56
|
+
* Introduce `Astronoby::Distance` value object ([#78])
|
57
|
+
|
58
|
+
[#69]: https://github.com/rhannequin/astronoby/pull/69
|
59
|
+
[#78]: https://github.com/rhannequin/astronoby/pull/78
|
60
|
+
|
61
|
+
**Full Changelog**: https://github.com/rhannequin/astronoby/compare/v0.4.0...v0.5.0
|
62
|
+
|
63
|
+
## 0.4.0 - 2024-04-29
|
64
|
+
|
65
|
+
_If you are upgrading: please see [UPGRADING.md]._
|
66
|
+
|
67
|
+
[UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md
|
68
|
+
|
69
|
+
### Bug fixes
|
70
|
+
|
71
|
+
* Fix ecliptic to equatorial epoch ([#56])
|
72
|
+
|
73
|
+
[#56]: https://github.com/rhannequin/astronoby/pull/56
|
74
|
+
|
75
|
+
### Features
|
76
|
+
|
77
|
+
* Add twilight times ([#49])
|
78
|
+
* Add interpolation method ([#52])
|
79
|
+
* Add decimal_hour_to_time util ([#53])
|
80
|
+
* Calculate leap seconds for an instant ([#54])
|
81
|
+
* Add `Angle#-@` ([#55])
|
82
|
+
* Enable equivalence and hash equality to `Observer` ([#57])
|
83
|
+
* Twilight events dedicated class ([#61])
|
84
|
+
|
85
|
+
[#49]: https://github.com/rhannequin/astronoby/pull/49
|
86
|
+
[#52]: https://github.com/rhannequin/astronoby/pull/52
|
87
|
+
[#53]: https://github.com/rhannequin/astronoby/pull/53
|
88
|
+
[#54]: https://github.com/rhannequin/astronoby/pull/54
|
89
|
+
[#55]: https://github.com/rhannequin/astronoby/pull/55
|
90
|
+
[#57]: https://github.com/rhannequin/astronoby/pull/57
|
91
|
+
[#61]: https://github.com/rhannequin/astronoby/pull/61
|
92
|
+
|
93
|
+
### Improvements
|
94
|
+
|
95
|
+
* Upgrade bundler from 2.3.11 to 2.5.7 by @dorianmariecom ([#45])
|
96
|
+
* Drop `BigDecimal` ([#46])
|
97
|
+
* Bump rake from 13.1.0 to 13.2.0 ([#47])
|
98
|
+
* Increase Ruby versions support ([#48])
|
99
|
+
* Bump rake from 13.2.0 to 13.2.1 ([#51])
|
100
|
+
* Dedicated constants class ([#62])
|
101
|
+
* Improve accuracy of equation of time ([#63])
|
102
|
+
* Twilight times better accuracy ([#65])
|
103
|
+
* Update UPGRADING.md ([#66])
|
104
|
+
* release: Bump version to 0.4.0 ([#67])
|
105
|
+
|
106
|
+
[#45]: https://github.com/rhannequin/astronoby/pull/45
|
107
|
+
[#46]: https://github.com/rhannequin/astronoby/pull/46
|
108
|
+
[#47]: https://github.com/rhannequin/astronoby/pull/47
|
109
|
+
[#48]: https://github.com/rhannequin/astronoby/pull/48
|
110
|
+
[#51]: https://github.com/rhannequin/astronoby/pull/51
|
111
|
+
[#62]: https://github.com/rhannequin/astronoby/pull/62
|
112
|
+
[#63]: https://github.com/rhannequin/astronoby/pull/63
|
113
|
+
[#65]: https://github.com/rhannequin/astronoby/pull/65
|
114
|
+
[#66]: https://github.com/rhannequin/astronoby/pull/66
|
115
|
+
[#67]: https://github.com/rhannequin/astronoby/pull/67
|
116
|
+
|
117
|
+
### Backward-incompatible changes
|
118
|
+
|
119
|
+
* More accurate rising, transit and setting times ([#50])
|
120
|
+
* Observation events dedicated and centralized class ([#60])
|
121
|
+
* Change `Astronoby::Sun` constructor ([#64])
|
122
|
+
|
123
|
+
[#50]: https://github.com/rhannequin/astronoby/pull/50
|
124
|
+
[#60]: https://github.com/rhannequin/astronoby/pull/60
|
125
|
+
[#64]: https://github.com/rhannequin/astronoby/pull/64
|
126
|
+
|
127
|
+
### New Contributors
|
128
|
+
|
129
|
+
* @dorianmariecom made their first contribution in [#45]
|
130
|
+
|
131
|
+
[#45]: https://github.com/rhannequin/astronoby/pull/45
|
132
|
+
|
133
|
+
**Full Changelog**: https://github.com/rhannequin/astronoby/compare/v0.3.0...v0.4.0
|
134
|
+
|
3
135
|
## 0.3.0 - 2024-03-29
|
4
136
|
|
5
137
|
_If you are upgrading: please see [`UPGRADING.md`]._
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
astronoby (0.
|
4
|
+
astronoby (0.5.0)
|
5
5
|
matrix (~> 0.4.2)
|
6
6
|
rake (~> 13.0)
|
7
7
|
rspec (~> 3.0)
|
@@ -11,19 +11,20 @@ GEM
|
|
11
11
|
specs:
|
12
12
|
ast (2.4.2)
|
13
13
|
diff-lcs (1.5.1)
|
14
|
-
json (2.7.
|
14
|
+
json (2.7.2)
|
15
15
|
language_server-protocol (3.17.0.3)
|
16
16
|
lint_roller (1.1.0)
|
17
17
|
matrix (0.4.2)
|
18
18
|
parallel (1.24.0)
|
19
|
-
parser (3.3.0
|
19
|
+
parser (3.3.1.0)
|
20
20
|
ast (~> 2.4.1)
|
21
21
|
racc
|
22
22
|
racc (1.7.3)
|
23
23
|
rainbow (3.1.1)
|
24
|
-
rake (13.1
|
25
|
-
regexp_parser (2.9.
|
26
|
-
rexml (3.2.
|
24
|
+
rake (13.2.1)
|
25
|
+
regexp_parser (2.9.1)
|
26
|
+
rexml (3.2.8)
|
27
|
+
strscan (>= 3.0.9)
|
27
28
|
rspec (3.13.0)
|
28
29
|
rspec-core (~> 3.13.0)
|
29
30
|
rspec-expectations (~> 3.13.0)
|
@@ -37,7 +38,7 @@ GEM
|
|
37
38
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
39
|
rspec-support (~> 3.13.0)
|
39
40
|
rspec-support (3.13.1)
|
40
|
-
rubocop (1.
|
41
|
+
rubocop (1.63.5)
|
41
42
|
json (~> 2.3)
|
42
43
|
language_server-protocol (>= 3.17.0)
|
43
44
|
parallel (~> 1.10)
|
@@ -48,24 +49,25 @@ GEM
|
|
48
49
|
rubocop-ast (>= 1.31.1, < 2.0)
|
49
50
|
ruby-progressbar (~> 1.7)
|
50
51
|
unicode-display_width (>= 2.4.0, < 3.0)
|
51
|
-
rubocop-ast (1.31.
|
52
|
-
parser (>= 3.3.0
|
53
|
-
rubocop-performance (1.
|
52
|
+
rubocop-ast (1.31.3)
|
53
|
+
parser (>= 3.3.1.0)
|
54
|
+
rubocop-performance (1.21.0)
|
54
55
|
rubocop (>= 1.48.1, < 2.0)
|
55
|
-
rubocop-ast (>= 1.
|
56
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
56
57
|
ruby-progressbar (1.13.0)
|
57
|
-
standard (1.
|
58
|
+
standard (1.36.0)
|
58
59
|
language_server-protocol (~> 3.17.0.2)
|
59
60
|
lint_roller (~> 1.0)
|
60
|
-
rubocop (~> 1.
|
61
|
+
rubocop (~> 1.63.0)
|
61
62
|
standard-custom (~> 1.0.0)
|
62
|
-
standard-performance (~> 1.
|
63
|
+
standard-performance (~> 1.4)
|
63
64
|
standard-custom (1.0.2)
|
64
65
|
lint_roller (~> 1.0)
|
65
66
|
rubocop (~> 1.50)
|
66
|
-
standard-performance (1.
|
67
|
+
standard-performance (1.4.0)
|
67
68
|
lint_roller (~> 1.1)
|
68
|
-
rubocop-performance (~> 1.
|
69
|
+
rubocop-performance (~> 1.21.0)
|
70
|
+
strscan (3.1.0)
|
69
71
|
unicode-display_width (2.5.0)
|
70
72
|
|
71
73
|
PLATFORMS
|
@@ -77,4 +79,4 @@ DEPENDENCIES
|
|
77
79
|
standard (~> 1.3)
|
78
80
|
|
79
81
|
BUNDLED WITH
|
80
|
-
2.
|
82
|
+
2.5.7
|
data/README.md
CHANGED
@@ -11,6 +11,27 @@ The main reference is:
|
|
11
11
|
- _Practical Astronomy with your Calculator or Spreadsheet_ by Peter
|
12
12
|
Duffet-Smith and Jonathan Zwart
|
13
13
|
|
14
|
+
## Content
|
15
|
+
- [Installation](#installation)
|
16
|
+
- [Usage](#usage)
|
17
|
+
- [Angle manipulation](#angle-manipulation)
|
18
|
+
- [Coordinates conversion](#coordinates-conversion)
|
19
|
+
- [Sun](#sun)
|
20
|
+
- [Sun's location in the sky](#suns-location-in-the-sky)
|
21
|
+
- [Sunrise and sunset times and azimuths](#sunrise-and-sunset-times-and-azimuths)
|
22
|
+
- [Twilight times](#twilight-times)
|
23
|
+
- [Solstice and Equinox times](#solstice-and-equinox-times)
|
24
|
+
- [Moon](#moon)
|
25
|
+
- [Moon's location in the sky](#moons-location-in-the-sky)
|
26
|
+
- [Moon's current attributes](#moons-current-attributes)
|
27
|
+
- [Moon's phases of the month](#moons-phases-of-the-month)
|
28
|
+
- [Moonrise and moonset times and azimuths](#moonrise-and-moonset-times-and-azimuths)
|
29
|
+
- [Precision](#precision)
|
30
|
+
- [Development](#development)
|
31
|
+
- [Contributing](#contributing)
|
32
|
+
- [License](#license)
|
33
|
+
- [Code of Conduct](#code-of-conduct)
|
34
|
+
|
14
35
|
## Installation
|
15
36
|
|
16
37
|
Install the gem and add to the application's Gemfile by executing:
|
@@ -32,7 +53,7 @@ major one is released.
|
|
32
53
|
|
33
54
|
```rb
|
34
55
|
angle1 = Astronoby::Angle.from_degrees(90)
|
35
|
-
angle2 = Astronoby::Angle.from_radians(
|
56
|
+
angle2 = Astronoby::Angle.from_radians(Math::PI / 2)
|
36
57
|
angle3 = Astronoby::Angle.from_hours(12)
|
37
58
|
|
38
59
|
angle1 == angle2
|
@@ -46,9 +67,35 @@ angle.cos
|
|
46
67
|
# => 1.0
|
47
68
|
```
|
48
69
|
|
70
|
+
### Distance manipulation
|
71
|
+
|
72
|
+
```rb
|
73
|
+
distance1 = Astronoby::Distance.from_astronomical_units(1)
|
74
|
+
distance2 = Astronoby::Distance.from_kilometers(149_597_870.7)
|
75
|
+
distance3 = Astronoby::Distance.from_meters(300)
|
76
|
+
|
77
|
+
distance1 == distance2
|
78
|
+
# => true
|
79
|
+
|
80
|
+
distance1 > distance3
|
81
|
+
# => true
|
82
|
+
|
83
|
+
distance =
|
84
|
+
Astronoby::Distance.from_m(300) +
|
85
|
+
Astronoby::Distance.from_km(3)
|
86
|
+
|
87
|
+
distance.km
|
88
|
+
# => 3.3
|
89
|
+
```
|
90
|
+
|
49
91
|
### Coordinates conversion
|
50
92
|
|
51
93
|
```rb
|
94
|
+
observer = Astronoby::Observer.new(
|
95
|
+
latitude: Astronoby::Angle.from_degrees(38),
|
96
|
+
longitude: Astronoby::Angle.from_degrees(-78)
|
97
|
+
)
|
98
|
+
|
52
99
|
equatorial = Astronoby::Coordinates::Equatorial.new(
|
53
100
|
right_ascension: Astronoby::Angle.from_hms(17, 43, 54),
|
54
101
|
declination: Astronoby::Angle.from_dms(-22, 10, 0)
|
@@ -56,8 +103,7 @@ equatorial = Astronoby::Coordinates::Equatorial.new(
|
|
56
103
|
|
57
104
|
horizontal = equatorial.to_horizontal(
|
58
105
|
time: Time.new(2016, 1, 21, 21, 30, 0, "-05:00"),
|
59
|
-
|
60
|
-
longitude: Astronoby::Angle.from_degrees(-78)
|
106
|
+
observer: observer
|
61
107
|
)
|
62
108
|
|
63
109
|
horizontal.altitude.str(:dms)
|
@@ -67,51 +113,89 @@ horizontal.azimuth.str(:dms)
|
|
67
113
|
# => "+341° 33′ 21.587″"
|
68
114
|
```
|
69
115
|
|
70
|
-
### Sun
|
116
|
+
### Sun
|
117
|
+
|
118
|
+
#### Sun's location in the sky
|
71
119
|
|
72
120
|
```rb
|
73
121
|
time = Time.utc(2023, 2, 17, 11, 0, 0)
|
74
|
-
epoch = Astronoby::Epoch.from_time(time)
|
75
122
|
|
76
|
-
|
77
|
-
|
123
|
+
observer = Astronoby::Observer.new(
|
124
|
+
latitude: Astronoby::Angle.from_degrees(48.8566),
|
125
|
+
longitude: Astronoby::Angle.from_degrees(2.3522)
|
126
|
+
)
|
78
127
|
|
79
|
-
sun = Astronoby::Sun.new(
|
128
|
+
sun = Astronoby::Sun.new(time: time)
|
80
129
|
|
81
130
|
horizontal_coordinates = sun.horizontal_coordinates(
|
82
|
-
|
83
|
-
longitude: longitude
|
131
|
+
observer: observer
|
84
132
|
)
|
85
133
|
|
86
|
-
horizontal_coordinates.altitude.degrees
|
87
|
-
# => 27.
|
134
|
+
horizontal_coordinates.altitude.degrees
|
135
|
+
# => 27.500082409271247
|
88
136
|
|
89
137
|
horizontal_coordinates.altitude.str(:dms)
|
90
|
-
# => "+27° 30′ 0.
|
138
|
+
# => "+27° 30′ 0.2966″"
|
91
139
|
```
|
92
140
|
|
93
|
-
|
141
|
+
#### Sunrise and sunset times and azimuths
|
94
142
|
|
95
143
|
```rb
|
96
|
-
|
97
|
-
epoch = Astronoby::Epoch.from_time(date)
|
144
|
+
time = Time.new(2015, 2, 5)
|
98
145
|
observer = Astronoby::Observer.new(
|
99
146
|
latitude: Astronoby::Angle.from_degrees(38),
|
100
147
|
longitude: Astronoby::Angle.from_degrees(-78)
|
101
148
|
)
|
102
|
-
sun = Astronoby::Sun.new(
|
149
|
+
sun = Astronoby::Sun.new(time: time)
|
150
|
+
observation_events = sun.observation_events(observer: observer)
|
151
|
+
|
152
|
+
observation_events.rising_time
|
153
|
+
# => 2015-02-05 12:12:59 UTC
|
103
154
|
|
104
|
-
|
105
|
-
# =>
|
155
|
+
observation_events.rising_azimuth.str(:dms)
|
156
|
+
# => "+109° 29′ 34.3674″"
|
106
157
|
|
107
|
-
|
108
|
-
# =>
|
158
|
+
observation_events.transit_time
|
159
|
+
# => 2015-02-05 17:25:59 UTC
|
109
160
|
|
110
|
-
|
111
|
-
# =>
|
161
|
+
observation_events.transit_altitude.str(:dms)
|
162
|
+
# => "+36° 8′ 15.8197″"
|
112
163
|
|
113
|
-
|
114
|
-
# =>
|
164
|
+
observation_events.setting_time
|
165
|
+
# => 2015-02-05 22:39:27 UTC
|
166
|
+
|
167
|
+
observation_events.setting_azimuth.str(:dms)
|
168
|
+
# => "+250° 40′ 42.8609″"
|
169
|
+
```
|
170
|
+
|
171
|
+
#### Twilight times
|
172
|
+
|
173
|
+
```rb
|
174
|
+
time = Time.new(2024, 1, 1)
|
175
|
+
sun = Astronoby::Sun.new(time: time)
|
176
|
+
observer = Astronoby::Observer.new(
|
177
|
+
latitude: Astronoby::Angle.from_degrees(48.8566),
|
178
|
+
longitude: Astronoby::Angle.from_degrees(2.3522)
|
179
|
+
)
|
180
|
+
twilight_events = sun.twilight_events(observer: observer)
|
181
|
+
|
182
|
+
twilight_events.morning_astronomical_twilight_time
|
183
|
+
# => 2024-01-01 05:49:25 UTC
|
184
|
+
|
185
|
+
twilight_events.morning_nautical_twilight_time
|
186
|
+
# => 2024-01-01 06:27:42 UTC
|
187
|
+
|
188
|
+
twilight_events.morning_civil_twilight_time
|
189
|
+
# => 2024-01-01 07:07:50 UTC
|
190
|
+
|
191
|
+
twilight_events.evening_civil_twilight_time
|
192
|
+
# => 2024-01-01 16:40:01 UTC
|
193
|
+
|
194
|
+
twilight_events.evening_nautical_twilight_time
|
195
|
+
# => 2024-01-01 17:20:10 UTC
|
196
|
+
|
197
|
+
twilight_events.evening_astronomical_twilight_time
|
198
|
+
# => 2024-01-01 17:58:26 UTC
|
115
199
|
```
|
116
200
|
|
117
201
|
### Solstice and Equinox times
|
@@ -126,6 +210,92 @@ Astronoby::EquinoxSolstice.june_solstice(year)
|
|
126
210
|
# => 2024-06-20 20:50:18 UTC
|
127
211
|
```
|
128
212
|
|
213
|
+
### Moon
|
214
|
+
|
215
|
+
#### Moon's location in the sky
|
216
|
+
|
217
|
+
```rb
|
218
|
+
time = Time.utc(2023, 2, 17, 11, 0, 0)
|
219
|
+
|
220
|
+
observer = Astronoby::Observer.new(
|
221
|
+
latitude: Astronoby::Angle.from_degrees(48.8566),
|
222
|
+
longitude: Astronoby::Angle.from_degrees(2.3522)
|
223
|
+
)
|
224
|
+
|
225
|
+
moon = Astronoby::Moon.new(time: time)
|
226
|
+
|
227
|
+
horizontal_coordinates = moon.horizontal_coordinates(
|
228
|
+
observer: observer
|
229
|
+
)
|
230
|
+
|
231
|
+
horizontal_coordinates.altitude.degrees
|
232
|
+
# => 10.277834691708053
|
233
|
+
|
234
|
+
horizontal_coordinates.altitude.str(:dms)
|
235
|
+
# => "+10° 16′ 40.2048″"
|
236
|
+
```
|
237
|
+
|
238
|
+
#### Moon's current attributes
|
239
|
+
|
240
|
+
```rb
|
241
|
+
time = Time.utc(2024, 6, 1, 10, 0, 0)
|
242
|
+
moon = Astronoby::Moon.new(time: time)
|
243
|
+
|
244
|
+
moon.illuminated_fraction.round(2)
|
245
|
+
# => 0.31
|
246
|
+
|
247
|
+
moon.distance.km.round
|
248
|
+
# => 368409
|
249
|
+
|
250
|
+
moon.phase_angle.degrees.round
|
251
|
+
# => 112
|
252
|
+
```
|
253
|
+
|
254
|
+
#### Moon's phases of the month
|
255
|
+
|
256
|
+
```rb
|
257
|
+
june_phases = Astronoby::Moon.monthly_phase_events(
|
258
|
+
year: 2024,
|
259
|
+
month: 6
|
260
|
+
)
|
261
|
+
|
262
|
+
june_phases.each { puts "#{_1.phase}: #{_1.time}" }
|
263
|
+
# new_moon: 2024-06-06 12:37:41 UTC
|
264
|
+
# first_quarter: 2024-06-14 05:18:28 UTC
|
265
|
+
# full_moon: 2024-06-22 01:07:53 UTC
|
266
|
+
# last_quarter: 2024-06-28 21:53:25 UTC
|
267
|
+
```
|
268
|
+
|
269
|
+
#### Moonrise and moonset times and azimuths
|
270
|
+
|
271
|
+
```rb
|
272
|
+
time = Time.utc(2024, 6, 1, 10, 0, 0)
|
273
|
+
observer = Astronoby::Observer.new(
|
274
|
+
latitude: Astronoby::Angle.from_degrees(48.8566),
|
275
|
+
longitude: Astronoby::Angle.from_degrees(2.3522)
|
276
|
+
)
|
277
|
+
moon = Astronoby::Moon.new(time: time)
|
278
|
+
observation_events = moon.observation_events(observer: observer)
|
279
|
+
|
280
|
+
observation_events.rising_time
|
281
|
+
# => 2024-06-01 00:35:36 UTC
|
282
|
+
|
283
|
+
observation_events.rising_azimuth.str(:dms)
|
284
|
+
# => "+93° 7′ 43.2347″"
|
285
|
+
|
286
|
+
observation_events.transit_time
|
287
|
+
# => 2024-06-01 02:42:43 UTC
|
288
|
+
|
289
|
+
observation_events.transit_altitude.str(:dms)
|
290
|
+
# => "+26° 59′ 30.9915″"
|
291
|
+
|
292
|
+
observation_events.setting_time
|
293
|
+
# => 2024-06-01 16:02:26 UTC
|
294
|
+
|
295
|
+
observation_events.setting_azimuth.str(:dms)
|
296
|
+
# => "+273° 29′ 30.0954″"
|
297
|
+
```
|
298
|
+
|
129
299
|
## Precision
|
130
300
|
|
131
301
|
The current precision for the Sun's apparent location in the sky, compared
|
data/UPGRADING.md
CHANGED
@@ -7,6 +7,78 @@ changes to it as long as a major version has not been released.
|
|
7
7
|
If you are already using Astronoby and wish to follow the changes to its
|
8
8
|
public API, please read the upgrading notes for each release.
|
9
9
|
|
10
|
+
## Upgrading from 0.4.0 to 0.5.0
|
11
|
+
|
12
|
+
### `Sun#horizontal_coordinates` method signature changed ([#69])
|
13
|
+
|
14
|
+
`Astronoby::Sun#horizontal_coordinates` expects an `observer`
|
15
|
+
(`Astronoby::Observer`) key argument instead of `latitude` and `longitude`
|
16
|
+
angles.
|
17
|
+
|
18
|
+
[#69]: https://github.com/rhannequin/astronoby/pull/69
|
19
|
+
|
20
|
+
### `Sun#distance` now returns an `Astronoby::Distance` ([#78])
|
21
|
+
|
22
|
+
[#78]: https://github.com/rhannequin/astronoby/pull/78
|
23
|
+
|
24
|
+
### `Coordinates::Equatorial#to_horizontal` method signature changed ([#69])
|
25
|
+
|
26
|
+
`Astronoby::Coordinates::Equatorial#to_horizontal` expects an `observer`
|
27
|
+
(`Astronoby::Observer`) key argument instead of `latitude` and `longitude`
|
28
|
+
angles.
|
29
|
+
|
30
|
+
### `Coordinates::Horizontal` constructor and attributes changed ([#69])
|
31
|
+
|
32
|
+
`Astronoby::Coordinates::Horizontal::new` now expects an `observer`
|
33
|
+
(`Astronoby::Observer`) key argument instead of `latitude` and `longitude`,
|
34
|
+
and therefore now exposes `#observer` instead of `#latitude` and `#longitude`.
|
35
|
+
|
36
|
+
### `GeocentricParallax#angle` method signature changed ([#78])
|
37
|
+
|
38
|
+
`Astronoby::GeocentricParallax#angle`'s key argument `distance` is now
|
39
|
+
expected to be an instance of `Astronoby::Distance` instead of a `Numeric`.
|
40
|
+
|
41
|
+
### `GeocentricParallax#for_equatorial_coordinates` method signature changed ([#69])
|
42
|
+
|
43
|
+
`Astronoby::GeocentricParallax#for_equatorial_coordinates` expects an
|
44
|
+
`observer` (`Astronoby::Observer`) key argument instead of `latitude`,
|
45
|
+
`longitude` and `elevation`.
|
46
|
+
|
47
|
+
### `Observer` constructor changed ([#78])
|
48
|
+
|
49
|
+
`Astronoby::Observer::new`'s key argument `distance` is now expected to be
|
50
|
+
an instance of `Astronoby::Distance` instead of a `Numeric`.
|
51
|
+
|
52
|
+
### `Refraction` methods signatures changed ([#69])
|
53
|
+
|
54
|
+
`Astronoby::Refraction`'s constructor doesn't accept the `observer` key
|
55
|
+
argument anymore. Therefore, the methods `::angle` and
|
56
|
+
`::correct_horizontal_coordinates` neither.
|
57
|
+
|
58
|
+
## Upgrading from 0.3.0 to 0.4.0
|
59
|
+
|
60
|
+
### `Body` class removed ([#50])
|
61
|
+
|
62
|
+
The different behaviors from `Body` have been moved to other classes like
|
63
|
+
`Events::ObservationEvents`.
|
64
|
+
|
65
|
+
[#50]: https://github.com/rhannequin/astronoby/pull/50
|
66
|
+
|
67
|
+
### Rising and setting times and azimuths removed from `Sun` ([#60])
|
68
|
+
|
69
|
+
`#rising_time`, `#rising_azimuth`, `#setting_time` and `#setting_azimuth`
|
70
|
+
have been removed from `Astronoby::Sun` and moved to
|
71
|
+
`Astronoby::Events::ObservationEvents`.
|
72
|
+
|
73
|
+
[#60]: https://github.com/rhannequin/astronoby/pull/60
|
74
|
+
|
75
|
+
### `Sun` constructor changed ([#64])
|
76
|
+
|
77
|
+
The `Sun` constructor now doesn't accept the `epoch` key argument anymore,
|
78
|
+
but only a new `time` key argument.
|
79
|
+
|
80
|
+
[#64]: https://github.com/rhannequin/astronoby/pull/64
|
81
|
+
|
10
82
|
## Upgrading from 0.2.0 to 0.3.0
|
11
83
|
|
12
84
|
### `Sun#ecliptic_coordinates` method removed (#41)
|
data/lib/astronoby/aberration.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Astronoby
|
4
4
|
class Aberration
|
5
|
+
MAXIMUM_SHIFT = Angle.from_degrees(20.5)
|
6
|
+
|
5
7
|
def self.for_ecliptic_coordinates(coordinates:, epoch:)
|
6
8
|
new(coordinates, epoch).apply
|
7
9
|
end
|
@@ -18,15 +20,15 @@ module Astronoby
|
|
18
20
|
# Chapter: 36 - Aberration
|
19
21
|
def apply
|
20
22
|
delta_longitude = Angle.from_degrees(
|
21
|
-
-
|
23
|
+
-MAXIMUM_SHIFT.degrees * (
|
22
24
|
sun_longitude - @coordinates.longitude
|
23
|
-
).cos / @coordinates.latitude.cos /
|
25
|
+
).cos / @coordinates.latitude.cos / Constants::SECONDS_PER_DEGREE
|
24
26
|
)
|
25
27
|
|
26
28
|
delta_latitude = Angle.from_degrees(
|
27
|
-
-
|
29
|
+
-MAXIMUM_SHIFT.degrees *
|
28
30
|
(sun_longitude - @coordinates.longitude).sin *
|
29
|
-
@coordinates.latitude.sin /
|
31
|
+
@coordinates.latitude.sin / Constants::SECONDS_PER_DEGREE
|
30
32
|
)
|
31
33
|
|
32
34
|
Coordinates::Ecliptic.new(
|
@@ -37,7 +39,7 @@ module Astronoby
|
|
37
39
|
|
38
40
|
def sun_longitude
|
39
41
|
@_sun_longitude ||= Sun
|
40
|
-
.new(
|
42
|
+
.new(time: Epoch.to_utc(@epoch))
|
41
43
|
.true_ecliptic_coordinates
|
42
44
|
.longitude
|
43
45
|
end
|