Polar Regions
This content is for v1.0.0. Switch to the latest version for up-to-date documentation.
Polar Regions
Section titled “Polar Regions”Above the Arctic Circle (or below the Antarctic Circle), the sun may never rise or set for days or weeks. Al-Falak provides configurable strategies for these situations.
PolarCircleRule options
Section titled “PolarCircleRule options”| Rule | Behavior |
|---|---|
NEAREST_LATITUDE |
Compute at nearest latitude where sun rises/sets (default) |
NEAREST_DAY |
Use schedule from nearest date with normal sunrise/sunset |
MAKKAH |
Use Makkah’s schedule for the same date |
NONE |
Raise AstronomicalError (no fallback) |
Using a polar rule
Section titled “Using a polar rule”from alfalak import PrayerTimes, CalculationParameters, PolarCircleRule
params = CalculationParameters( polar_circle_rule=PolarCircleRule.NEAREST_LATITUDE,)prayer_times = PrayerTimes( (78.2232, 15.6267), # Longyearbyen, Svalbard datetime.now(), calculation_parameters=params,)NEAREST_LATITUDE (default)
Section titled “NEAREST_LATITUDE (default)”Aqrab al-Bilad: finds the nearest latitude (same longitude, same date) where the sun still rises and sets. This is the default behavior.
NEAREST_DAY
Section titled “NEAREST_DAY”Aqrab al-Ayyam: finds the nearest date (same location) with a normal sunrise/sunset schedule. Returned datetimes carry that date.
MAKKAH
Section titled “MAKKAH”Uses Makkah’s coordinates (21.4225°N, 39.8262°E) for the same date. Useful for consistency with the Haram schedule.
No fallback. Raises AstronomicalError when the sun never rises or sets:
from alfalak import PrayerTimes, CalculationParameters, PolarCircleRule, AstronomicalError
params = CalculationParameters(polar_circle_rule=PolarCircleRule.NONE)try: PrayerTimes((78.2232, 15.6267), datetime.now(), calculation_parameters=params)except AstronomicalError as e: print(f"Polar day/night: {e}")Important notes
Section titled “Important notes”- Estimates are approximations: near the polar boundary, adjacent markers can invert by minutes
- The
NEAREST_LATITUDEstrategy backs off 0.5° from the exact boundary to ensure a usable day/night split - All strategies preserve the original date in the returned datetimes (except
NEAREST_DAYwhich uses the nearest valid date)