lunar_toolkit.constants

App name, data directories, PDS LROC archive URLs, datasets and shared defaults.

pds_url_from_file_spec(file_spec)

Map a CUMINDEX FILE_SPECIFICATION_NAME to a download URL.

LRO-L-LROC-2-EDR-V1.0/LROLRC_0001/DATA/.../M101013931LE.IMG → <PDS_BASE_URL>lro-l-lroc-2-edr/LROLRC_0001/DATA/.../M101013931LE.IMG. Paths without a dataset prefix are joined to PDS_BASE_URL unchanged.

modernize_pds_url(url)

Rewrite a legacy pds.lroc.im-ldi.com/data/ URL to the PDS store host.

Other URLs are returned unchanged. (The legacy host still redirects, but resolving up front saves a round-trip and keeps Range requests simple.)

get_data_dir()

Directory where Parquet databases are stored.

LUNAR_DATA_DIR if set, else the per-user data directory (platformdirs.user_data_dir), e.g. ~/.local/share/lunar_toolkit on Linux (honours XDG_DATA_HOME).

find_parquet(name, data_dir=None)

Path of Parquet database name in data_dir (default: get_data_dir).

parse_nac_id(product_id)

Split a NAC product ID into (observation, side, type).

"M1096757719LE" → ("M1096757719", "L", "edr"); a short base ID ("M1096757719L") gets type "edr". None for anything else (WAC, ShadowCam, …).

nac_id(product_id, side=None, product_type=None)

Full NAC product ID of product_id, optionally for another side / type.

nac_id("M1096757719L") → "M1096757719LE"; nac_id("M1096757719LE", side="R", product_type="cdr") → "M1096757719RC". None when product_id is not a NAC ID.

is_nac_id(product_id)

True for a full NAC product ID (LE / RE / LC / RC).