cli
cli
PlanetaryPy unified CLI.
Usage: plp fetch mro.ctx.edr P02_001916_2221_XI_42N027W plp hifetch PSP_003092_0985 –browse plp ctxqv J05_046771_1950 plp catalog build
Functions
| Name | Description |
|---|---|
| catalog_ambiguous | List instruments whose mission/instrument mapping is ambiguous. |
| catalog_build | Build the PDS catalog database from pdr-tests definitions. |
| catalog_list | Browse the pdr-tests catalog inventory. |
| catalog_samples | Print the sample products in the catalog DB for a product type. |
| catalog_search | Search the catalog (mission/instrument/product_key/product_id). |
| catalog_show | Show full catalog + INDEX_REGISTRY info for a single product type. |
| catalog_summary | Per-mission counts of instruments, product types, and products. |
| constants_cmd | Print per-body planetary constants from PCK + NSSDC sources. |
| ctx_migrate | Move existing CTX files on disk to match current [edr.local] layout. |
| ctxqv | Show a downsampled quickview of a CTX image. |
| example_pid | Print an example product ID from a registered PDS index. |
| fetch | Download a PDS product by ID. |
| hibrowse | Download a HiRISE browse JPEG from EXTRAS. |
| hiedr | Download HiRISE EDR channel files by observation ID. |
| himos | Create a HiRISE CCD mosaic from EDR data via ISIS. |
| indexes_info | Show config + cache status for a registered PDS index. |
| indexes_list | Browse the registered PDS indexes (the operational fetch surface). |
| indexes_peek | Inspect a registered PDS index: shape, column names, a few random rows. |
| indexes_refresh | Refresh upstream index config or re-download a single index. |
| meta | Print the metadata row for a product from its PDS cumulative index. |
| pd_isna | Lazy-import-friendly NaN check for the peek command. |
| spice_cached | Show every SPICE kernel currently cached under storage_root. |
| spice_fetch | Download a date-scoped subset of a mission’s SPICE kernels. |
| spice_generic | Fetch one generic SPICE kernel by short alias. |
| spice_info | Show date range + archive metadata for one mission. |
| spice_missions | List every mission archive NAIF publishes (~39 entries). |
| spicer | Show current SPICE data for a solar system body. |
catalog_ambiguous
cli.catalog_ambiguous()List instruments whose mission/instrument mapping is ambiguous.
catalog_build
cli.catalog_build(
force=typer.Option(False, '--force', help='Force rebuild from scratch'),
validate_urls=typer.Option(False, '--validate-urls', help='Run URL validation after build'),
)Build the PDS catalog database from pdr-tests definitions.
catalog_list
cli.catalog_list(
key=typer.Argument(None, help="Optional dotted key: 'mission' or 'mission.instrument'. Omit to list missions."),
)Browse the pdr-tests catalog inventory.
Examples: plp catalog list # all missions plp catalog list cassini # cassini instruments plp catalog list cassini.iss # cassini.iss product types
catalog_samples
cli.catalog_samples(
key=typer.Argument(..., help="Dotted catalog key 'mission.instrument.product_key'."),
phase=typer.Option(None, '--phase', help="Filter to one mission phase (e.g. 'saturn', 'cruise')."),
limit=typer.Option(20, '--limit', '-n', help='Cap rows printed (use 0 for all).'),
)Print the sample products in the catalog DB for a product type.
Wraps planetarypy.catalog.example_products(). Useful to inspect what’s actually catalogued for a given product type, especially for archives without a registered fetch resolver where these samples are the only available products.
catalog_search
cli.catalog_search(
query=typer.Argument(..., help='Substring to search across catalog fields.'),
)Search the catalog (mission/instrument/product_key/product_id).
catalog_show
cli.catalog_show(
key=typer.Argument(..., help="Dotted key 'mission.instrument.product_key' for full detail."),
)Show full catalog + INDEX_REGISTRY info for a single product type.
catalog_summary
cli.catalog_summary()Per-mission counts of instruments, product types, and products.
constants_cmd
cli.constants_cmd(
ctx,
query=typer.Argument(None, help="Body name (case-insensitive) for the full quantity table, or 'Body.field' for one value. Examples: 'Mars', 'mars.GM', 'jupiter.bond_albedo'.", autocompletion=_complete_constants_query),
at=typer.Option(None, '--at', '-t', help='Time-travel: show the value as of this date (YYYY, YYYY-MM, or YYYY-MM-DD). Walks PCK editions + NSSDC capture history.'),
)Print per-body planetary constants from PCK + NSSDC sources.
Two forms:
plp constants Mars # Rich table of every known constant plp constants Mars.GM # Just the value (stdout) + source (stderr)
For the single-field form, the quantity is printed to stdout and the source/reference goes to stderr, so output stays pipe-safe::
plp constants Mars.GM | awk ‘{print $1}’
Body name matching is case-insensitive (mars == Mars == MARS). Unknown bodies print the closest matches as a suggestion.
ctx_migrate
cli.ctx_migrate(
dry_run=typer.Option(False, '--dry-run', '-n', help='Show what would be moved without touching anything'),
)Move existing CTX files on disk to match current [edr.local] layout.
Scans each mrox_* volume folder under the configured EDR local root and relocates any file named <pid>.<ext> (26-char CTX product_id) to the location that the active config dictates. Idempotent: a second run does nothing.
Typical use: after switching [edr.local].with_pid between false and true, run this once to bring existing downloads (and any co-located derived files) into the new layout.
ctxqv
cli.ctxqv(
ctx,
imgid=typer.Argument(None, help='CTX product ID (short or full), e.g. J05_046771_1950', autocompletion=_complete_ctx_pid),
stride=typer.Option(10, '--stride', '-s', help='Downsample factor'),
save=typer.Option(None, '--save', '-o', help='Save to PNG instead of displaying'),
stretch=typer.Option('1,99', '--stretch', '-p', help="Percentile stretch as 'low,high'. Use 'none' to disable."),
edr=typer.Option(False, '--edr', help='Force raw EDR, skip calibrated files'),
center_box=typer.Option(None, '--center-box', '-c', help='Show full-res center crop of N pixels (default 500 if flag used)'),
)Show a downsampled quickview of a CTX image.
Automatically uses the best available level: map-projected > calibrated > cube > raw EDR.
Use –center-box to also show a full-resolution crop from the image center.
example_pid
cli.example_pid(
ctx,
key=typer.Argument(None, help='Dotted index key, e.g. mro.ctx.edr', autocompletion=_complete_index_key),
)Print an example product ID from a registered PDS index.
Useful as a seed for plp fetch, demo notebooks, and smoke tests.
Examples: plp example_pid mro.ctx.edr plp example_pid cassini.iss.index
fetch
cli.fetch(
ctx,
key=typer.Argument(None, help='Dotted product key, e.g. mro.ctx.edr'),
product_id=typer.Argument(None, help='Product identifier', autocompletion=_complete_product_id),
force=typer.Option(False, '--force', '-f', help='Re-download even if cached'),
label_only=typer.Option(False, '--label-only', '-l', help='Download only the label file'),
here=typer.Option(False, '--here', '-H', help='Download into current directory instead of planetarypy storage'),
folder=typer.Option(False, '--folder', '-d', help='Print the local folder instead of file paths (composes with `cd`)'),
)Download a PDS product by ID.
Examples: plp fetch mro.ctx.edr P02_001916_2221_XI_42N027W plp fetch –here mro.ctx.edr P02_001916_2221_XI_42N027W cd (plp fetch –folder mro.ctx.edr P02_001916_2221_XI_42N027W)
hibrowse
cli.hibrowse(
ctx,
product_id=typer.Argument(None, help='HiRISE product ID, e.g. PSP_003092_0985_RED or PSP_004238_1135_RED1_1', autocompletion=_complete_hirise_obsid_rdr),
annotated=typer.Option(True, '--annotated/--clean', '-a/-c', help='Annotated (default) or clean browse'),
here=typer.Option(False, '--here', '-H', help='Download into current directory'),
force=typer.Option(False, '--force', '-f', help='Re-download even if cached'),
)Download a HiRISE browse JPEG from EXTRAS.
Bare observation IDs default to RDR RED browse.
Examples: plp hibrowse PSP_003092_0985_RED (annotated browse) plp hibrowse –clean PSP_003092_0985_RED (clean browse) plp hibrowse ESP_075422_2040_COLOR plp hibrowse PSP_004238_1135_RED1_1 (EDR CCD) plp hibrowse PSP_003092_0985 (defaults to RDR RED)
hiedr
cli.hiedr(
ctx,
obsid=typer.Argument(None, help='HiRISE observation ID, e.g. PSP_003092_0985', autocompletion=_complete_hirise_obsid_edr),
red=typer.Option(False, '--red', help='Download RED CCDs (RED0–RED9, 20 files)'),
ir=typer.Option(False, '--ir', help='Download IR CCDs (IR10–IR11, 4 files)'),
bg=typer.Option(False, '--bg', help='Download BG CCDs (BG12–BG13, 4 files)'),
ccds=typer.Option(None, '--ccds', help="Specific CCD numbers, e.g. '4,5' for RED4+RED5 only"),
here=typer.Option(False, '--here', '-H', help='Download into current directory'),
force=typer.Option(False, '--force', '-f', help='Re-download even if cached'),
)Download HiRISE EDR channel files by observation ID.
Downloads both channels (0 and 1) for each CCD in the selected color. If no color flag is given, defaults to –red.
Examples: plp hiedr PSP_003092_0985 –red (all 20 RED files) plp hiedr PSP_003092_0985 –red –ccds 4,5 (RED4+RED5 only, 4 files) plp hiedr PSP_003092_0985 –ir (IR10+IR11, 4 files) plp hiedr PSP_003092_0985 –bg (BG12+BG13, 4 files) plp hiedr PSP_003092_0985 –here –ccds 4,5 (download to current dir)
himos
cli.himos(
ctx,
obsid=typer.Argument(None, help='HiRISE observation ID, e.g. PSP_003092_0985', autocompletion=_complete_hirise_obsid_edr),
red=typer.Option(False, '--red', help='Process RED CCDs'),
ir=typer.Option(False, '--ir', help='Process IR CCDs'),
bg=typer.Option(False, '--bg', help='Process BG CCDs'),
ccds=typer.Option(None, '--ccds', help="Specific CCD numbers, e.g. '4,5'"),
mapfile=typer.Option(None, '--map', '-m', help='ISIS map projection file (.map)'),
overwrite=typer.Option(False, '--force', '-f', help='Reprocess even if mosaic exists'),
)Create a HiRISE CCD mosaic from EDR data via ISIS.
Full pipeline: download → hi2isis → spiceinit → hical → histitch → cubenorm → cam2map → equalizer → automos.
If no color flag is given, defaults to –red.
Examples: plp himos PSP_003092_0985 (all 10 RED CCDs) plp himos PSP_003092_0985 –ccds 4,5 (RED4+RED5 central pair) plp himos PSP_003092_0985 –ir (IR mosaic) plp himos PSP_003092_0985 –red –ir –bg (all three colors) plp himos PSP_003092_0985 –map mymap.map (custom projection)
indexes_info
cli.indexes_info(
key=typer.Argument(..., help='Dotted index key, e.g. cassini.iss.index', autocompletion=_complete_index_key),
)Show config + cache status for a registered PDS index.
indexes_list
cli.indexes_list(
key=typer.Argument(None, help="Optional dotted key: 'mission' or 'mission.instrument'. Omit to list missions."),
tree=typer.Option(False, '--tree', help='Render as a tree (mirrors planetarypy.pds.print_available_indexes).'),
)Browse the registered PDS indexes (the operational fetch surface).
Examples: plp indexes list # all missions, summary table plp indexes list cassini # cassini instruments plp indexes list cassini.iss # cassini.iss indexes (with cache status) plp indexes list –tree # full tree (legacy print_available_indexes)
indexes_peek
cli.indexes_peek(
key=typer.Argument(..., help='Dotted index key, e.g. cassini.cda.index', autocompletion=_complete_index_key),
rows=typer.Option(3, '--rows', '-n', help='Number of random rows to show (default 3).'),
)Inspect a registered PDS index: shape, column names, a few random rows.
Useful when an index has a non-standard schema (e.g. cassini.cda.index has FILE_SPECIFICATION_NAME / DATA_SET_ID instead of the usual PRODUCT_ID column) and you want to see what’s actually there before deciding which column to use as the product identifier.
Output is transposed (one row of the index per column of the table) so it stays readable whether the index has 4 columns or 71.
indexes_refresh
cli.indexes_refresh(
config=typer.Option(False, '--config', help='Force-refresh upstream URL config (planetarypy_index_urls.toml).'),
cache=typer.Option(None, '--cache', help="Re-download a specific index's cumulative parquet.", autocompletion=_complete_index_key),
)Refresh upstream index config or re-download a single index.
meta
cli.meta(
ctx,
key=typer.Argument(None, help='Dotted index key, e.g. mro.ctx.edr', autocompletion=_complete_index_key),
product_id=typer.Argument(None, help='Product identifier', autocompletion=_complete_product_id),
long=typer.Option(False, '--long', '-l', help='Request the long form when the index has a custom display (no effect on indexes that always return the full row).'),
)Print the metadata row for a product from its PDS cumulative index.
Thin wrapper around planetarypy.pds.get_meta(key, product_id, long=...). Matches the product ID against the configured (or conventional) PID column, tolerant of case and PDS path/extension/version-suffix decoration. Indexes may register custom display logic (short summaries, multi-row aggregation, …) which the --long flag toggles into the full-row form.
Examples: plp meta mro.ctx.edr P02_001916_2221_XI_42N027W plp meta cassini.iss.index 1_N1454725799
pd_isna
cli.pd_isna(v)Lazy-import-friendly NaN check for the peek command.
spice_cached
cli.spice_cached(
bytes_total=typer.Option(False, '--total', '-T', help='Also print cumulative on-disk size at the bottom.'),
)Show every SPICE kernel currently cached under storage_root.
Walks {storage_root}/spice_kernels/ and groups by top-level directory: generic (LSK/PCK/DE-series/satellites) and per-mission subsets (cassini, mro, …). Useful before kicking off a plp spice fetch to check whether kernels are already on disk.
Examples: plp spice cached plp spice cached –total
spice_fetch
cli.spice_fetch(
ctx,
mission=typer.Argument(None, help='NAIF mission shorthand, e.g. cassini, mro, dawn.', autocompletion=_complete_spice_mission),
start=typer.Option(None, '--start', '-s', help='UTC start date (inclusive), e.g. 2006-06-01'),
stop=typer.Option(None, '--stop', '-e', help='UTC stop date (inclusive), e.g. 2006-06-30'),
save_location=typer.Option(None, '--save-location', '-d', help='Directory for downloaded kernels + metakernel (default: planetarypy storage_root)'),
)Download a date-scoped subset of a mission’s SPICE kernels.
Thin wrapper around planetarypy.spice.archived_kernels. get_metakernel_and_files(). Generates a metakernel referencing the subsetted kernels; prints the metakernel path to stdout so shell composition Just Works:
ISIS_PRE=‘spiceinit from=input.cub mkpre=$(plp spice fetch
cassini –start 2006-06-01 –stop 2006-06-30)’
Examples: plp spice fetch cassini –start 2006-06-01 –stop 2006-06-30 plp spice fetch mro -s 2014-01-01 -e 2014-01-31
spice_generic
cli.spice_generic(
ctx,
name=typer.Argument(None, help="Short alias (lsk/pck/masses/de430/mar099s) or a full path-fragment relative to NAIF's generic_kernels/ URL.", autocompletion=_complete_generic_alias),
force=typer.Option(False, '--force', '-f', help='Re-download even if the local cache already has the file.'),
)Fetch one generic SPICE kernel by short alias.
Generic kernels are the ones needed for any SPICE work — leapseconds, planetary constants, DE-series planetary ephemerides — and they get cached once under {storage_root}/spice_kernels/generic/.
The aliases the command knows about:
lsk naif0012.tls (leapseconds) pck pck00010.tpc (planetary constants) masses de-403-masses.tpc (DE-403 body masses) de430 de430.bsp (JPL DE430 planetary ephemeris) mar099s mar099s.bsp (Mars satellite ephemeris)
Pass a full path-fragment for unlisted kernels (e.g. lsk/naif0011.tls for an older LSK).
Examples: plp spice generic lsk plp spice generic de430 plp spice generic lsk/naif0011.tls # full path for non-default
spice_info
cli.spice_info(
ctx,
mission=typer.Argument(None, help='NAIF mission shorthand, e.g. cassini, mro, dawn.', autocompletion=_complete_spice_mission),
)Show date range + archive metadata for one mission.
Use this before plp spice fetch to discover the date window the archive covers, the cumulative bundle size, and the upstream archive/readme URLs.
Examples: plp spice info cassini plp spice info mro
spice_missions
cli.spice_missions()List every mission archive NAIF publishes (~39 entries).
Each row shows the shorthand to use as the mission argument to plp spice info / plp spice fetch, the full mission name, the date range covered by the archive, and the cumulative kernel-bundle size on the NAIF subsetter.
Examples: plp spice missions
spicer
cli.spicer(
ctx,
body=typer.Argument(None, help='NAIF body name, e.g. Mars, Moon, Enceladus'),
time=typer.Option(None, '--time', '-t', help='UTC time (default: now)'),
lon=typer.Option(None, '--lon', help='Longitude [deg] for surface illumination'),
lat=typer.Option(None, '--lat', help='Latitude [deg] for surface illumination'),
)Show current SPICE data for a solar system body.
Without –lon/–lat, shows global properties (L_s, subsolar point, solar constant). With coordinates, adds surface illumination.
Examples: plp spicer Mars plp spicer Moon –time 2024-06-15T12:00:00 plp spicer Mars –lon 137.4 –lat -4.6