Skip to content

Add solar eclipses (general circumstances) #283

Description

@rhannequin

Problem this feature will solve

Astronoby computes lunar eclipses but not solar eclipses, the gap next to the existing lunar support and the most commonly requested eclipse calculation.

Unlike a lunar eclipse, a solar eclipse is not a geocentric event: the Moon's shadow falls on a specific part of Earth, so it has two distinct sets of circumstances. General (global) circumstances describe the eclipse as a whole (type, time and location of greatest eclipse, gamma, magnitude, the instants the shadow first and last touches Earth). Local circumstances describe what a specific observer sees (contact times, local type, magnitude, obscuration, the Sun's altitude).

Desired solution

General (global) circumstances only. It mirrors the lunar eclipse design and reuses the direct ephemeris geometry already used by LunarEclipseCalculator. A solar eclipse is structurally the lunar calculator with the roles swapped (the Moon's shadow cones against the Earth, seeded at new moon instead of full moon).

Public API, mirroring Astronoby::Moon.eclipse_events:

eclipses = Astronoby::Sun.eclipse_events(
  ephem: ephem,
  start_time: Time.utc(2024, 1, 1),
  end_time: Time.utc(2025, 1, 1)
)

Returns Array<Astronoby::SolarEclipse>, sorted by time, for eclipses whose greatest instant falls in the range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions