mix astro.build_ephemeris (Astro v2.5.0)

Copy Markdown View Source

Builds a compact ephemeris kernel from JPL's de440s.bsp.

The full DE440s kernel is ~31 MB because it carries every planetary barycenter over 1849–2150. Astro uses only the Sun, Moon and Earth, so this task extracts those segments over a chosen span of years and writes a much smaller DAF/SPK file. Over the default 1900–2100 window the result is about 8.4 MB.

Extraction is lossless: the original Chebyshev coefficients are copied verbatim, so results computed from the compact file are identical to those computed from the full kernel for any date it covers.

This task generates the ephemeris that ships with the library. Run it to regenerate that file, or to build one covering a different span.

Usage

$ mix astro.build_ephemeris

The full kernel is downloaded to a temporary file, subset, and then discarded. To subset a copy you already have, avoiding the download:

$ mix astro.build_ephemeris --source priv/de440s.bsp

To cover a different span of years:

$ mix astro.build_ephemeris --from 1900 --to 2200

Cost is roughly 42 KB per year of coverage. The window is widened to the enclosing Chebyshev record boundary, so the requested span is always fully covered.

Options

  • --source — path to an existing full kernel. Downloads one to a temporary file if omitted.

  • --dest — output path. Defaults to priv/de440s-astro.bsp.

  • --from — first year to cover. Defaults to 1950.

  • --to — last year to cover. Defaults to 2100.

  • --keep-earth — retain the Earth→EMB segment rather than reconstructing it at runtime. Roughly doubles the output size. See Astro.Ephemeris.Subset for why it is redundant.

  • --force — overwrite the output file without prompting.