astronoby 0.0.1 → 0.2.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/.tool-versions +1 -0
- data/CHANGELOG.md +74 -4
- data/CONTRIBUTING.md +86 -0
- data/Gemfile.lock +52 -35
- data/README.md +81 -9
- data/UPGRADING.md +109 -0
- data/lib/astronoby/aberration.rb +42 -0
- data/lib/astronoby/angle.rb +157 -21
- data/lib/astronoby/angles/dms.rb +18 -0
- data/lib/astronoby/angles/hms.rb +17 -0
- data/lib/astronoby/bodies/sun.rb +226 -0
- data/lib/astronoby/body.rb +155 -0
- data/lib/astronoby/coordinates/ecliptic.rb +42 -0
- data/lib/astronoby/coordinates/equatorial.rb +88 -0
- data/lib/astronoby/coordinates/horizontal.rb +53 -0
- data/lib/astronoby/epoch.rb +24 -0
- data/lib/astronoby/equinox_solstice.rb +153 -0
- data/lib/astronoby/errors.rb +7 -0
- data/lib/astronoby/geocentric_parallax.rb +130 -0
- data/lib/astronoby/mean_obliquity.rb +32 -0
- data/lib/astronoby/nutation.rb +71 -0
- data/lib/astronoby/observer.rb +57 -0
- data/lib/astronoby/precession.rb +86 -0
- data/lib/astronoby/refraction.rb +73 -0
- data/lib/astronoby/time/greenwich_sidereal_time.rb +86 -0
- data/lib/astronoby/time/local_sidereal_time.rb +41 -0
- data/lib/astronoby/true_obliquity.rb +12 -0
- data/lib/astronoby/util/astrodynamics.rb +60 -0
- data/lib/astronoby/util/trigonometry.rb +26 -0
- data/lib/astronoby/version.rb +1 -1
- data/lib/astronoby.rb +23 -8
- metadata +45 -25
- data/.prettierrc +0 -11
- data/.standard.yml +0 -3
- data/astronoby.gemspec +0 -40
- data/lib/astronoby/angles/degree.rb +0 -17
- data/lib/astronoby/angles/radian.rb +0 -17
- data/sig/astronoby.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25e45175dabf69ffa0c98ffdf3e93cb21b9ce004fe4e0ffe61a4cfc92794ae44
|
4
|
+
data.tar.gz: 2d1ad05a74a171c71f6ff0a7fa7c3af1874f07379c8be407ff633d61ad4dd78e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74cdfbf511e8094bd410c67ed86eaff12f03124bec48c769eb3e6ebf1fd54870145a556cc82214db5147bd2c6e4631d0514973a76648d0e68d8770162401d338
|
7
|
+
data.tar.gz: 7a6c7f98fff52a04d60dc5c4eced47610900aa10a64f8016000b9294276d547d4d350ef0d269a25f42ae9b0078d110ad9b73884f3834e55a12084274f358ae15
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.2.2
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,76 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 0.2.0 - 2024-03-24
|
4
4
|
|
5
|
-
|
6
|
-
|
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
|
+
* Angle comparison ([#21])
|
12
|
+
* Add `#distance` and `#angular_size` to `Astronoby::Sun` ([#30])
|
13
|
+
* Add geocentric parallax `Astronoby::GeocentricParallax` ([#31])
|
14
|
+
* Ability to calculate equinoxes and solstices times ([#32])
|
15
|
+
* Round rising and setting times to the second ([#38])
|
16
|
+
* Provide sunrise and sunset times ([#35])
|
17
|
+
* Provide sunrise and sunset azimuths ([#39])
|
18
|
+
* Ability to calculate the equation of time ([#40])
|
19
|
+
|
20
|
+
### Breaking changes
|
21
|
+
|
22
|
+
* **breaking:** Accurate setting and rising times for punctual bodies ([#29])
|
23
|
+
* **breaking:** Drop `Astronoby::Util::Time` in favor of
|
24
|
+
`Astronoby::GreenwichSiderealTime` and `Astonoby::LocalSiderealTime` ([#36])
|
25
|
+
|
26
|
+
### Improvements
|
27
|
+
|
28
|
+
* Add Dependabot for Bundler and GitHub Actions ([#24])
|
29
|
+
* Add bundler-audit GitHub Action ([#25])
|
30
|
+
* Bump actions/checkout from 3 to 4 ([#26])
|
31
|
+
* Bump standard from 1.29.0 to 1.35.1 ([#27], [#37])
|
32
|
+
* Bump rspec from 3.12.0 to 3.13.0 ([#28])
|
33
|
+
|
34
|
+
[#21]: https://github.com/rhannequin/astronoby/pull/21
|
35
|
+
[#24]: https://github.com/rhannequin/astronoby/pull/24
|
36
|
+
[#25]: https://github.com/rhannequin/astronoby/pull/25
|
37
|
+
[#26]: https://github.com/rhannequin/astronoby/pull/26
|
38
|
+
[#27]: https://github.com/rhannequin/astronoby/pull/27
|
39
|
+
[#28]: https://github.com/rhannequin/astronoby/pull/28
|
40
|
+
[#29]: https://github.com/rhannequin/astronoby/pull/29
|
41
|
+
[#30]: https://github.com/rhannequin/astronoby/pull/30
|
42
|
+
[#31]: https://github.com/rhannequin/astronoby/pull/31
|
43
|
+
[#32]: https://github.com/rhannequin/astronoby/pull/32
|
44
|
+
[#35]: https://github.com/rhannequin/astronoby/pull/35
|
45
|
+
[#36]: https://github.com/rhannequin/astronoby/pull/36
|
46
|
+
[#37]: https://github.com/rhannequin/astronoby/pull/37
|
47
|
+
[#28]: https://github.com/rhannequin/astronoby/pull/38
|
48
|
+
[#39]: https://github.com/rhannequin/astronoby/pull/39
|
49
|
+
[#40]: https://github.com/rhannequin/astronoby/pull/40
|
50
|
+
|
51
|
+
## 0.1.0 - 2024-02-28
|
52
|
+
|
53
|
+
### Features
|
54
|
+
|
55
|
+
* Support angles in hours
|
56
|
+
* Support coordinates
|
57
|
+
* `Astronoby::Coordinates::Horizontal`
|
58
|
+
* `Astronoby::Coordinates::Equatorial`
|
59
|
+
* `Astronoby::Coordinates::Ecliptic`
|
60
|
+
* Add new body `Astronoby::Sun`
|
61
|
+
* Add `Astronoby::Aberration`
|
62
|
+
* Add `Astronoby::Epoch`
|
63
|
+
* Add `Astronoby::MeanObliquity`
|
64
|
+
* Add `Astronoby::TrueObliquity`
|
65
|
+
* Add `Astronoby::Nutation`
|
66
|
+
* Add `Astronoby::Precession`
|
67
|
+
* Add `Astronoby::Refraction`
|
68
|
+
* Add utils
|
69
|
+
* `Astronoby::Util::Astrodynamics`
|
70
|
+
* `Astronoby::Util::Time`
|
71
|
+
* `Astronoby::Util::Trigonometry`
|
72
|
+
|
73
|
+
## 0.0.1 - 2022-04-20
|
74
|
+
|
75
|
+
* Add `Astronoby::Angle`
|
76
|
+
* Support angles in degrees and radians
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Contributing to Astronoby
|
2
|
+
|
3
|
+
By participating in this project, you agree to follow the [code of conduct].
|
4
|
+
|
5
|
+
[code of conduct]: https://github.com/rhannequin/astronoby/blob/main/CODE_OF_CONDUCT.md
|
6
|
+
|
7
|
+
Here are some ways *you* can contribute:
|
8
|
+
|
9
|
+
* by reporting bugs
|
10
|
+
* by suggesting new features
|
11
|
+
* by writing or editing documentation
|
12
|
+
* by writing specifications
|
13
|
+
* by writing code (**no patch is too small** : fix typos, add comments, etc.)
|
14
|
+
* by refactoring code
|
15
|
+
* by closing [issues]
|
16
|
+
* by reviewing patches
|
17
|
+
|
18
|
+
[issues]: https://github.com/rhannequin/astronoby/issues
|
19
|
+
|
20
|
+
## Submitting an Issue
|
21
|
+
|
22
|
+
* We use the [GitHub issue tracker][issues] to track bugs and features.
|
23
|
+
* Before submitting a bug report or feature request, check to make sure it hasn't
|
24
|
+
already been submitted.
|
25
|
+
* When submitting a bug report, please include any other details that may be
|
26
|
+
necessary to reproduce the bug, including your gem version, Ruby version, and
|
27
|
+
operating system.
|
28
|
+
|
29
|
+
## Cleaning up issues
|
30
|
+
|
31
|
+
* Issues that have no response from the submitter will be closed after 30 days.
|
32
|
+
* Issues will be closed once they're assumed to be fixed or answered. If the
|
33
|
+
maintainer is wrong, it can be opened again.
|
34
|
+
* If your issue is closed by mistake, please understand and explain the issue.
|
35
|
+
We will happily reopen the issue.
|
36
|
+
|
37
|
+
## Submitting a Pull Request
|
38
|
+
|
39
|
+
1. [Fork][fork] the [official repository][repo].
|
40
|
+
1. [Create a topic branch.][branch]
|
41
|
+
1. Implement your feature or bug fix.
|
42
|
+
1. Add, commit, and push your changes.
|
43
|
+
1. [Submit a pull request.][pr]
|
44
|
+
|
45
|
+
### Notes
|
46
|
+
|
47
|
+
* Please add tests if you changed code. Contributions without tests won't be accepted.
|
48
|
+
* If you don't know how to add tests, please put in a PR and leave a comment
|
49
|
+
asking for help. We love helping!
|
50
|
+
* Please don't update the Gem version.
|
51
|
+
|
52
|
+
## Setting up
|
53
|
+
|
54
|
+
```sh
|
55
|
+
bin/setup
|
56
|
+
```
|
57
|
+
|
58
|
+
## Running the test suite
|
59
|
+
|
60
|
+
The default rake task will run the full test suite:
|
61
|
+
|
62
|
+
```sh
|
63
|
+
bundle exec rake
|
64
|
+
```
|
65
|
+
|
66
|
+
To run an individual rspec test, you can provide a path and line number:
|
67
|
+
|
68
|
+
```sh
|
69
|
+
bundle exec rspec spec/path/to/spec.rb:123
|
70
|
+
```
|
71
|
+
|
72
|
+
## Formatting
|
73
|
+
|
74
|
+
Use [standard] to automatically format your code:
|
75
|
+
|
76
|
+
```sh
|
77
|
+
bundle exec standardrb --fix
|
78
|
+
```
|
79
|
+
|
80
|
+
[repo]: https://github.com/rhannequin/astronoby/tree/main
|
81
|
+
[fork]: https://help.github.com/articles/fork-a-repo/
|
82
|
+
[branch]: https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/
|
83
|
+
[pr]: https://help.github.com/articles/using-pull-requests/
|
84
|
+
[standard]: https://github.com/testdouble/standard
|
85
|
+
|
86
|
+
Inspired by https://github.com/thoughtbot/factory_bot/blob/main/CONTRIBUTING.md
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
astronoby (0.0
|
4
|
+
astronoby (0.2.0)
|
5
|
+
matrix (~> 0.4.2)
|
5
6
|
rake (~> 13.0)
|
6
7
|
rspec (~> 3.0)
|
7
8
|
|
@@ -9,54 +10,70 @@ GEM
|
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
12
|
ast (2.4.2)
|
12
|
-
diff-lcs (1.5.
|
13
|
-
|
14
|
-
|
13
|
+
diff-lcs (1.5.1)
|
14
|
+
json (2.7.1)
|
15
|
+
language_server-protocol (3.17.0.3)
|
16
|
+
lint_roller (1.1.0)
|
17
|
+
matrix (0.4.2)
|
18
|
+
parallel (1.24.0)
|
19
|
+
parser (3.3.0.5)
|
15
20
|
ast (~> 2.4.1)
|
16
|
-
|
21
|
+
racc
|
22
|
+
racc (1.7.3)
|
17
23
|
rainbow (3.1.1)
|
18
|
-
rake (13.0
|
19
|
-
regexp_parser (2.
|
20
|
-
rexml (3.2.
|
21
|
-
rspec (3.
|
22
|
-
rspec-core (~> 3.
|
23
|
-
rspec-expectations (~> 3.
|
24
|
-
rspec-mocks (~> 3.
|
25
|
-
rspec-core (3.
|
26
|
-
rspec-support (~> 3.
|
27
|
-
rspec-expectations (3.
|
24
|
+
rake (13.1.0)
|
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)
|
28
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-mocks (3.
|
35
|
+
rspec-support (~> 3.13.0)
|
36
|
+
rspec-mocks (3.13.0)
|
31
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-support (3.
|
34
|
-
rubocop (1.
|
38
|
+
rspec-support (~> 3.13.0)
|
39
|
+
rspec-support (3.13.1)
|
40
|
+
rubocop (1.62.1)
|
41
|
+
json (~> 2.3)
|
42
|
+
language_server-protocol (>= 3.17.0)
|
35
43
|
parallel (~> 1.10)
|
36
|
-
parser (>= 3.
|
44
|
+
parser (>= 3.3.0.2)
|
37
45
|
rainbow (>= 2.2.2, < 4.0)
|
38
46
|
regexp_parser (>= 1.8, < 3.0)
|
39
|
-
rexml
|
40
|
-
rubocop-ast (>= 1.
|
47
|
+
rexml (>= 3.2.5, < 4.0)
|
48
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
41
49
|
ruby-progressbar (~> 1.7)
|
42
|
-
unicode-display_width (>=
|
43
|
-
rubocop-ast (1.
|
44
|
-
parser (>= 3.
|
45
|
-
rubocop-performance (1.
|
46
|
-
rubocop (>= 1.
|
47
|
-
rubocop-ast (>=
|
48
|
-
ruby-progressbar (1.
|
49
|
-
standard (1.
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
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)
|
56
|
+
ruby-progressbar (1.13.0)
|
57
|
+
standard (1.35.1)
|
58
|
+
language_server-protocol (~> 3.17.0.2)
|
59
|
+
lint_roller (~> 1.0)
|
60
|
+
rubocop (~> 1.62.0)
|
61
|
+
standard-custom (~> 1.0.0)
|
62
|
+
standard-performance (~> 1.3)
|
63
|
+
standard-custom (1.0.2)
|
64
|
+
lint_roller (~> 1.0)
|
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)
|
53
70
|
|
54
71
|
PLATFORMS
|
72
|
+
ruby
|
55
73
|
x86_64-linux
|
56
74
|
|
57
75
|
DEPENDENCIES
|
58
76
|
astronoby!
|
59
|
-
prettier (~> 2.0)
|
60
77
|
standard (~> 1.3)
|
61
78
|
|
62
79
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
|
-
# Astronoby
|
1
|
+
# Astronoby
|
2
2
|
|
3
|
-
Ruby
|
3
|
+
[](https://github.com/rhannequin/astronoby/actions?query=workflow%3ARuby)
|
4
|
+
|
5
|
+
Ruby library to provide a useful API to compute astronomical calculations, based
|
6
|
+
on astrometry books.
|
7
|
+
|
8
|
+
The main reference is:
|
9
|
+
- _Astronomical Algorithms_ by Jean Meeus
|
10
|
+
- _Celestial Calculations_ by J. L. Lawrence
|
11
|
+
- _Practical Astronomy with your Calculator or Spreadsheet_ by Peter
|
12
|
+
Duffet-Smith and Jonathan Zwart
|
4
13
|
|
5
14
|
## Installation
|
6
15
|
|
@@ -8,28 +17,91 @@ Install the gem and add to the application's Gemfile by executing:
|
|
8
17
|
|
9
18
|
$ bundle add astronoby
|
10
19
|
|
11
|
-
If bundler is not being used to manage dependencies, install the gem by
|
20
|
+
If bundler is not being used to manage dependencies, install the gem by
|
21
|
+
executing:
|
12
22
|
|
13
23
|
$ gem install astronoby
|
14
24
|
|
15
25
|
## Usage
|
16
26
|
|
17
|
-
|
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
|
+
### Sun's location in the sky
|
32
|
+
|
33
|
+
```rb
|
34
|
+
time = Time.utc(2023, 2, 17, 11, 0, 0)
|
35
|
+
epoch = Astronoby::Epoch.from_time(time)
|
36
|
+
|
37
|
+
latitude = Astronoby::Angle.as_degrees(48.8566)
|
38
|
+
longitude = Astronoby::Angle.as_degrees(2.3522)
|
39
|
+
|
40
|
+
sun = Astronoby::Sun.new(epoch: epoch)
|
41
|
+
|
42
|
+
horizontal_coordinates = sun.horizontal_coordinates(
|
43
|
+
latitude: latitude,
|
44
|
+
longitude: longitude
|
45
|
+
)
|
46
|
+
|
47
|
+
horizontal_coordinates.altitude.degrees.to_f
|
48
|
+
# => 27.502365130176567
|
49
|
+
|
50
|
+
horizontal_coordinates.altitude.str(:dms)
|
51
|
+
# => "+27° 30′ 8.5144″"
|
52
|
+
```
|
53
|
+
|
54
|
+
### Solstice and Equinox times
|
55
|
+
|
56
|
+
```rb
|
57
|
+
year = 2024
|
58
|
+
|
59
|
+
Astronoby::EquinoxSolstice.march_equinox(year)
|
60
|
+
# => 2024-03-20 03:05:00 UTC
|
61
|
+
|
62
|
+
Astronoby::EquinoxSolstice.june_solstice(year)
|
63
|
+
# => 2024-06-20 20:50:14 UTC
|
64
|
+
```
|
65
|
+
|
66
|
+
## Precision
|
67
|
+
|
68
|
+
The current precision for the Sun's apparent location in the sky, compared
|
69
|
+
to values computed by the [IMCCE] is approximately 1 arc minute. It corresponds
|
70
|
+
to twice the apparent size of Jupiter when it is the closest to Earth.
|
71
|
+
|
72
|
+
While the precision is not enough for very high accuracy computations, it is
|
73
|
+
equal to the Human naked eye's angular resolution.
|
74
|
+
|
75
|
+
[IMCCE]: https://www.imcce.fr
|
18
76
|
|
19
77
|
## Development
|
20
78
|
|
21
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
79
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
80
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
81
|
+
prompt that will allow you to experiment.
|
82
|
+
|
83
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
84
|
+
release a new version, update the version number in `version.rb`, and then run
|
85
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
86
|
+
git commits and the created tag, and push the `.gem` file to [rubygems.org].
|
22
87
|
|
23
|
-
|
88
|
+
[rubygems.org]: https://rubygems.org
|
24
89
|
|
25
90
|
## Contributing
|
26
91
|
|
27
|
-
|
92
|
+
Please see [CONTRIBUTING.md](https://github.com/rhannequin/astronoby/blob/main/CONTRIBUTING.md).
|
93
|
+
|
94
|
+
[code of conduct]: https://github.com/rhannequin/astronoby/blob/main/CODE_OF_CONDUCT.md
|
28
95
|
|
29
96
|
## License
|
30
97
|
|
31
|
-
The gem is available as open source under the terms of the [MIT License]
|
98
|
+
The gem is available as open source under the terms of the [MIT License].
|
99
|
+
|
100
|
+
[MIT License]: https://opensource.org/licenses/MIT
|
32
101
|
|
33
102
|
## Code of Conduct
|
34
103
|
|
35
|
-
Everyone interacting in the Astronoby project's codebases, issue trackers, chat
|
104
|
+
Everyone interacting in the Astronoby project's codebases, issue trackers, chat
|
105
|
+
rooms and mailing lists is expected to follow the [code of conduct].
|
106
|
+
|
107
|
+
[code of conduct]: https://github.com/rhannequin/astronoby/blob/main/CODE_OF_CONDUCT.md
|
data/UPGRADING.md
ADDED
@@ -0,0 +1,109 @@
|
|
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.1.0 to 0.2.0
|
11
|
+
|
12
|
+
### `Observer` class added (#29)
|
13
|
+
|
14
|
+
The `Observer` class aims to represent an observer's location and local
|
15
|
+
parameters such as the temperature and astmospheric pressure.
|
16
|
+
|
17
|
+
### `Refraction` constructor changed (#29)
|
18
|
+
|
19
|
+
`Refraction.new` now takes the following arguments:
|
20
|
+
|
21
|
+
* `coordinates` (`Coordinates::Horizontal`)
|
22
|
+
* `observer` (`Observer`)
|
23
|
+
|
24
|
+
### `Refraction::for_horizontal_coordinates` removed (#29)
|
25
|
+
|
26
|
+
Please now use `Refraction.correct_horizontal_coordinates`.
|
27
|
+
|
28
|
+
### `Refraction::angle` added (#29)
|
29
|
+
|
30
|
+
This returns a refraction angle (`Angle`) based on an observer (`Observer`)
|
31
|
+
and the horizontal coordinates (`Coordinates::Horizontal`) of a body in the sky.
|
32
|
+
|
33
|
+
### `apparent` argument added to `Body::rising_time` (#29)
|
34
|
+
|
35
|
+
With a default value of `true`, this new argument will make consider a
|
36
|
+
default vertical refraction angle or not.
|
37
|
+
|
38
|
+
### `apparent` argument added to `Body::setting_time` (#29)
|
39
|
+
|
40
|
+
With a default value of `true`, this new argument will make consider a
|
41
|
+
default vertical refraction angle or not.
|
42
|
+
|
43
|
+
### `Sun::equation_of_time` method added (#40)
|
44
|
+
|
45
|
+
Returns the equation of time for a given date.
|
46
|
+
|
47
|
+
### `Sun#distance` method added (#30)
|
48
|
+
|
49
|
+
Returns the approximate Earth-Sun distance in meters (`Numeric`).
|
50
|
+
|
51
|
+
### `Sun#angular_size` method added (#30)
|
52
|
+
|
53
|
+
Returns the apparent Sun's angular size (`Angle`).
|
54
|
+
|
55
|
+
### `Sun#true_anomaly` method added (#32)
|
56
|
+
|
57
|
+
Returns the apparent Sun's true anomaly (`Angle`).
|
58
|
+
|
59
|
+
### `Sun#longitude_at_perigee` method added (#32)
|
60
|
+
|
61
|
+
Returns the apparent Sun's longitude (`Angle`) at its perigee.
|
62
|
+
|
63
|
+
### `Sun#rising_time` method added (#35)
|
64
|
+
|
65
|
+
Returns the UTC `Time` of the sunrise.`
|
66
|
+
|
67
|
+
### `Sun#rising_azimuth` method added (#39)
|
68
|
+
|
69
|
+
Returns the Sun's azimuth (`Angle`) at sunrise.
|
70
|
+
|
71
|
+
### `Sun#setting_time` method added (#35)
|
72
|
+
|
73
|
+
Returns the UTC `Time` of the sunset.
|
74
|
+
|
75
|
+
### `Sun#setting_azimuth` method added (#39)
|
76
|
+
|
77
|
+
Returns the Sun's azimuth (`Angle`) at sunset.
|
78
|
+
|
79
|
+
### Added comparison methods to `Angle` (#21)
|
80
|
+
|
81
|
+
With the inclusion of `Comparable`, comparison methods such as `#==`, `#<`,
|
82
|
+
`#>`, `#<=`, `#>=`, `#!=`, `#<=>` have been added to `Angle`.
|
83
|
+
|
84
|
+
### `GeocentricParallax` class added
|
85
|
+
|
86
|
+
Calculates the equatorial horizontal parallax for an observed body. The
|
87
|
+
class provided two class methods:
|
88
|
+
- `::angle` which returns the parallax angle
|
89
|
+
- `::for_equatorial_coordinates` which correct equatorial coordinates with
|
90
|
+
the parallax correction
|
91
|
+
|
92
|
+
### `EquinoxSolstice` class added
|
93
|
+
|
94
|
+
This class exposes `::march_equinox`, `::june_solstice`,
|
95
|
+
`::september_equinox` and `::december_soltice` that all require a year
|
96
|
+
(`Integer`) as parameter and return a date-time (`Time`) computed for the event.
|
97
|
+
|
98
|
+
### `Util::Time` class dropped
|
99
|
+
|
100
|
+
Time-related utility functions have been deleted, in favor of new classes
|
101
|
+
(see below).
|
102
|
+
|
103
|
+
### `GreenwichSiderealTime` class added
|
104
|
+
|
105
|
+
Enables to instantiate a GST from UTC, or convert a GST to UTC.
|
106
|
+
|
107
|
+
### `LocalSiderealTime` class added
|
108
|
+
|
109
|
+
Enables to instantiate a LST from GST, or convert a LST to GST.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Astronoby
|
4
|
+
class Aberration
|
5
|
+
def self.for_ecliptic_coordinates(coordinates:, epoch:)
|
6
|
+
new(coordinates, epoch).apply
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(coordinates, epoch)
|
10
|
+
@coordinates = coordinates
|
11
|
+
@epoch = epoch
|
12
|
+
end
|
13
|
+
|
14
|
+
# Source:
|
15
|
+
# Title: Practical Astronomy with your Calculator or Spreadsheet
|
16
|
+
# Authors: Peter Duffett-Smith and Jonathan Zwart
|
17
|
+
# Edition: Cambridge University Press
|
18
|
+
# Chapter: 36 - Aberration
|
19
|
+
def apply
|
20
|
+
delta_longitude = Angle.as_degrees(
|
21
|
+
-20.5 * (
|
22
|
+
sun_longitude - @coordinates.longitude
|
23
|
+
).cos / @coordinates.latitude.cos / 3600
|
24
|
+
)
|
25
|
+
|
26
|
+
delta_latitude = Angle.as_degrees(
|
27
|
+
-20.5 *
|
28
|
+
(sun_longitude - @coordinates.longitude).sin *
|
29
|
+
@coordinates.latitude.sin / 3600
|
30
|
+
)
|
31
|
+
|
32
|
+
Coordinates::Ecliptic.new(
|
33
|
+
latitude: @coordinates.latitude + delta_latitude,
|
34
|
+
longitude: @coordinates.longitude + delta_longitude
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def sun_longitude
|
39
|
+
@_sun_longitude ||= Sun.new(epoch: @epoch).ecliptic_coordinates.longitude
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|