astronoby 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +67 -0
- data/Gemfile.lock +38 -36
- data/README.md +84 -6
- data/UPGRADING.md +159 -0
- data/lib/astronoby/aberration.rb +6 -3
- data/lib/astronoby/angle.rb +18 -20
- data/lib/astronoby/bodies/sun.rb +187 -20
- data/lib/astronoby/body.rb +126 -51
- data/lib/astronoby/coordinates/ecliptic.rb +19 -8
- data/lib/astronoby/coordinates/equatorial.rb +8 -9
- data/lib/astronoby/coordinates/horizontal.rb +7 -7
- data/lib/astronoby/equinox_solstice.rb +139 -0
- data/lib/astronoby/errors.rb +2 -0
- data/lib/astronoby/geocentric_parallax.rb +130 -0
- data/lib/astronoby/mean_obliquity.rb +2 -2
- data/lib/astronoby/nutation.rb +4 -4
- data/lib/astronoby/observer.rb +57 -0
- data/lib/astronoby/precession.rb +5 -5
- data/lib/astronoby/refraction.rb +48 -36
- data/lib/astronoby/time/greenwich_sidereal_time.rb +86 -0
- data/lib/astronoby/time/local_sidereal_time.rb +41 -0
- data/lib/astronoby/util/astrodynamics.rb +2 -2
- data/lib/astronoby/util/trigonometry.rb +2 -2
- data/lib/astronoby/version.rb +1 -1
- data/lib/astronoby.rb +5 -1
- metadata +8 -3
- data/lib/astronoby/util/time.rb +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ab8b9191b1b2452c678389fbc4c1750c4080c8f3cddf55cf7aebad2d99a0da7
|
4
|
+
data.tar.gz: f823456f556792e1d2ea3747f3665c84442a907c3a08271df5f871204bd09f10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b14d2a19972991fecc5b0a12c15fe18f3a9a07d0e9fc705fe2d984af14e45ae82962332361e65dace20c27b5f6e05e19483385731770abe463a3bf28adcfb354
|
7
|
+
data.tar.gz: 725810244872e539789b23d2b28ce656781a1f9121fabc76c3e2ebc5c9e6616900bff852290cf8719a10feb7a06afa42f7d02f4e00ac3ba2dadc4dea47d6a24c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,70 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.3.0 - 2024-03-29
|
4
|
+
|
5
|
+
_If you are upgrading: please see [`UPGRADING.md`]._
|
6
|
+
|
7
|
+
### Improvements
|
8
|
+
|
9
|
+
* Drop `Angle#==` ([#42])
|
10
|
+
* Improved accuracy with Sun's location predictions ([#41])
|
11
|
+
|
12
|
+
### Breaking changes
|
13
|
+
|
14
|
+
* **breaking:** Difference between true and apparent ecliptic and equatorial
|
15
|
+
coordinates ([#41])
|
16
|
+
* **breaking:** Rename `Angle::as_*` into `Angle::from_*` ([#43])
|
17
|
+
|
18
|
+
[#41]: https://github.com/rhannequin/astronoby/pull/41
|
19
|
+
[#42]: https://github.com/rhannequin/astronoby/pull/42
|
20
|
+
[#43]: https://github.com/rhannequin/astronoby/pull/43
|
21
|
+
|
22
|
+
## 0.2.0 - 2024-03-24
|
23
|
+
|
24
|
+
_If you are upgrading: please see [`UPGRADING.md`]._
|
25
|
+
|
26
|
+
### Features
|
27
|
+
|
28
|
+
* Angle comparison ([#21])
|
29
|
+
* Add `#distance` and `#angular_size` to `Astronoby::Sun` ([#30])
|
30
|
+
* Add geocentric parallax `Astronoby::GeocentricParallax` ([#31])
|
31
|
+
* Ability to calculate equinoxes and solstices times ([#32])
|
32
|
+
* Round rising and setting times to the second ([#38])
|
33
|
+
* Provide sunrise and sunset times ([#35])
|
34
|
+
* Provide sunrise and sunset azimuths ([#39])
|
35
|
+
* Ability to calculate the equation of time ([#40])
|
36
|
+
|
37
|
+
### Breaking changes
|
38
|
+
|
39
|
+
* **breaking:** Accurate setting and rising times for punctual bodies ([#29])
|
40
|
+
* **breaking:** Drop `Astronoby::Util::Time` in favor of
|
41
|
+
`Astronoby::GreenwichSiderealTime` and `Astonoby::LocalSiderealTime` ([#36])
|
42
|
+
|
43
|
+
### Improvements
|
44
|
+
|
45
|
+
* Add Dependabot for Bundler and GitHub Actions ([#24])
|
46
|
+
* Add bundler-audit GitHub Action ([#25])
|
47
|
+
* Bump actions/checkout from 3 to 4 ([#26])
|
48
|
+
* Bump standard from 1.29.0 to 1.35.1 ([#27], [#37])
|
49
|
+
* Bump rspec from 3.12.0 to 3.13.0 ([#28])
|
50
|
+
|
51
|
+
[#21]: https://github.com/rhannequin/astronoby/pull/21
|
52
|
+
[#24]: https://github.com/rhannequin/astronoby/pull/24
|
53
|
+
[#25]: https://github.com/rhannequin/astronoby/pull/25
|
54
|
+
[#26]: https://github.com/rhannequin/astronoby/pull/26
|
55
|
+
[#27]: https://github.com/rhannequin/astronoby/pull/27
|
56
|
+
[#28]: https://github.com/rhannequin/astronoby/pull/28
|
57
|
+
[#29]: https://github.com/rhannequin/astronoby/pull/29
|
58
|
+
[#30]: https://github.com/rhannequin/astronoby/pull/30
|
59
|
+
[#31]: https://github.com/rhannequin/astronoby/pull/31
|
60
|
+
[#32]: https://github.com/rhannequin/astronoby/pull/32
|
61
|
+
[#35]: https://github.com/rhannequin/astronoby/pull/35
|
62
|
+
[#36]: https://github.com/rhannequin/astronoby/pull/36
|
63
|
+
[#37]: https://github.com/rhannequin/astronoby/pull/37
|
64
|
+
[#28]: https://github.com/rhannequin/astronoby/pull/38
|
65
|
+
[#39]: https://github.com/rhannequin/astronoby/pull/39
|
66
|
+
[#40]: https://github.com/rhannequin/astronoby/pull/40
|
67
|
+
|
3
68
|
## 0.1.0 - 2024-02-28
|
4
69
|
|
5
70
|
### Features
|
@@ -26,3 +91,5 @@
|
|
26
91
|
|
27
92
|
* Add `Astronoby::Angle`
|
28
93
|
* Support angles in degrees and radians
|
94
|
+
|
95
|
+
[`UPGRADING.md`]: https://github.com/rhannequin/astronoby/blob/main/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.3.0)
|
5
5
|
matrix (~> 0.4.2)
|
6
6
|
rake (~> 13.0)
|
7
7
|
rspec (~> 3.0)
|
@@ -10,61 +10,63 @@ GEM
|
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
12
|
ast (2.4.2)
|
13
|
-
diff-lcs (1.5.
|
14
|
-
json (2.
|
13
|
+
diff-lcs (1.5.1)
|
14
|
+
json (2.7.1)
|
15
15
|
language_server-protocol (3.17.0.3)
|
16
|
-
lint_roller (1.
|
16
|
+
lint_roller (1.1.0)
|
17
17
|
matrix (0.4.2)
|
18
|
-
parallel (1.
|
19
|
-
parser (3.
|
18
|
+
parallel (1.24.0)
|
19
|
+
parser (3.3.0.5)
|
20
20
|
ast (~> 2.4.1)
|
21
21
|
racc
|
22
|
-
racc (1.7.
|
22
|
+
racc (1.7.3)
|
23
23
|
rainbow (3.1.1)
|
24
24
|
rake (13.1.0)
|
25
|
-
regexp_parser (2.
|
26
|
-
rexml (3.2.
|
27
|
-
rspec (3.
|
28
|
-
rspec-core (~> 3.
|
29
|
-
rspec-expectations (~> 3.
|
30
|
-
rspec-mocks (~> 3.
|
31
|
-
rspec-core (3.
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-expectations (3.
|
25
|
+
regexp_parser (2.9.0)
|
26
|
+
rexml (3.2.6)
|
27
|
+
rspec (3.13.0)
|
28
|
+
rspec-core (~> 3.13.0)
|
29
|
+
rspec-expectations (~> 3.13.0)
|
30
|
+
rspec-mocks (~> 3.13.0)
|
31
|
+
rspec-core (3.13.0)
|
32
|
+
rspec-support (~> 3.13.0)
|
33
|
+
rspec-expectations (3.13.0)
|
34
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-mocks (3.
|
35
|
+
rspec-support (~> 3.13.0)
|
36
|
+
rspec-mocks (3.13.0)
|
37
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.
|
39
|
-
rspec-support (3.
|
40
|
-
rubocop (1.
|
38
|
+
rspec-support (~> 3.13.0)
|
39
|
+
rspec-support (3.13.1)
|
40
|
+
rubocop (1.62.1)
|
41
41
|
json (~> 2.3)
|
42
|
+
language_server-protocol (>= 3.17.0)
|
42
43
|
parallel (~> 1.10)
|
43
|
-
parser (>= 3.
|
44
|
+
parser (>= 3.3.0.2)
|
44
45
|
rainbow (>= 2.2.2, < 4.0)
|
45
46
|
regexp_parser (>= 1.8, < 3.0)
|
46
47
|
rexml (>= 3.2.5, < 4.0)
|
47
|
-
rubocop-ast (>= 1.
|
48
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
48
49
|
ruby-progressbar (~> 1.7)
|
49
50
|
unicode-display_width (>= 2.4.0, < 3.0)
|
50
|
-
rubocop-ast (1.
|
51
|
-
parser (>= 3.
|
52
|
-
rubocop-performance (1.
|
53
|
-
rubocop (>= 1.
|
54
|
-
rubocop-ast (>=
|
51
|
+
rubocop-ast (1.31.2)
|
52
|
+
parser (>= 3.3.0.4)
|
53
|
+
rubocop-performance (1.20.2)
|
54
|
+
rubocop (>= 1.48.1, < 2.0)
|
55
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
55
56
|
ruby-progressbar (1.13.0)
|
56
|
-
standard (1.
|
57
|
+
standard (1.35.1)
|
57
58
|
language_server-protocol (~> 3.17.0.2)
|
58
59
|
lint_roller (~> 1.0)
|
59
|
-
rubocop (~> 1.
|
60
|
+
rubocop (~> 1.62.0)
|
60
61
|
standard-custom (~> 1.0.0)
|
61
|
-
standard-performance (~> 1.
|
62
|
-
standard-custom (1.0.
|
62
|
+
standard-performance (~> 1.3)
|
63
|
+
standard-custom (1.0.2)
|
63
64
|
lint_roller (~> 1.0)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
rubocop (~> 1.50)
|
66
|
+
standard-performance (1.3.1)
|
67
|
+
lint_roller (~> 1.1)
|
68
|
+
rubocop-performance (~> 1.20.2)
|
69
|
+
unicode-display_width (2.5.0)
|
68
70
|
|
69
71
|
PLATFORMS
|
70
72
|
ruby
|
data/README.md
CHANGED
@@ -24,15 +24,57 @@ executing:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
This library is still in heavy development. The
|
28
|
-
|
27
|
+
This library is still in heavy development. The public is not stable, please
|
28
|
+
be aware new minor versions will probably lead to breaking changes until a
|
29
|
+
major one is released.
|
30
|
+
|
31
|
+
### Angle manipulation
|
32
|
+
|
33
|
+
```rb
|
34
|
+
angle1 = Astronoby::Angle.from_degrees(90)
|
35
|
+
angle2 = Astronoby::Angle.from_radians(Astronoby::Angle::PI / 2)
|
36
|
+
angle3 = Astronoby::Angle.from_hours(12)
|
37
|
+
|
38
|
+
angle1 == angle2
|
39
|
+
# => true
|
40
|
+
|
41
|
+
angle1 < angle3
|
42
|
+
# => true
|
43
|
+
|
44
|
+
angle = angle1 + angle2 + angle3
|
45
|
+
angle.cos
|
46
|
+
# => 1.0
|
47
|
+
```
|
48
|
+
|
49
|
+
### Coordinates conversion
|
50
|
+
|
51
|
+
```rb
|
52
|
+
equatorial = Astronoby::Coordinates::Equatorial.new(
|
53
|
+
right_ascension: Astronoby::Angle.from_hms(17, 43, 54),
|
54
|
+
declination: Astronoby::Angle.from_dms(-22, 10, 0)
|
55
|
+
)
|
56
|
+
|
57
|
+
horizontal = equatorial.to_horizontal(
|
58
|
+
time: Time.new(2016, 1, 21, 21, 30, 0, "-05:00"),
|
59
|
+
latitude: Astronoby::Angle.from_degrees(38),
|
60
|
+
longitude: Astronoby::Angle.from_degrees(-78)
|
61
|
+
)
|
62
|
+
|
63
|
+
horizontal.altitude.str(:dms)
|
64
|
+
# => "-73° 27′ 19.1557″"
|
65
|
+
|
66
|
+
horizontal.azimuth.str(:dms)
|
67
|
+
# => "+341° 33′ 21.587″"
|
68
|
+
```
|
69
|
+
|
70
|
+
### Sun's location in the sky
|
29
71
|
|
30
72
|
```rb
|
31
73
|
time = Time.utc(2023, 2, 17, 11, 0, 0)
|
32
74
|
epoch = Astronoby::Epoch.from_time(time)
|
33
75
|
|
34
|
-
latitude = Astronoby::Angle.
|
35
|
-
longitude = Astronoby::Angle.
|
76
|
+
latitude = Astronoby::Angle.from_degrees(48.8566)
|
77
|
+
longitude = Astronoby::Angle.from_degrees(2.3522)
|
36
78
|
|
37
79
|
sun = Astronoby::Sun.new(epoch: epoch)
|
38
80
|
|
@@ -42,10 +84,46 @@ horizontal_coordinates = sun.horizontal_coordinates(
|
|
42
84
|
)
|
43
85
|
|
44
86
|
horizontal_coordinates.altitude.degrees.to_f
|
45
|
-
# => 27.
|
87
|
+
# => 27.50008242057459
|
46
88
|
|
47
89
|
horizontal_coordinates.altitude.str(:dms)
|
48
|
-
# => "+27° 30′
|
90
|
+
# => "+27° 30′ 0.2967″"
|
91
|
+
```
|
92
|
+
|
93
|
+
### Sunrise and sunset times and azimuths
|
94
|
+
|
95
|
+
```rb
|
96
|
+
date = Date.new(2015, 2, 5)
|
97
|
+
epoch = Astronoby::Epoch.from_time(date)
|
98
|
+
observer = Astronoby::Observer.new(
|
99
|
+
latitude: Astronoby::Angle.from_degrees(38),
|
100
|
+
longitude: Astronoby::Angle.from_degrees(-78)
|
101
|
+
)
|
102
|
+
sun = Astronoby::Sun.new(epoch: epoch)
|
103
|
+
|
104
|
+
sun.rising_time(observer: observer)
|
105
|
+
# => 2015-02-05 12:13:26 UTC
|
106
|
+
|
107
|
+
sun.rising_azimuth(observer: observer).str(:dms)
|
108
|
+
# => "+109° 41′ 22.2585″"
|
109
|
+
|
110
|
+
sun.setting_time(observer: observer)
|
111
|
+
# => 2015-02-05 22:35:12 UTC
|
112
|
+
|
113
|
+
sun.setting_azimuth(observer: observer).str(:dms)
|
114
|
+
# => "+250° 18′ 37.7414″"
|
115
|
+
```
|
116
|
+
|
117
|
+
### Solstice and Equinox times
|
118
|
+
|
119
|
+
```rb
|
120
|
+
year = 2024
|
121
|
+
|
122
|
+
Astronoby::EquinoxSolstice.march_equinox(year)
|
123
|
+
# => 2024-03-20 03:05:08 UTC
|
124
|
+
|
125
|
+
Astronoby::EquinoxSolstice.june_solstice(year)
|
126
|
+
# => 2024-06-20 20:50:18 UTC
|
49
127
|
```
|
50
128
|
|
51
129
|
## Precision
|
data/UPGRADING.md
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
# Upgrading
|
2
|
+
|
3
|
+
Astronoby is still in development phase and no major version has been
|
4
|
+
released yet. Please consider the public API as unstable and expect breaking
|
5
|
+
changes to it as long as a major version has not been released.
|
6
|
+
|
7
|
+
If you are already using Astronoby and wish to follow the changes to its
|
8
|
+
public API, please read the upgrading notes for each release.
|
9
|
+
|
10
|
+
## Upgrading from 0.2.0 to 0.3.0
|
11
|
+
|
12
|
+
### `Sun#ecliptic_coordinates` method removed (#41)
|
13
|
+
|
14
|
+
Removed in favor of `#true_ecliptic_coordinates` and
|
15
|
+
`#apparent_ecliptic_coordinates`.
|
16
|
+
|
17
|
+
### `Coordinates::Ecliptic#to_horizontal` method removed (#41)
|
18
|
+
|
19
|
+
Removed in favor of `#to_true_horizontal` and
|
20
|
+
`#to_apparent_horizontal`.
|
21
|
+
|
22
|
+
### `Sun#true_ecliptic_coordinates` method added (#41)
|
23
|
+
|
24
|
+
Returns the true ecliptic coordinates for the date's epoch.
|
25
|
+
|
26
|
+
### `Sun#apparent_ecliptic_coordinates` method added (#41)
|
27
|
+
|
28
|
+
Returns the apparent ecliptic coordinates for the date's epoch, including
|
29
|
+
corrections for the nutation and aberration.
|
30
|
+
|
31
|
+
### `Coordinates::Ecliptic#to_true_horizontal` method added (#41)
|
32
|
+
|
33
|
+
Returns the true equatorial coordinates for ths date's epoch.
|
34
|
+
|
35
|
+
### `Coordinates::Ecliptic#to_apparent_horizontal` method added (#41)
|
36
|
+
|
37
|
+
Returns the apparent equatorial coordinates for the date's epoch, including
|
38
|
+
corrections for the obliquity.
|
39
|
+
|
40
|
+
### `Angle::as_radians` renamed into `Angle::from_radians` (#43)
|
41
|
+
|
42
|
+
Behaviour not changed.
|
43
|
+
|
44
|
+
### `Angle::as_degrees` renamed into `Angle::from_degrees` (#43)
|
45
|
+
|
46
|
+
Behaviour not changed.
|
47
|
+
|
48
|
+
### `Angle::as_hours` renamed into `Angle::from_hours` (#43)
|
49
|
+
|
50
|
+
Behaviour not changed.
|
51
|
+
|
52
|
+
### `Angle::as_dms` renamed into `Angle::from_dms` (#43)
|
53
|
+
|
54
|
+
Behaviour not changed.
|
55
|
+
|
56
|
+
### `Angle::as_hms` renamed into `Angle::from_hms` (#43)
|
57
|
+
|
58
|
+
Behaviour not changed.
|
59
|
+
|
60
|
+
## Upgrading from 0.1.0 to 0.2.0
|
61
|
+
|
62
|
+
### `Observer` class added (#29)
|
63
|
+
|
64
|
+
The `Observer` class aims to represent an observer's location and local
|
65
|
+
parameters such as the temperature and astmospheric pressure.
|
66
|
+
|
67
|
+
### `Refraction` constructor changed (#29)
|
68
|
+
|
69
|
+
`Refraction.new` now takes the following arguments:
|
70
|
+
|
71
|
+
* `coordinates` (`Coordinates::Horizontal`)
|
72
|
+
* `observer` (`Observer`)
|
73
|
+
|
74
|
+
### `Refraction::for_horizontal_coordinates` removed (#29)
|
75
|
+
|
76
|
+
Please now use `Refraction.correct_horizontal_coordinates`.
|
77
|
+
|
78
|
+
### `Refraction::angle` added (#29)
|
79
|
+
|
80
|
+
This returns a refraction angle (`Angle`) based on an observer (`Observer`)
|
81
|
+
and the horizontal coordinates (`Coordinates::Horizontal`) of a body in the sky.
|
82
|
+
|
83
|
+
### `apparent` argument added to `Body::rising_time` (#29)
|
84
|
+
|
85
|
+
With a default value of `true`, this new argument will make consider a
|
86
|
+
default vertical refraction angle or not.
|
87
|
+
|
88
|
+
### `apparent` argument added to `Body::setting_time` (#29)
|
89
|
+
|
90
|
+
With a default value of `true`, this new argument will make consider a
|
91
|
+
default vertical refraction angle or not.
|
92
|
+
|
93
|
+
### `Sun::equation_of_time` method added (#40)
|
94
|
+
|
95
|
+
Returns the equation of time for a given date.
|
96
|
+
|
97
|
+
### `Sun#distance` method added (#30)
|
98
|
+
|
99
|
+
Returns the approximate Earth-Sun distance in meters (`Numeric`).
|
100
|
+
|
101
|
+
### `Sun#angular_size` method added (#30)
|
102
|
+
|
103
|
+
Returns the apparent Sun's angular size (`Angle`).
|
104
|
+
|
105
|
+
### `Sun#true_anomaly` method added (#32)
|
106
|
+
|
107
|
+
Returns the apparent Sun's true anomaly (`Angle`).
|
108
|
+
|
109
|
+
### `Sun#longitude_at_perigee` method added (#32)
|
110
|
+
|
111
|
+
Returns the apparent Sun's longitude (`Angle`) at its perigee.
|
112
|
+
|
113
|
+
### `Sun#rising_time` method added (#35)
|
114
|
+
|
115
|
+
Returns the UTC `Time` of the sunrise.`
|
116
|
+
|
117
|
+
### `Sun#rising_azimuth` method added (#39)
|
118
|
+
|
119
|
+
Returns the Sun's azimuth (`Angle`) at sunrise.
|
120
|
+
|
121
|
+
### `Sun#setting_time` method added (#35)
|
122
|
+
|
123
|
+
Returns the UTC `Time` of the sunset.
|
124
|
+
|
125
|
+
### `Sun#setting_azimuth` method added (#39)
|
126
|
+
|
127
|
+
Returns the Sun's azimuth (`Angle`) at sunset.
|
128
|
+
|
129
|
+
### Added comparison methods to `Angle` (#21)
|
130
|
+
|
131
|
+
With the inclusion of `Comparable`, comparison methods such as `#==`, `#<`,
|
132
|
+
`#>`, `#<=`, `#>=`, `#!=`, `#<=>` have been added to `Angle`.
|
133
|
+
|
134
|
+
### `GeocentricParallax` class added
|
135
|
+
|
136
|
+
Calculates the equatorial horizontal parallax for an observed body. The
|
137
|
+
class provided two class methods:
|
138
|
+
- `::angle` which returns the parallax angle
|
139
|
+
- `::for_equatorial_coordinates` which correct equatorial coordinates with
|
140
|
+
the parallax correction
|
141
|
+
|
142
|
+
### `EquinoxSolstice` class added
|
143
|
+
|
144
|
+
This class exposes `::march_equinox`, `::june_solstice`,
|
145
|
+
`::september_equinox` and `::december_soltice` that all require a year
|
146
|
+
(`Integer`) as parameter and return a date-time (`Time`) computed for the event.
|
147
|
+
|
148
|
+
### `Util::Time` class dropped
|
149
|
+
|
150
|
+
Time-related utility functions have been deleted, in favor of new classes
|
151
|
+
(see below).
|
152
|
+
|
153
|
+
### `GreenwichSiderealTime` class added
|
154
|
+
|
155
|
+
Enables to instantiate a GST from UTC, or convert a GST to UTC.
|
156
|
+
|
157
|
+
### `LocalSiderealTime` class added
|
158
|
+
|
159
|
+
Enables to instantiate a LST from GST, or convert a LST to GST.
|
data/lib/astronoby/aberration.rb
CHANGED
@@ -17,13 +17,13 @@ module Astronoby
|
|
17
17
|
# Edition: Cambridge University Press
|
18
18
|
# Chapter: 36 - Aberration
|
19
19
|
def apply
|
20
|
-
delta_longitude = Angle.
|
20
|
+
delta_longitude = Angle.from_degrees(
|
21
21
|
-20.5 * (
|
22
22
|
sun_longitude - @coordinates.longitude
|
23
23
|
).cos / @coordinates.latitude.cos / 3600
|
24
24
|
)
|
25
25
|
|
26
|
-
delta_latitude = Angle.
|
26
|
+
delta_latitude = Angle.from_degrees(
|
27
27
|
-20.5 *
|
28
28
|
(sun_longitude - @coordinates.longitude).sin *
|
29
29
|
@coordinates.latitude.sin / 3600
|
@@ -36,7 +36,10 @@ module Astronoby
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def sun_longitude
|
39
|
-
@_sun_longitude ||= Sun
|
39
|
+
@_sun_longitude ||= Sun
|
40
|
+
.new(epoch: @epoch)
|
41
|
+
.true_ecliptic_coordinates
|
42
|
+
.longitude
|
40
43
|
end
|
41
44
|
end
|
42
45
|
end
|
data/lib/astronoby/angle.rb
CHANGED
@@ -4,6 +4,8 @@ require "bigdecimal/math"
|
|
4
4
|
|
5
5
|
module Astronoby
|
6
6
|
class Angle
|
7
|
+
include Comparable
|
8
|
+
|
7
9
|
PRECISION = 14
|
8
10
|
PI = BigMath.PI(PRECISION)
|
9
11
|
PI_IN_DEGREES = BigDecimal("180")
|
@@ -23,45 +25,45 @@ module Astronoby
|
|
23
25
|
new(0)
|
24
26
|
end
|
25
27
|
|
26
|
-
def
|
28
|
+
def from_radians(radians)
|
27
29
|
normalized_radians = radians.remainder(FULL_CIRCLE_IN_RADIANS)
|
28
30
|
new(normalized_radians)
|
29
31
|
end
|
30
32
|
|
31
|
-
def
|
33
|
+
def from_degrees(degrees)
|
32
34
|
radians = degrees / PI_IN_DEGREES * PI
|
33
|
-
|
35
|
+
from_radians(radians)
|
34
36
|
end
|
35
37
|
|
36
|
-
def
|
38
|
+
def from_hours(hours)
|
37
39
|
radians = hours * RADIAN_PER_HOUR
|
38
|
-
|
40
|
+
from_radians(radians)
|
39
41
|
end
|
40
42
|
|
41
|
-
def
|
43
|
+
def from_hms(hour, minute, second)
|
42
44
|
hours = hour + minute / MINUTES_PER_HOUR + second / SECONDS_PER_HOUR
|
43
|
-
|
45
|
+
from_hours(hours)
|
44
46
|
end
|
45
47
|
|
46
|
-
def
|
48
|
+
def from_dms(degree, minute, second)
|
47
49
|
sign = degree.negative? ? -1 : 1
|
48
50
|
degrees = degree.abs + minute / MINUTES_PER_HOUR + second / SECONDS_PER_HOUR
|
49
|
-
|
51
|
+
from_degrees(sign * degrees)
|
50
52
|
end
|
51
53
|
|
52
54
|
def asin(ratio)
|
53
55
|
radians = Math.asin(ratio)
|
54
|
-
|
56
|
+
from_radians(radians)
|
55
57
|
end
|
56
58
|
|
57
59
|
def acos(ratio)
|
58
60
|
radians = Math.acos(ratio)
|
59
|
-
|
61
|
+
from_radians(radians)
|
60
62
|
end
|
61
63
|
|
62
64
|
def atan(ratio)
|
63
65
|
radians = Math.atan(ratio)
|
64
|
-
|
66
|
+
from_radians(radians)
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
@@ -85,11 +87,11 @@ module Astronoby
|
|
85
87
|
end
|
86
88
|
|
87
89
|
def +(other)
|
88
|
-
self.class.
|
90
|
+
self.class.from_radians(radians + other.radians)
|
89
91
|
end
|
90
92
|
|
91
93
|
def -(other)
|
92
|
-
self.class.
|
94
|
+
self.class.from_radians(@radians - other.radians)
|
93
95
|
end
|
94
96
|
|
95
97
|
def sin
|
@@ -116,20 +118,16 @@ module Astronoby
|
|
116
118
|
radians.zero?
|
117
119
|
end
|
118
120
|
|
119
|
-
def ==(other)
|
120
|
-
other.is_a?(self.class) && radians == other.radians
|
121
|
-
end
|
122
|
-
alias_method :eql?, :==
|
123
|
-
|
124
121
|
def hash
|
125
122
|
[radians, self.class].hash
|
126
123
|
end
|
127
124
|
|
128
125
|
def <=>(other)
|
129
|
-
return
|
126
|
+
return unless other.is_a?(self.class)
|
130
127
|
|
131
128
|
radians <=> other.radians
|
132
129
|
end
|
130
|
+
alias_method :eql?, :==
|
133
131
|
|
134
132
|
def str(format)
|
135
133
|
case format
|