Class: Astronoby::LocalApparentSiderealTime

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

Overview

Local Apparent Sidereal Time (LAST). Derived from GAST 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:) ⇒ LocalApparentSiderealTime

Returns a new instance of LocalApparentSiderealTime.

Parameters:

  • date (Date)

    the calendar date

  • time (Numeric)

    LAST in hours

  • longitude (Astronoby::Angle)

    the observer’s longitude



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

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

Class Method Details

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

Creates LAST from a Greenwich Apparent 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 apparent sidereal time



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

def self.from_gst(gst:, longitude:)
  unless gst.apparent?
    raise ArgumentError, "GST must be apparent 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::LocalApparentSiderealTime

Creates LAST 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_apparent_sidereal_time.rb', line 35

def self.from_utc(utc, longitude:)
  gast = GreenwichApparentSiderealTime.from_utc(utc)
  from_gst(gst: gast, longitude: longitude)
end

Instance Method Details

#to_gstAstronoby::GreenwichApparentSiderealTime

Converts to Greenwich Apparent 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_apparent_sidereal_time.rb', line 56

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

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