Solar eclipses anywhere on Earth, with central lines
Almanac 0.5.0
Release Sky
Almanac 0.5.0 adds solar eclipses anywhere on Earth, and the central line of each total or annular eclipse, in TypeScript and Swift.
nextGlobalSolarEclipse(after:)/nextGlobalSolarEclipse(after),previousGlobalSolarEclipse(before:)/previousGlobalSolarEclipse(before), andglobalSolarEclipses(from:to:)/globalSolarEclipses(from, to)find solar eclipses with no observer. Each result carries the time of greatest eclipse, the shadow axis's distance from the Earth's center, and where the axis meets the ground, with the kind (partial, annular, or total) and obscuration seen from there. When the axis misses the Earth, the eclipse is partial, with no ground point.solarEclipseAxisPoint(at:)/solarEclipseAxisPoint(time)gives where the shadow axis meets the ground at any instant, or nothing when it misses.solarEclipseCentralLine(peak:stepSeconds:)/solarEclipseCentralLine(peak, stepSeconds)traces the central line from where the axis first touches the Earth to where it leaves. Interior points fall on whole multiples of the step since the Unix epoch, which defaults to 60 seconds, so a line at a step that is a whole multiple of another samples a subset of its instants.- The shared performance harness gains five global workloads.
benchmarks/run.mjs --skip '^global/'leaves them out when the comparison base predates 0.5.0.
The global search finds all 337 solar eclipses from 1950 through 2100 in the Espenak Five Millennium Catalog, with no extras, and every kind matches. The central line is checked against NASA's path tables for six central eclipses, at the same dynamical time:
| Quantity | Worst residual | Tolerance |
|---|---|---|
| Greatest eclipse, 337 eclipses | 8.2 s | 60 s |
| Axis distance against catalog gamma | 4.1 km | 5 km |
| Ground point, 202 eclipses with the axis under 6,100 km | 0.66° | 1° |
| Central line against NASA path tables | 3.1 km, 4.9 s | 5 km, 60 s |
| Central line of the grazing 2044-08-23 eclipse | 9.4 km, 8.1 s | 15 km, 60 s |
| Annular obscuration against the diameter ratio squared | 0.0010 | 0.002 |
| Local search at 953 central-line points: peak | 0.40 s | 2 s |
The hosted CI comparison measured these median query times, in milliseconds:
| Workload | TypeScript | Swift |
|---|---|---|
| Next global solar eclipse | 0.22 | 0.16 |
| Previous global solar eclipse | 0.18 | 0.12 |
| Global solar eclipses / 228 hours, no new moon | 0.006 | 0.005 |
| Global solar eclipses / 1950–2100 | 149 | 111 |
| Central line of 2024-04-08, 60 s step | 1.3 | 1.0 |
Both revisions used the same harness and toolchain within each port, with seven interleaved process pairs and 300 ms warmup. No existing workload moved by more than 2.6% in either port. Validation includes 174 TypeScript tests, 133 Swift release tests, and the shared fixture and parity checks.
npm install @openwaters/almanac@0.5.0
.package(url: "https://github.com/openwatersio/almanac.git", exact: "0.5.0")
Global solar eclipses: #39, #40, #42. Development and toolchain: #36. Dependency updates: #37.