eomatch.mu_stac.MatchupCatalogue.remove_matchup

eomatch.mu_stac.MatchupCatalogue.remove_matchup#

MatchupCatalogue.remove_matchup(matchup_id: str) → bool[source]#

Remove a matchup Item from the catalogue by ID, tolerating a missing or corrupted item file.

Unlike deleting an item’s JSON file by hand, this also strips the matchup’s item link from its owning collection, and the corresponding related link from its parent event, so a later get_events() doesn’t hit a dangling link where the removed matchup used to be. The matchup itself is located purely by matching its ID against each collection’s unresolved item links (see _find_item_tolerant()) – it is never read via pystac.Item – so this works even when the matchup’s own JSON file is exactly the thing that’s missing or corrupted.

Its parent event is found via the matchup’s own matchup:event_id property, read directly from the raw JSON (not via pystac) so a still-parseable-but-otherwise-invalid item doesn’t block finding it. If the item’s JSON can’t be read at all, the event-side link can’t be identified and is left in place – get_events() already skips a dangling link like this with a warning rather than raising, so it’s inert, just not tidied up.

Source products referenced by the matchup (via derived_from) are left untouched – they can be shared by other matchups, so aren’t safe to delete just because one matchup referencing them is being removed.

Parameters:

matchup_id – STAC ID of the matchup item to remove (stac_id).

Returns:

True if anything (the item file, its collection link, or a parent event’s link to it) was found and removed; False if nothing matching matchup_id was found anywhere in the catalogue.