Class: Astronoby::LocalApparentSiderealTime
- Inherits:
-
LocalSiderealTime
- Object
- SiderealTime
- LocalSiderealTime
- Astronoby::LocalApparentSiderealTime
- 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
Instance Attribute Summary
Attributes inherited from LocalSiderealTime
Attributes inherited from SiderealTime
Class Method Summary collapse
-
.from_gst(gst:, longitude:) ⇒ Astronoby::LocalApparentSiderealTime
Creates LAST from a Greenwich Apparent Sidereal Time and longitude.
-
.from_utc(utc, longitude:) ⇒ Astronoby::LocalApparentSiderealTime
Creates LAST from UTC and longitude.
Instance Method Summary collapse
-
#initialize(date:, time:, longitude:) ⇒ LocalApparentSiderealTime
constructor
A new instance of LocalApparentSiderealTime.
-
#to_gst ⇒ Astronoby::GreenwichApparentSiderealTime
Converts to Greenwich Apparent Sidereal Time.
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.
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)
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.
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_gst ⇒ Astronoby::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 |