Sunrise, sunset, moonrise, and moonset
panchangam.rise-set
Swiss Ephemeris rise/transit searches produce local sky-marker instants.
Assurance
| Level | Current statement |
|---|---|
| Documented and traceable | Yes — the canonical record includes the process and a worked example. |
| Regression or reproduction checked | Linked to 4 repository test file(s). |
| Independently source-supported | Partial support only; read the provenance note and limitations before generalizing. |
Computation method
Method type: algorithm
Convert local civil midnight to UT Julian day and ask Swiss Ephemeris for the next Sun or Moon rise/set event using fixed observer and atmosphere parameters.
Process
- Localize 00:00 on the requested date in the IANA timezone and convert it to UTC Julian day.
- Call swe.rise_trans for Sun or Moon with CALC_RISE or CALC_SET.
- Use [longitude, latitude, 0 metres], pressure 1013.25 hPa, temperature 15 C, and Swiss default upper-limb/refraction behavior.
- Search sunset from sunrise and next sunrise from the following local midnight.
- Convert tret[0] to a whole-second UTC datetime.
Worked example
Hyderabad, 2026-06-11
Inputs
- Location: Hyderabad, Asia/Kolkata
- Altitude forced to 0 metres
- Swiss default rise/set flags and atmosphere
Calculation
- Search the next solar rise after local midnight, then solar set after that rise.
- Search the next lunar rise and set after local midnight.
Result
- Sunrise: 05:41:11 IST; sunset: 18:50:12 IST
- Moonrise: 01:55:18 IST; moonset: 14:53:44 IST
Method notes
- Swiss return codes are ignored; polar no-event cases are not represented safely.
- Decision 0005 retains the astronomical upper-limb/refraction solar convention; the Hindu disc-centre/no-refraction alternative was compared, not adopted.
Contract
Owning layer: engine-core
Claim kind: deterministic-fact
Time basis: Search from local-midnight Julian day with observer coordinates.
Inputs
- date
- latitude
- longitude
- fixed pressure 1013.25 hPa
- fixed temperature 15 C
- hard-coded altitude 0 m
Outputs
- UTC rise/set instants rendered in local timezone
References and evidence
Evidence classes: astronomical
Verification states: partially_verified
Decision 0005 retains the solar upper-limb/refraction default; four day pages across two cities agree within 35 seconds. Eight labeled Moon events expose a 231–381-second discrepancy; topocentric disc-centre/no-refraction agrees within 33 seconds but requires an owner-reviewed frozen-core correction.
panchangam.rise_set_convention
Evidence class: astronomical
Verification state: partially_verified
Locator: Swiss Ephemeris sections 8.12 and 8.12.1; Drik Panchang sunrise definition, upper-edge/refraction default and optional elevation; decision 0005; tests/fixtures/rise_set_convention_oracle.json and moon_rise_set_convention_oracle.json
Last reviewed: 2026-09-19
Scope: Retains the solar astronomical upper-limb/refraction default: four independently revisited day pages across Hyderabad and New York agree within 35 seconds. Eight labeled Moon events instead differ from the current default by 231–381 seconds; topocentric disc-centre/no-refraction agrees within 33 seconds, an empirical candidate awaiting owner-reviewed frozen-core correction. Moon day assignment and safe polar handling are not certified. Fixed pressure, temperature and zero-altitude behavior is unchanged.
Sources
- Swiss Ephemeris — Astrodienst; Swiss Ephemeris 2.10 Programmer's Documentation and pyswisseph runtime used by the repository; authority type:
astronomical_reference - Sunrise and Sunset definition in Hindu Calendar — Drik Panchang; Online definition, inspected 2026-09-19; authority type:
reference_provider_methodology - Drik Panchang day and festival pages — Drik Panchang; Location- and date-specific web pages; authority type:
published_panchangam
drik.sidereal_positions
Evidence class: astronomical
Verification state: partially_verified
Locator: Swiss Ephemeris Programmer's Documentation sections 3, 5.8 and 12.2 for calc_ut, sidereal flags and ayanamsa modes; representative date checks in tests/test_drik_engine.py and tests/test_ayanamsa.py
Last reviewed: 2026-08-27
Scope: Traces the Drik longitude API and preserves representative outputs. The current register does not contain an exhaustive independently published position-and-transition fixture, and it establishes no interpretive doctrine.
Sources
- Swiss Ephemeris — Astrodienst; Swiss Ephemeris 2.10 Programmer's Documentation and pyswisseph runtime used by the repository; authority type:
astronomical_reference - Drik Panchang day and festival pages — Drik Panchang; Location- and date-specific web pages; authority type:
published_panchangam
The complete machine-readable source registry is available in provenance.json. A regression fixture or same-code reproduction is not independent verification.
Reproduce and review
tests/test_utils.pytests/test_drik_engine.pytests/test_rise_set_convention.pytests/test_moon_rise_set_convention.py
Run the linked tests, then the complete offline contract:
python tools/verify_project.pyPublic surfaces
python-librarymcpicswebsite
Limitations
- All engines currently use the astronomical upper-limb/refraction default and ignore Location.alt and return codes. Lunar correction remains open under #177; the fixtures do not certify Moon day assignment or polar output safety.
Implementation
- owner:
telugu_panchangam/engines/utils.py—get_sunrise - owner:
telugu_panchangam/engines/utils.py—get_sunset - owner:
telugu_panchangam/engines/utils.py—get_moonrise - owner:
telugu_panchangam/engines/utils.py—get_moonset
This route is generated from computations.json. Edit the registry and canonical reference prose in the same pull request as a behavior change.