Skip to content

Commit

Permalink
fix: should always remove existing derived_from links
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfouquet committed Dec 18, 2024
1 parent 446fdb9 commit ab2cf9e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/stac/imagery/create_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ def create_item(
if not gdalinfo_result:
gdalinfo_result = gdal_info(asset_path)

if derived_from is not None:
if item.stac.get("links") is not None:
# Remove existing derived_from links in case of resupply
item.stac["links"] = [link for link in item.stac["links"] if link["rel"] != "derived_from"]

if derived_from is not None:
for derived in derived_from:
derived_item_content = read(derived)
derived_stac = json.loads(derived_item_content.decode("UTF-8"))
Expand Down

0 comments on commit ab2cf9e

Please sign in to comment.