Skip to content

Commit

Permalink
Merge pull request #211 from NASA-IMPACT/dev
Browse files Browse the repository at this point in the history
Merge pipeline updates for L9 for production release.
  • Loading branch information
sharkinsspatial authored May 17, 2022
2 parents 75bf259 + 3891305 commit 78300c0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
17 changes: 12 additions & 5 deletions lambda_functions/execute_landsat_step_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ def handler(event: Dict, context: Dict):
scene_meta["bucket"] = url_components.netloc
scene_meta["prefix"] = url_components.path.strip("/")
print(scene_meta)
# Skip unless real-time (RT) collection
# Landsat 08 uses RT processing while Landsat 9 goes directly to T1.
if (
scene_meta["collectionCategory"] == "RT"
and scene_meta["satellite"] == "08"
and scene_meta["processingCorrectionLevel"] == "L1TP"
) or historic_value == "historic":
(
scene_meta["satellite"] == "08"
and scene_meta["collectionCategory"] == "RT"
and scene_meta["processingCorrectionLevel"] == "L1TP"
)
or (
scene_meta["satellite"] == "09"
and scene_meta["processingCorrectionLevel"] == "L1TP"
)
or historic_value == "historic"
):
try:
input = json.dumps(scene_meta)
step_functions.start_execution(
Expand Down
17 changes: 15 additions & 2 deletions lambda_functions/tests/test_execute_landsat_step_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_handler(client):


@patch("lambda_functions.execute_landsat_step_function.boto3.client")
def test_handler_non_RT(client):
def test_handler_08_non_RT(client):
"""Test handler."""
message = {
"landsat_product_id": "LC08_L1TP_197119_20210201_20210302_02_T2",
Expand All @@ -61,7 +61,7 @@ def test_handler_non_RT(client):


@patch("lambda_functions.execute_landsat_step_function.boto3.client")
def test_handler_non_08(client):
def test_handler_07(client):
"""Test handler."""
message = {
"landsat_product_id": "LE07_L1TP_184023_20210302_20210303_02_RT",
Expand All @@ -85,3 +85,16 @@ def test_handler_historic(client):
event = {"Records": [{"Sns": {"Message": message}}]}
handler(event, {})
client.return_value.start_execution.assert_called_once()


@patch("lambda_functions.execute_landsat_step_function.boto3.client")
def test_handler_09(client):
"""Test handler."""
message = {
"landsat_product_id": "LC09_L1TP_007029_20220329_20220329_02_T1",
"s3_location": "s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2022/007/029/LC09_L1TP_007029_20220329_20220329_02_T1/",
}
message = json.dumps(message)
event = {"Records": [{"Sns": {"Message": message}}]}
handler(event, {})
client.return_value.start_execution.assert_called_once()

0 comments on commit 78300c0

Please sign in to comment.