Skip to content

fix: Completed.granules.only + validate start + end time for STAC #93

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

Merged
merged 2 commits into from
Oct 14, 2022
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
2 changes: 1 addition & 1 deletion ci.cd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ build_lambda:
docker run --rm -v `PWD`:"/usr/src/app/cumulus_lambda_functions":z -w "/usr/src/app/cumulus_lambda_functions" cae-artifactory.jpl.nasa.gov:17001/python:3.9 ci.cd/create_s3_zip.sh

build_lambda_public:
docker run --rm -v `PWD`:"/usr/src/app/cumulus_lambda_functions":z -w "/usr/src/app/cumulus_lambda_functions" python:3.7 ci.cd/create_s3_zip.sh
docker run --rm -v `PWD`:"/usr/src/app/cumulus_lambda_functions":z -w "/usr/src/app/cumulus_lambda_functions" python:3.9 ci.cd/create_s3_zip.sh

upload_lambda:
aws --profile saml-pub s3 cp cumulus_lambda_functions_deployment.zip s3://am-uds-dev-cumulus-tf-state/unity_cumulus_lambda/
Expand Down
11 changes: 8 additions & 3 deletions cumulus_lambda_functions/cumulus_stac/item_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ def __get_assets(self, input_dict):
}
return asset_dict

def __get_datetime_from_source(self, source: dict, datetime_key: str):
if datetime_key not in source:
return '1970-01-01T00:00:00Z'
return f"{source[datetime_key]}{'' if source[datetime_key].endswith('Z') else 'Z'}"

def to_stac(self, source: dict) -> dict:
"""
Sample: Cumulus granule
Expand Down Expand Up @@ -409,10 +414,10 @@ def to_stac(self, source: dict) -> dict:
},
"properties": {
"datetime": f"{TimeUtils.decode_datetime(source['createdAt'], False)}Z",
"start_datetime": f"{source['beginningDateTime']}{'' if source['beginningDateTime'].endswith('Z') else 'Z'}",
"end_datetime": f"{source['endingDateTime']}{'' if source['endingDateTime'].endswith('Z') else 'Z'}",
"start_datetime": self.__get_datetime_from_source(source, 'beginningDateTime'),
"end_datetime": self.__get_datetime_from_source(source, 'endingDateTime'),
"created": self.__get_datetime_from_source(source, 'productionDateTime'),
# "created": source['processingEndDateTime'], # TODO
"created": source['productionDateTime'], # TODO
},
"collection": source['collectionId'],
"links": [
Expand Down
2 changes: 1 addition & 1 deletion cumulus_lambda_functions/cumulus_wrapper/cumulus_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, cumulus_base: str, cumulus_token: str):
self.__base_headers = {
'Authorization': f'Bearer {cumulus_token}'
}
self._conditions = []
self._conditions = ['status=completed']

def with_page_number(self, page_number):
self._conditions.append(f'page={page_number}')
Expand Down