Class: Astronoby::JulianDate
- Inherits:
-
Object
- Object
- Astronoby::JulianDate
- Defined in:
- lib/astronoby/julian_date.rb
Overview
Constant Summary collapse
- BESSELIAN_EPOCH_STARTING_YEAR =
Starting year for Besselian epoch calculations
1900- JULIAN_EPOCH_STARTING_YEAR =
Starting year for Julian epoch calculations
2000- B1875 =
Julian Date for Besselian epoch 1875.0
2405889.258550475- B1900 =
Julian Date for Besselian epoch 1900.0
2415020.31352- J1950 =
Julian Date for Julian epoch 1950.0
2433282.5- J2000 =
Julian Date for Julian epoch 2000.0 (current standard)
2451545.0- DEFAULT_EPOCH =
Default epoch used by the library
J2000
Class Method Summary collapse
-
.from_besselian_year(besselian_year) ⇒ Float
Converts a Besselian year to Julian Date.
-
.from_julian_year(julian_year) ⇒ Float
Converts a Julian year to Julian Date.
-
.from_time(time) ⇒ Rational
Converts a Time object to Julian Date.
Class Method Details
.from_besselian_year(besselian_year) ⇒ Float
Converts a Besselian year to Julian Date
Uses the formula: JD = B1900 + 365.242198781 * (year - 1900) where 365.242198781 is the tropical year length at B1900.
73 74 75 76 |
# File 'lib/astronoby/julian_date.rb', line 73 def self.from_besselian_year(besselian_year) B1900 + Constants::TROPICAL_YEAR_AT_B1900 * (besselian_year - BESSELIAN_EPOCH_STARTING_YEAR) end |
.from_julian_year(julian_year) ⇒ Float
Converts a Julian year to Julian Date
Uses the formula: JD = J2000 + 365.25 * (year - 2000)
57 58 59 60 |
# File 'lib/astronoby/julian_date.rb', line 57 def self.from_julian_year(julian_year) J2000 + Constants::DAYS_PER_JULIAN_YEAR * (julian_year - JULIAN_EPOCH_STARTING_YEAR) end |
.from_time(time) ⇒ Rational
Converts a Time object to Julian Date
43 44 45 |
# File 'lib/astronoby/julian_date.rb', line 43 def self.from_time(time) time.to_datetime.ajd end |