-
-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Not able to find the sunSet time for 10/17/2024 - with a sunAltitude of .astronomical
To verify this, I created a loop where I called earth.twilights() repeatedly incrementing the JulianTime by 1 hour each iteration - and it never returns a sunSet time for 10/17/2024.
This only seems to occur with a sunAltitude of .astronomical. Weird.
Here are the results where it transitions from returning valid riset/set times for 10/16 - and then immediately jumps to 10/18
setRiseTransitTimes for: 10/17 at: 6:00 PM
sunRise = 10/17 at: 5:56 AM
sunSet = 10/16 at: 8:00 PM
transitTime = 10/17 at: 12:58 PM
transitError = None
setRiseTransitTimes for: 10/17 at: 7:00 PM
sunRise = 10/17 at: 5:56 AM
sunSet = 10/16 at: 8:00 PM
transitTime = 10/17 at: 12:58 PM
transitError = None
setRiseTransitTimes for: 10/17 at: 8:00 PM
sunRise = 10/18 at: 5:57 AM
sunSet = 10/18 at: 7:58 PM
transitTime = 10/18 at: 12:58 PM
transitError = None
setRiseTransitTimes for: 10/17 at: 9:00 PM
sunRise = 10/18 at: 5:57 AM
sunSet = 10/18 at: 7:58 PM
transitTime = 10/18 at: 12:58 PM
transitError = None
And here is the code snippit I am using to test this - nothing too complicated:
Note: computedTargetDay is set to 12:00 PM UTC-4 (Noon EST) on 10/17/2024
stepTime = computedTargetDay.addingTimeInterval(TimeConstants.secsInDay * -2)
endTime = stepTime.addingTimeInterval(TimeConstants.secsInDay * 4)
print("===== \(computedTargetDay.astroTime)")
while stepTime < endTime {
let earth = Earth(julianDay: JulianDay(stepTime))
let twilights = earth.twilights(forSunAltitude: twilightAltitude.rawValue, coordinates: geographic)
print("setRiseTransitTimes for: \(stepTime.astroTime)")
print("sunRise = \(twilights.riseTime?.date.astroTime ?? "")")
print("sunSet = \(twilights.setTime?.date.astroTime ?? "")")
print("transitTime = \(twilights.transitTime?.date.astroTime ?? "")")
print("transitError = \(twilights.transitError?.localizedDescription ?? "None")")
sunTimes.append(twilights)
stepTime = stepTime.addingTimeInterval(TimeConstants.secsInHour * 1)
}
Metadata
Metadata
Assignees
Labels
No labels