lunar_toolkit.ode

PDS ODE REST client (ShadowCam, LROC NAC, Kaguya TC) returning the observation schema.

OdeError

Bases: RuntimeError

ODE returned an error status.

OdeClient(base_url=ODE_REST_URL, timeout=180.0, page_size=100, retries=2)

Query ODE REST and return OBSERVATION_COLUMNS DataFrames.

Parameters:
  • base_url (str, default: ODE_REST_URL ) –

    ODE REST endpoint (default: live2).

  • timeout (float, default: 180.0 ) –

    Per-request timeout in seconds — ODE footprint queries can take 30 s or more.

  • page_size (int, default: 100 ) –

    Products per request (ODE limit); results are paged with offset.

build_params(instrument, product_type=None, lat=None, lon=None, point=None, radius_km=0.0, incidence=None, emission=None, phase=None, time_range=None, loc=None, results='fmp', aoi=None)

Translate search arguments into ODE query parameters.

An aoi (see lunar_toolkit.geometry.load_aoi) is sent as its bounding box; search refines the results exactly.

request(params)

GET the ODE endpoint and return the decoded ODEResults dict.

search(instrument, product_type=None, lat=None, lon=None, point=None, radius_km=0.0, incidence=None, emission=None, phase=None, time_range=None, max_results=1000, loc=None, aoi=None)

Search ODE and return the common observation schema.

Region arguments follow CumIndex.search: lat=(min, max) and lon=(west, east) (west > east crosses 0/360), or point=(lat, lon) with radius_km (converted to a bounding box; circles reaching a pole become a full-longitude cap). ODE matches the box against product footprints (loc=f, its default). With aoi (GeoJSON / WKT path, WKT string or Aoi) the AOI's bounding box is queried and each footprint_wkt is then intersected with the polygon; paging continues until max_results products survive that refinement.

Extra columns: files (list of ODE product-file dicts) and ode_url (ODE product page).

lookup(product_ids, instrument_label=None)

Observations for exact product IDs, one ODE productid request each.

Unknown IDs are skipped with a warning.

count(instrument, product_type=None, **kwargs)

Number of matching products (results=c).

download(df, output_dir, kind='product', match=None, workers=4, force=False)

Download files listed in the files column of a search result.

Parameters:
  • kind (str, default: 'product' ) –

    ODE file Type to select: "product" (default; data files only, labels skipped), "label", "browse", "referenced", "derived" or "all".

  • match (str, default: None ) –

    Case-insensitive substring the file name must contain (e.g. "_cog.tif").

  • force (bool, default: False ) –

    Download again even when the file already exists in output_dir.

resolve_instrument(instrument, product_type=None)

Return (key, registry_entry, ode_pt) for user-facing names.

extract_products(res)

Return the product list from an ODEResults dict (handles 0/1/N).

parse_product(prod, instrument_label=None)

Map one ODE product dict to the observation schema (+ extras).

to_dataframe(records)

Observation DataFrame with the files / ode_url extras appended.

select_file_urls(df, kind='product', match=None)

Pick file URLs from the files column (see OdeClient.download).