Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for indexing new sentinel-2 collection in deafrica odc #612

Merged
merged 4 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion apps/dc_tools/odc/apps/dc_tools/_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"sentinel_s2_l2a_cogs",
"sentinel-s2-l2a-cogs",
"sentinel-2-l2a",
"s2_l2a_c1",
]

# Mapping between EO3 field names and STAC properties object field names
Expand Down Expand Up @@ -118,7 +119,10 @@ def _stac_product_lookup(
dataset_id = properties.get("sentinel:product_id") or properties.get(
"s2:granule_id", dataset_id
)
product_name = "s2_l2a"
if collection == "s2_l2a_c1":
product_name = "s2_l2a_c1"
else:
product_name = "s2_l2a"
if region_code is None:
# Let's try two options, and throw an exception if we still don't get it
try:
Expand Down Expand Up @@ -182,6 +186,10 @@ def _find_self_href(item: Document) -> str:
def _get_relative_path(asset_href, self_link):
if self_link is None:
return asset_href
elif urlparse(self_link).netloc != urlparse(asset_href).netloc:
# files are not stored in same domain (e.g. diferent buckets)
# therefore use the absolute path
return asset_href

self_path = urlparse(self_link).path
href_path = urlparse(asset_href).path
Expand Down
2 changes: 1 addition & 1 deletion apps/dc_tools/odc/apps/dc_tools/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.17"
__version__ = "0.2.18"
Loading