Repository navigation
NOAACalculator, MeeusCalculator: don't miss zmanim the sun only just reaches - #295
Merged
KosherJava merged 1 commit intoOct 22, 2026
Merged
Conversation
dickermoshe
force-pushed
the
meeus-noaa-rise-set-fallback
branch
from
October 22, 2026 03:26
481e6d7 to
7d5dfb0
Compare
dickermoshe
force-pushed
the
meeus-noaa-rise-set-fallback
branch
from
October 22, 2026 03:27
7d5dfb0 to
b69f97e
Compare
…g no event The first pass uses the solar declination at noon. The declination moves up to about 0.2 degrees in half a day, so on days when the Sun only just reaches the zenith near midnight, noon's declination puts it out of reach and the calculation returned NaN. When the first pass finds the zenith out of reach, it is now retried with the declination and equation of time at the solar midnight next to the event before giving up. Every other result is unchanged.
dickermoshe
force-pushed
the
meeus-noaa-rise-set-fallback
branch
from
October 22, 2026 03:33
b69f97e to
ac7b4fb
Compare
dickermoshe
marked this pull request as ready for review
October 22, 2026 03:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On some days the sun only just reaches an angle like 16.1° or 18° below the horizon, right around midnight.
NOAACalculatorandMeeusCalculatorreturn no zman (NaN) on those days, even though the zman exists.Why
Both calculators start from the sun's declination at noon. If the angle is out of reach at that declination, they stop and return NaN. But the declination changes during the day, by up to about 0.2° in 12 hours. So near the start and end of the season when a zman stops existing, the sun can reach the angle around midnight even though noon's figures say it can't.
Examples (UTC):
This isn't a polar edge case. For London, Manchester, Edinburgh, Copenhagen, Stockholm, Toronto and Montreal, every day from 2024 to 2030, at alos/tzais angles from 16.1° to 26°, each calculator was missing 234 zmanim. It's a few days every year, on the same dates.
Change
When the first pass finds the angle out of reach, it now tries once more using the sun's declination at the solar midnight next to the event. That's the night before for sunrise and the night after for sunset, when the sun is lowest. If the angle is reachable there, the existing passes continue as usual. Nothing else changes.
Testing
I checked results against an independent search that steps through the half day minute by minute, using each calculator's own sun-position model:
NOAACalculatorTestandMeeusCalculatorTesteach get a test covering the three examples above.Not covered
SPACalculatorTesttests since 7cab372. This PR doesn't touch SPA.