Class: Astronoby::LocalMeanSiderealTime

Inherits:
LocalSiderealTime show all
Defined in:
lib/astronoby/time/local_mean_sidereal_time.rb

Overview

Local Mean Sidereal Time (LMST). Derived from GMST by adding the observer’s longitude.

Constant Summary

Constants inherited from SiderealTime

SiderealTime::TYPES

Instance Attribute Summary

Attributes inherited from LocalSiderealTime

#longitude

Attributes inherited from SiderealTime

#date, #time, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SiderealTime

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

Constructor Details

#initialize(date:, time:, longitude:) ⇒ LocalMeanSiderealTime

Returns a new instance of LocalMeanSiderealTime.

Parameters:

  • date (Date)

    the calendar date

  • time (Numeric)

    LMST in hours

  • longitude (Astronoby::Angle)

    the observer’s longitude



43
44
45
# File 'lib/astronoby/time/local_mean_sidereal_time.rb', line 43

def initialize(date:, time:, longitude:)
  super(date: date, time: time, longitude: longitude, type: MEAN)
end

Class Method Details

.from_gst(gst:, longitude:) ⇒ Astronoby::LocalMeanSiderealTime

Creates LMST from a Greenwich Mean Sidereal Time and longitude.

Source:

Title: Practical Astronomy with your Calculator or Spreadsheet
Authors: Peter Duffett-Smith and Jonathan Zwart
Edition: Cambridge University Press
Chapter: 14 - Local sidereal time (LST)

Parameters:

Returns:

Raises:

  • (ArgumentError)

    if gst is not mean sidereal time



19
20
21
22
23
24
25
26
27
28
# File 'lib/astronoby/time/local_mean_sidereal_time.rb', line 19

def self.from_gst(gst:, longitude:)
  unless gst.mean?
    raise ArgumentError, "GST must be mean sidereal time"
  end

  date = gst.date
  time = normalize_time(gst.time + longitude.hours)

  new(date: date, time: time, longitude: longitude)
end

.from_utc(utc, longitude:) ⇒ Astronoby::LocalMeanSiderealTime

Creates LMST from UTC and longitude.

Parameters:

  • utc (Time)

    the UTC time

  • longitude (Astronoby::Angle)

    the observer’s longitude

Returns:



35
36
37
38
# File 'lib/astronoby/time/local_mean_sidereal_time.rb', line 35

def self.from_utc(utc, longitude:)
  gmst = GreenwichMeanSiderealTime.from_utc(utc)
  from_gst(gst: gmst, longitude: longitude)
end

Instance Method Details

#to_gstAstronoby::GreenwichMeanSiderealTime

Converts to Greenwich Mean Sidereal Time.

Source:

Title: Practical Astronomy with your Calculator or Spreadsheet
Authors: Peter Duffett-Smith and Jonathan Zwart
Edition: Cambridge University Press
Chapter: 15 - Converting LST to GST


56
57
58
59
60
61
# File 'lib/astronoby/time/local_mean_sidereal_time.rb', line 56

def to_gst
  date = @date
  time = normalize_time(@time - @longitude.hours)

  GreenwichMeanSiderealTime.new(date: date, time: time)
end