Skip to content

NAIF Functions

Functions for downloading planetary DE, satellite ephemeris, and lunar-orientation kernels from NASA JPL's NAIF archive.

All functions are available via brahe.datasets.naif.<function_name>.

download_spice_kernel builtin

download_spice_kernel(name: str, output_path: str = None) -> str

Download a NAIF kernel with caching support

Downloads the named NAIF kernel file (planetary DE, satellite ephemeris, or binary PCK) from NASA JPL's NAIF archive and caches it locally. If the kernel is already cached, returns the cached path without re-downloading. Optionally copies the kernel to a user-specified location.

Parameters:

Name Type Description Default
name str

Kernel name. Supported: the planetary (DE) ephemerides "de430", "de432s", "de435", "de438", "de440", "de440s", "de442", "de442s"; the satellite ephemeris kernels "mar099", "mar099s", "jup365", "sat441", "ura184", "nep097", "plu060"; and the binary PCK "moon_pa_de440".

required
output_path str

Optional path to copy the kernel to after download/cache retrieval. If not specified, returns the cache location.

None

Returns:

Name Type Description
str str

Path to the kernel file (cache location or output_path if specified).

Raises:

Type Description
RuntimeError

If kernel name is unsupported, download fails, or file operations fail.

Example
1
2
3
4
5
6
7
8
9
import brahe as bh

# Download and cache de440s kernel
kernel_path = bh.datasets.naif.download_spice_kernel("de440s")
print(f"Kernel cached at: {kernel_path}")

# Download and copy to specific location
kernel_path = bh.datasets.naif.download_spice_kernel("de440s", "/path/to/my_kernel.bsp")
print(f"Kernel saved to: {kernel_path}")
Note
  • DE kernels are long-term stable products and are not refreshed once cached
  • Files are cached to ~/.cache/brahe/naif/ (or $BRAHE_CACHE/naif/ if set)
  • Kernel files vary in size (de440s: ~33 MB, de440: ~120 MB)
  • Available at: https://naif.jpl.nasa.gov/pub/naif/generic_kernels/

See Also