Class: Astronoby::GreenwichApparentSiderealTime

Inherits:
GreenwichSiderealTime show all
Defined in:
lib/astronoby/time/greenwich_apparent_sidereal_time.rb

Overview

Greenwich Apparent Sidereal Time (GAST). Derived from GMST by applying the equation of the equinoxes (nutation correction).

Constant Summary

Constants inherited from SiderealTime

SiderealTime::TYPES

Instance Attribute Summary

Attributes inherited from SiderealTime

#date, #time, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GreenwichSiderealTime

apparent_from_utc, mean_from_utc, #to_lst, #to_utc

Methods inherited from SiderealTime

#apparent?, #mean?, normalize_time, #normalize_time, validate_type!

Constructor Details

#initialize(date:, time:) ⇒ GreenwichApparentSiderealTime

Returns a new instance of GreenwichApparentSiderealTime.

Parameters:

  • date (Date)

    the calendar date

  • time (Numeric)

    GAST in hours



27
28
29
# File 'lib/astronoby/time/greenwich_apparent_sidereal_time.rb', line 27

def initialize(date:, time:)
  super(date: date, time: time, type: APPARENT)
end

Class Method Details

.from_utc(utc) ⇒ Astronoby::GreenwichApparentSiderealTime

Creates GAST from UTC by computing GMST and applying the equation of the equinoxes.

Parameters:

  • utc (Time)

    the UTC time

Returns:



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/astronoby/time/greenwich_apparent_sidereal_time.rb', line 12

def self.from_utc(utc)
  gmst = GreenwichMeanSiderealTime.from_utc(utc)
  instant = Instant.from_time(utc)
  nutation = Nutation.new(instant: instant)
  mean_obliquity = MeanObliquity.at(instant)

  equation_of_equinoxes = nutation.nutation_in_longitude.hours *
    mean_obliquity.cos
  gast_time = normalize_time(gmst.time + equation_of_equinoxes)

  new(date: gmst.date, time: gast_time)
end