Module: IERS::GMST

Defined in:
lib/iers/gmst.rb

Class Method Summary collapse

Class Method Details

.at(input = nil, jd: nil, mjd: nil, interpolation: nil) ⇒ Float

Returns Greenwich Mean Sidereal Time in radians, norm. to [0, 2π).

Parameters:

  • input (Time, Date, DateTime, nil) (defaults to: nil)
  • jd (Float, nil) (defaults to: nil)

    Julian Date

  • mjd (Float, nil) (defaults to: nil)

    Modified Julian Date

  • interpolation (Symbol, nil) (defaults to: nil)

    +:lagrange+ or +:linear+

Returns:

  • (Float)

    Greenwich Mean Sidereal Time in radians, norm. to [0, 2π)

Raises:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/iers/gmst.rb', line 27

def at(input = nil, jd: nil, mjd: nil, interpolation: nil)
  query_mjd = TimeScale.to_mjd(input, jd: jd, mjd: mjd)
  era = EarthRotationAngle.at(mjd: query_mjd, interpolation: interpolation)

  tai_utc = LeapSecond.at(mjd: query_mjd)
  tt_mjd = query_mjd +
    (tai_utc + TimeScale::TT_TAI) / TimeScale::SECONDS_PER_DAY
  t = (tt_mjd - TimeScale::MJD_J2000) / TimeScale::DAYS_PER_JULIAN_CENTURY

  poly = POLYNOMIAL.reverse.reduce { |acc, c| acc * t + c }
  gmst = (era + poly * TimeScale::ARCSEC_TO_RAD) % TWO_PI
  gmst += TWO_PI if gmst < 0.0
  gmst
end