spice.archived_kernels
spice.archived_kernels
SPICE kernels management for archived datasets.
To access subsets of datasets, wrap the NAIF server’s subsetds.pl script. The Perl script subsetds.pl (see BASE_URL below) requires as input: - the dataset name - start and stop of the time interval - a constant named “Subset” to identify the action for this Perl script We can assemble these parameters into a payload dictionary for the requests.get call and we manage different potential actions on the zipfile with a Subsetter class, that only requires the mission identifier, start and stop as parameters.
Classes
| Name | Description |
|---|---|
| Subsetter | Class to manage retrieving subset SPICE kernel lists. |
Subsetter
spice.archived_kernels.Subsetter(mission, start, stop=None, save_location=None)Class to manage retrieving subset SPICE kernel lists.
Attributes
| Name | Type | Description |
|---|---|---|
| kernel_names | list[str] | Names of kernels for the given time range. |
Notes
The following methods are available on this class:
download_kernels()– Download SPICE kernels.get_metakernel()– Get metakernel file from NAIF and adjust paths to match local storage.
Methods
| Name | Description |
|---|---|
| download_kernels | Download SPICE kernels. |
| get_local_path | Return local storage path from Kernel URL. |
| get_metakernel | Download metakernel file from NAIF, adapt paths to match local storage |
download_kernels
spice.archived_kernels.Subsetter.download_kernels(
overwrite=False,
non_blocking=False,
quiet=False,
)Download SPICE kernels.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| overwrite | bool | Overwrite existing kernels. Defaults to False. | False |
| non_blocking | bool | Use Dask client for parallel download. Defaults to False. | False |
| quiet | bool | Suppress name and path of downloaded kernels. Defaults to False. | False |
get_local_path
spice.archived_kernels.Subsetter.get_local_path(url)Return local storage path from Kernel URL.
Uses self.save_location if given.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| url | str | URL of the kernel file. | required |
get_metakernel
spice.archived_kernels.Subsetter.get_metakernel()Download metakernel file from NAIF, adapt paths to match local storage and return local path to metakernel file.
Uses self.save_location if given, otherwise planetarypy archive.
Functions
| Name | Description |
|---|---|
| download_one_url | Download a single URL to a local path. |
| get_metakernel_and_files | For a given mission and start/stop times, download the kernels and get metakernel path. |
| list_kernels_for_day | List all kernels for a given time range of a mission. |
download_one_url
spice.archived_kernels.download_one_url(url, local_path, overwrite=False)Download a single URL to a local path.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| url | str | URL to download | required |
| local_path | Path | Path where to save the file | required |
| overwrite | bool | Whether to overwrite existing files, by default False | False |
get_metakernel_and_files
spice.archived_kernels.get_metakernel_and_files(
mission,
start,
stop,
save_location=None,
quiet=False,
)For a given mission and start/stop times, download the kernels and get metakernel path.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| mission | str | Mission shorthand in datasets dataframe. | required |
| start | str | Start time in either ISO or yyyy-jjj format. | required |
| stop | str | Stop time in either ISO or yyyy-jjj format. | required |
| save_location | str | Overwrite default storing in planetarypy archive. Defaults to None. | None |
| quiet | bool | Suppress download feedback. Defaults to False. | False |
list_kernels_for_day
spice.archived_kernels.list_kernels_for_day(mission, start, stop='')List all kernels for a given time range of a mission.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| mission | str | Mission shorthand in datasets dataframe. | required |
| start | str | Start time in either ISO or yyyy-jjj format. | required |
| stop | str | Stop time in either ISO or yyyy-jjj format. Defaults to None. | '' |