Skip to content

Bug in Moon rise/set/transit #104

@treaves

Description

@treaves

Using the code below, and comparing the output to three different sources, shows SwiftAA is off on the set by more than 60 minutes. No two sources agree completely, but, are 'close'.

import Foundation
import SwiftAA

var cleveland                 = GeographicCoordinates(positivelyWestwardLongitude: Degree(.plus, 81, 40, 52.6440),
                                                      latitude: Degree(.plus, 41, 30, 19.7748),
                                                      altitude: Meter(30))
let timeOffset                = TimeInterval(TimeZone.current.secondsFromGMT())
let date                      = Date(timeIntervalSinceReferenceDate: 632667424.846199) // 2021-01-18 17:57:04 +0000

let earth                     = Earth(julianDay: JulianDay(date))

let moon                      = Moon(julianDay: JulianDay(date))
let times                     = moon.riseTransitSetTimes(for: cleveland)
let riseDate                  = times.riseTime?.date.addingTimeInterval(timeOffset)
let transitDate               = times.transitTime?.date.addingTimeInterval(timeOffset)
let setDate                   = times.setTime?.date.addingTimeInterval(timeOffset)

print("====> date:\(date) timeOffset:\(timeOffset)")
print("====> rise:\(String(describing: riseDate))") // Should be around 11:09:44
print("====> trasnit:\(String(describing: transitDate))") // Should be around 17:10:09
print("====> set:\(String(describing: setDate))") // Should be around 11:19:45

SwiftAA shows:

====> date:2021-01-18 12:57:04 +0000 timeOffset:-18000.0
====> rise:Optional(2021-01-18 11:07:44 +0000)
====> trasnit:Optional(2021-01-18 17:07:14 +0000)
====> set:Optional(2021-01-17 22:15:14 +0000)

AstroApp 1 shows:
11:37/17:52/23:16

AstroApp2 shows:
11:33/---/23:22

Py library shows:
11:09/17:10/23:19

Some of these numbers are off due to the locational accuracy. But the set time being off so much is a defect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions