Expand description
Native Rust port of stem-branch’s solar ephemeris core.
Computes the Sun’s geocentric ecliptic state from the full VSOP87D Earth series plus a JPL DE441-fitted correction polynomial and IAU2000B nutation. Input is a Julian Ephemeris Day in Terrestrial Time (JDE/TT); the UTC<->TT / ΔT boundary is the caller’s responsibility.
This is a faithful translation of the TypeScript solarEclipticState; the
VSOP87D and IAU2000B coefficient tables are generated from the same source
by scripts/gen-rust-solar-data.mjs.
Structs§
- Civil
Date - A Gregorian civil date in Beijing time.
- Lunar
Month - One month of a lunisolar year: its number, leap flag, Gregorian start date (正月初一 etc., Beijing), and length in days (29 or 30).
- Lunisolar
Date - A Chinese lunisolar date.
- Moon
Phase - Illumination geometry of the Moon at a Julian Ephemeris Day (TT), from the Moon’s and Sun’s geocentric positions (ELP/MPP02 + VSOP87D). Computed per Meeus, Astronomical Algorithms 2e, chapter 48 — using the true geocentric elongation (including the Moon’s ecliptic latitude) and the Sun/Moon distances, not a longitude-only approximation.
- Moon
State - Apparent geocentric position of the Moon at a Julian Ephemeris Day (TT): ELP/MPP02 geometric place, precessed to the ecliptic of date and corrected for nutation in longitude, then resolved to equatorial coordinates.
- Solar
State - Geocentric solar ecliptic state at a Julian Ephemeris Day (TT).
Constants§
- EARTHLY_
BRANCHES - The twelve Earthly Branches (地支), index 0 = 子.
- HEAVENLY_
STEMS - The ten Heavenly Stems (天干), index 0 = 甲.
- SOLAR_
TERM_ LONGITUDES - Apparent ecliptic longitude (degrees) for each term; index 0 = 小寒 at 285°.
- SOLAR_
TERM_ NAMES - Traditional-Chinese names of the 24 solar terms, index-aligned with
SOLAR_TERM_LONGITUDES(index 0 = 小寒 @ 285°). Ported verbatim from the TypeScriptSOLAR_TERM_NAMES(src/solar-terms.ts).
Functions§
- delta_
t_ for_ year - ΔT in seconds for a decimal year (TT = UT + ΔT).
- find_
new_ moons_ in_ range - All new-moon JDEs (TT) within the Julian-Day range
[start_jd, end_jd]. - find_
solar_ term_ moment - Find the JD(UT) of the solar term at
target_longitudeinyear, searching from the first ofstart_month. ReturnsNoneif not found in 120 days. - gregorian_
to_ lunisolar - Convert a Gregorian (Beijing) civil date to its Chinese lunisolar date.
- gregorian_
to_ lunisolar_ with - As
gregorian_to_lunisolar, with a caller-supplied ΔT model (decimal year → seconds) — e.g. to match an authority’s calendar at a ΔT-uncertain far-future boundary. Bypasses the per-year cache. - jd_
from_ ymd - Julian Day at 00:00 UT of the given Gregorian calendar date.
- lunar_
months_ for_ year - Lunar months for the lunisolar year whose 正月 falls in
lunar_year— 12 months, or 13 in a leap year. - lunar_
new_ year - The Lunar New Year (正月初一) Gregorian date for
gregorian_year. - moon_
phase - Compute the Moon’s phase geometry (elongation, phase angle, illuminated fraction) at the given Julian Ephemeris Day in Terrestrial Time.
- moon_
position - Compute the Moon’s apparent geocentric position at the given Julian Ephemeris Day in Terrestrial Time.
- new_
moon_ jde - JDE (TT) of the true new moon (定朔) for integer lunation
k: the Meeus Ch.49 estimate refined to the exact Sun–Moon apparent-longitude conjunction using the ELP/MPP02 Moon and VSOP87D + DE441 Sun. Sub-arcsecond — far tighter than Meeus alone (~1 minute), which is what fixes the rare near-midnight calendar boundary where a coarser instant could land on the wrong day. - solar_
ecliptic_ state - Compute the Sun’s geocentric ecliptic state at the given Julian Ephemeris Day in Terrestrial Time.
- solar_
term_ for_ longitude - The solar term in effect at apparent ecliptic longitude
deg— the term whose longitude is the greatest one at or beforedeg(circular). Terms sit every 15° starting fromSOLAR_TERM_LONGITUDES[0](小寒, 285°). Inputs are normalized, so negative or>360longitudes are accepted. - ymd_
from_ jd - Gregorian (year, month, day) of the civil day that contains instant
jd, using the midnight (.5) day boundary.