eomatch.add_asset.register_analysis

eomatch.add_asset.register_analysis#

eomatch.add_asset.register_analysis(catalogue_path: str, collection_id: str, item_id: str, file_path: str, key_prefix: str = 'comparison', date: date | None = None, media_type: str | None = None, title: str | None = None, push: bool = False, config=None, db_host: str | None = None, db_port: int | None = None, db_name: str | None = None, db_user: str | None = None, db_password: str | None = None, assets_base_url: str | None = None) → None[source]#

Register an analysis output file as versioned STAC assets on a matchup item.

Adds two assets to the item in the local catalogue:

  • {key_prefix}:{YYYY-MM-DD} — dated snapshot, never overwritten by future runs.

  • {key_prefix}:latest — always updated to point at the most recent file.

The local catalogue JSON is written immediately. Pass push=True to also upsert the updated item into the running pgSTAC database.

Example:

from eomatch.add_asset import register_analysis

register_analysis(
    catalogue_path="/data/catalogue",
    collection_id="LANDSAT_C2L1-Landsat-8-vs-S2_MSI_L1C-S2A",
    item_id="L8-S2A-20220613T001234",
    file_path="/data/results/comparison_20260512.nc",
    push=True,
    db_host="localhost",
    db_name="eomatch",
)
Parameters:
  • catalogue_path – path to the root catalogue directory or catalog.json.

  • collection_id – STAC collection ID containing the target item.

  • item_id – STAC item ID to attach the asset to.

  • file_path – path to the analysis output file.

  • key_prefix – prefix for the asset keys; defaults to "comparison".

  • date – date for the dated snapshot key; defaults to today.

  • media_type – MIME type for the asset; auto-detected from extension if None.

  • title – human-readable title for the asset; defaults to the filename.

  • push – if True, upsert the updated item into pgSTAC after saving locally.

  • config – path to a eomatch YAML config file, or a dict of overrides.

  • db_host – pgSTAC database host (used only when push is True).

  • db_port – pgSTAC database port.

  • db_name – pgSTAC database name.

  • db_user – pgSTAC database user.

  • db_password – pgSTAC database password.

  • assets_base_url – HTTP base URL at which catalogue assets are served; used to rewrite file:// hrefs when pushing to pgSTAC.