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

i.eodag: handle cases when sorting parameters are not available #1170

Merged
merged 10 commits into from
Aug 20, 2024
38 changes: 35 additions & 3 deletions src/imagery/i.eodag/i.eodag.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,15 +813,47 @@ def products_compare(first, second):
for sort_key in sort_keys:
if sort_key == "ingestiondate":
if "startTimeFromAscendingNode" not in first.properties:
gs.warning(
_("Could not sort by ingestion date, please report this issue")
)
continue
if "startTimeFromAscendingNode" not in second.properties:
gs.warning(
_("Could not sort by ingestion date, please report this issue")
)
veroandreo marked this conversation as resolved.
Show resolved Hide resolved
continue
first_value = first.properties["startTimeFromAscendingNode"]
second_value = second.properties["startTimeFromAscendingNode"]
elif sort_key == "cloudcover":
if "cloudCover" not in first.properties:
continue
first_value = first.properties["cloudCover"]
second_value = second.properties["cloudCover"]
gs.warning(
_(
"Cloud cover not available for scene {}".format(
first.properties.get("title", "NA")
)
)
)
if "cloudCover" not in second.properties:
HamedElgizery marked this conversation as resolved.
Show resolved Hide resolved
gs.warning(
_(
"Cloud cover not available for scene {}".format(
second.properties.get("title", "NA")
)
)
)
first_value = first.properties.get("cloudCover", int(1e9))
second_value = second.properties.get("cloudCover", int(1e9))
elif sort_key == "footprint":
if "title" not in first.properties:
gs.warning(
_("Could not sort by footprint, please report this issue")
)
continue
if "title" not in second.properties:
gs.warning(
_("Could not sort by footprint, please report this issue")
)
continue
HamedElgizery marked this conversation as resolved.
Show resolved Hide resolved
# Sort by title lexicographically
first_value = first.properties["title"]
second_value = second.properties["title"]
Expand Down