SPICE download CLI#

In order to simply the kernel management, the planetary-coverage provides 2 command line interface (CLI):

  • kernel-download to download one or more kernels from a SPICE registry.

  • mk-download to download all the missing kernels listed in a metakernel.

These two commands are available in Jupyter notebooks or directly in your terminal.

Kernel download CLI#


Remove the ! symbol to run this command in your terminal. But keep it if you run this cell into a Jupyter notebook.

!kernel-download --help
usage: kernel-download [-h] [-r REMOTE] [--nasa MISSION] [--esa MISSION]
                       [--jaxa MISSION] [-o KERNELS_DIR] [-f] [-s]
                       [kernel ...]

Planetary-coverage kernel downloader.

positional arguments:
  kernel                One or multiple kernel file(s).

optional arguments:
  -h, --help            show this help message and exit
  -r REMOTE, --remote REMOTE
                        Kernel remote location (HTTPS/FTP). Some shortcuts are
  --nasa MISSION        NASA mission (hosted on NAIF website).
  --esa MISSION         ESA mission (hosted on ESAC website).
  --jaxa MISSION        JAXA mission (hosted on ISAS website).
  -o KERNELS_DIR, --kernels-dir KERNELS_DIR
                        Output kernel directory.
  -f, --force           Overwrite the file if they are already present
  -s, --skip            Skip existing files.

For example, to download the leapseconds kernel from NAIF generic kernels you can do:

!kernel-download lsk/naif0012.tls
[Download] https://naif.jpl.nasa.gov/pub/naif/generic_kernels/lsk/naif0012.tls

You can provide a specific mission name to select an other SPICE registry:


You can list more than one kernel.

!kernel-download --esa JUICE mk/juice_crema_3_0.tm mk/juice_crema_5_0.tm
[Download] https://spiftp.esac.esa.int/data/SPICE/JUICE/kernels/mk/juice_crema_3_0.tm
>>> ERROR: kernel not found.

If you don’t provide any kernel, you will get the URL of the SPICE registry:

!kernel-download --esa JUICE

Metakernel download CLI#

!mk-download --help
usage: mk-download [-h] [-r REMOTE] [-o KERNELS_DIR] mk

Planetary-coverage metakernel downloader

positional arguments:
  mk                    Metakernel file.

optional arguments:
  -h, --help            show this help message and exit
  -r REMOTE, --remote REMOTE
                        Kernel remote location (HTTPS/FTP). By default, if a
                        remote is provided in the metakernel, text header,
                        this remote will be used
  -o KERNELS_DIR, --kernels-dir KERNELS_DIR
                        Override the $KERNELS variable in the metakernel in
                        order to choose where your kernels will be stored.

If you already have a metakernel, you can download all its missing kernels that are not present locally. Here we will use a simple metakernel:

!cat metakernel.tm

Dummy meta kernel

   The kernels listed below can be obtained from NAIF generic kernels:



      PATH_VALUES       = ( '.'  )

      PATH_SYMBOLS      = ( 'KERNELS' )

      KERNELS_TO_LOAD   = (




End of the File

We can see that the default SPICE registry is described in the file header (https://naif.jpl.nasa.gov/pub/naif/generic_kernels/) so we don’t need to specify an explicit --remote endpoint. However, we would like to store the kernels into a kernels/ folder and not in the default . location so we will add a --kernels-dir parameter:

!mk-download --kernels-dir kernels metakernel.tm
[Download] https://naif.jpl.nasa.gov/pub/naif/generic_kernels//lsk/naif0012.tls
[Download] https://naif.jpl.nasa.gov/pub/naif/generic_kernels//pck/pck00010.tpc

As you can see the files were correctly downloaded:

!ls kernels/*/*
kernels/lsk/naif0012.tls  kernels/pck/pck00010.tpc