Skip to main content

Crate stem_branch

Crate stem_branch 

Source
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§

CivilDate
A Gregorian civil date in Beijing time.
LunarMonth
One month of a lunisolar year: its number, leap flag, Gregorian start date (正月初一 etc., Beijing), and length in days (29 or 30).
LunisolarDate
A Chinese lunisolar date.
MoonState
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.
SolarState
Geocentric solar ecliptic state at a Julian Ephemeris Day (TT).

Constants§

SOLAR_TERM_LONGITUDES
Apparent ecliptic longitude (degrees) for each term; index 0 = 小寒 at 285°.

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_longitude in year, searching from the first of start_month. Returns None if not found in 120 days.
gregorian_to_lunisolar
Convert a Gregorian (Beijing) civil date to its Chinese lunisolar date.
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_position
Compute the Moon’s apparent geocentric position at the given Julian Ephemeris Day in Terrestrial Time.
new_moon_jde
JDE (TT) of the new moon for integer lunation number k.
solar_ecliptic_state
Compute the Sun’s geocentric ecliptic state at the given Julian Ephemeris Day in Terrestrial Time.
ymd_from_jd
Gregorian (year, month, day) of the civil day that contains instant jd, using the midnight (.5) day boundary.