Skip to content

Commit 51fc07f

Browse files
committed
Skip datasets with no matching product
1 parent d0768be commit 51fc07f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

apps/dc_tools/odc/apps/dc_tools/stac_api_to_dc.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ def item_to_meta_uri(
8585
product_name_sanitised = product_name.replace("-", "_")
8686
product = dc.index.products.get_by_name(product_name_sanitised)
8787

88+
if product is None:
89+
logging.warning(
90+
"Couldn't find matching product for product name: %s",
91+
product_name_sanitised,
92+
)
93+
raise SkippedException(f"Couldn't find matching product for product name: {product_name_sanitised}")
94+
8895
# Convert the STAC Item to a Dataset
8996
dataset = next(stac2ds([item]))
9097
# And assign the product ID

0 commit comments

Comments
 (0)