Closed cceckman closed 1 week ago
Something is definitely wrong with the calculation, as there is a large discontinuity at the equinox. I think it is a quadrant issue with an arctan; this function is not well vetted. I will look.
I had checked it against, for example, : https://www.timeanddate.com/sun/usa/washington-dc
but only for a few locations and days.
Indeed the issue is a quadrant with arctan. I needed to do a quadrant-aware arctan when computing position of sun in the equatorial plane (rotating from ecliptic).
I did a cursory check of calculations using your code against: https://www.timeanddate.com/sun/usa/washington-dc
Results look accurate for spot checks that span 4 seasons and daylight savings.
A new version is published to crates.io
Agreed, at some spot checks the 0.3.14 version looks like it's doing the right thing. Thanks for the fix!
I'm in the US Eastern time zone, same as Washington, DC.
This gist contains:
satkit::lpephem::sun::riseset
The output shows the day lengthening up to the winter equinox, then abruptly shrinking:
Neither of these things match my experience of how sunrise and sunset actually behave. :)
First, for coordinates
39.0, -77.0
, the day length should decrease up to the equinox (December 20). Second, for any coordinates, rise and set times should be approximately the same day-to-day (unless there are discontinuities in civil time).Is there some sort of sign error here that is causing the northern-hemisphere day to lengthen as the winter equinox approaches?