diff --git a/spec/astronoby/bodies/moon_spec.rb b/spec/astronoby/bodies/moon_spec.rb index 2ec9ead..d169719 100644 --- a/spec/astronoby/bodies/moon_spec.rb +++ b/spec/astronoby/bodies/moon_spec.rb @@ -222,15 +222,6 @@ end describe "#horizontal_coordinates" do - # TODO: moon.distance is given, check what value should be given to get the - # most accurate results: - # - distance between the observer and the Moon center - # - distance between the Earth and the Moon centers - - # TODO: Rename "apparent" methods from Moon because the Moon will only deal - # with apparent and not standard epoch. - # This might change in the future if we implement ICRS. - it "returns the apparent ecliptic coordinates for 2015-01-01" do time = Time.utc(2015, 1, 2) observer = Astronoby::Observer.new( @@ -248,5 +239,51 @@ expect(horizontal_coordinates.altitude.str(:dms)).to eq "+48° 1′ 21.8373″" # Result from IMCCE: +48° 1′ 21″ end + + # Source: + # Title: Celestial Calculations + # Author: J. L. Lawrence + # Edition: MIT Press + # Chapter: 7 - The Moon, p.185 + it "returns the horizon coordinates for 2000-08-09" do + observer = Astronoby::Observer.new( + latitude: Astronoby::Angle.from_degrees(30), + longitude: Astronoby::Angle.from_degrees(-95) + ) + moon = described_class.new(time: Time.new(2000, 8, 9, 12, 0, 0, "-05:00")) + + coordinates = moon.horizontal_coordinates(observer: observer) + + expect(coordinates.altitude.str(:dms)).to eq "-51° 19′ 13.9407″" + # Result from the book: -50° 44′ + # Result from IMCCE: -51° 19′ 22.44″ + + expect(coordinates.azimuth.str(:dms)).to eq "+84° 40′ 12.0274″" + # Result from the book: +84° 56′ + # Result from IMCCE: +84° 40′ 5.52″ + end + + # Source: + # Title: Celestial Calculations + # Author: J. L. Lawrence + # Edition: MIT Press + # Chapter: 7 - The Moon, p.185 + it "returns the apparent ecliptic coordinates for 2010-05-15" do + observer = Astronoby::Observer.new( + latitude: Astronoby::Angle.from_degrees(-20), + longitude: Astronoby::Angle.from_degrees(-30) + ) + moon = described_class.new(time: Time.new(2010, 5, 15, 14, 30, 0, "-04:00")) + + coordinates = moon.horizontal_coordinates(observer: observer) + + expect(coordinates.altitude.str(:dms)).to eq "+25° 52′ 49.8989″" + # Result from the book: 26° 32′ + # Result from IMCCE: 25° 52′ 40.8″ + + expect(coordinates.azimuth.str(:dms)).to eq "+313° 26′ 5.3866″" + # Result from the book: +313° 24′ + # Result from IMCCE: +313° 25′ 58.08″ + end end end