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

MODIS: Add platform property back in if its missing #315

Merged
merged 5 commits into from
Nov 13, 2024
Merged
Changes from 2 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
14 changes: 14 additions & 0 deletions datasets/modis/modis.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,18 @@ def create_item(
item.assets["metadata"].href = file.xml_href
item.assets["metadata"].href = file.xml_href

# Add back in the platform property which NASA removed from their XML on March 13 2024
# On the MODIS side terra is distributed as MOD and aqua as MYD,
# but Within MPC both are distributed as MODxxx
if ("platform" not in item.properties) or (item.properties["platform"] == ""):
logger.debug("platform field missing, filling it in based on original xml href")
if file.xml_href.split('/')[4][0:3] == "MOD":
item.properties["platform"] = "terra"
elif file.xml_href.split('/')[4][0:3] == "MYD":
item.properties["platform"] = "aqua"
elif file.xml_href.split('/')[4][0:3] == "MCD":
item.properties["platform"] = "terra,aqua"
else:
logger.warning("xml_href did not contain MOD/MYD/MCD in the usual spot")

return [item]
Loading