pint.solar_system_ephemerides.load_kernel

pint.solar_system_ephemerides.load_kernel(ephem: str, path: str | Path | None = None, link: str | None = None) str | Path | bool[source]

Load the solar system ephemeris

Ephemeris files may be obtained through astropy’s internal collection (which primarily downloads them from the network but caches them in a user-wide cache directory), from an additional network location via the astropy mechanism, or from a file on the local system. If the ephemeris cannot be found a ValueError is raised.

If a kernel must be obtained from the network, it is first looked for in the location specified by link, then in a list of mirrors of the JPL ephemeris collection.

If the ephemeris must be downloaded, it is downloaded using astropy.utils.data.download_file(); it is thus stored in the Astropy cache <https://docs.astropy.org/en/stable/utils/data.html>.

Parameters:
  • ephem (str) – Short name of the ephemeris, for example de421. Case-insensitive.

  • path (str or pathlib.Path, optional) – Load the ephemeris from the file specified in path, rather than requesting it from the network or astropy’s collection of ephemerides. The file is searched for by treating path as relative to the current directory, or failing that, as relative to the data directory specified in PINT’s configuration.

  • link (str, optional) – Suggest the URL as a possible location astropy should search for the ephemeris.

Returns:

loaded_ephemeris – Can be str or pathlib.Path if loaded from a local file, or True if loaded from URL

Return type:

str or pathlib.Path or bool

Note

If both path and link are provided, local path will be tried first.

If path is not provided, will still search default mirror sites.

Any local loaded ephemeris will be stored so it will not be re-requested.