diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fbcf53e..36802b66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - HyP3 jobs will now be submitted with the `publish_bucket` job parameter set - The reason a scene disqualifies for processing will now be logged +### Fixed +- The `landsat:cloud_cover_land` property instead of `eo:cloud_cover` will be used to determine if a scene qualifies for processing +- Scenes with unknown cloud cover (unreported or a value < 0) will be disqualified for processing +- The max cloud cover percentage is now an inclusive bound, so only scenes with *more* (`>`) cloud cover will be disqualified + ## [0.0.3] ### Changed diff --git a/landsat/src/main.py b/landsat/src/main.py index 95e616af..a774d548 100644 --- a/landsat/src/main.py +++ b/landsat/src/main.py @@ -54,7 +54,11 @@ def _qualifies_for_processing( log.log(log_level, f'{item.id} disqualifies for processing because it is not from a tile containing land-ice') return False - if item.properties['eo:cloud_cover'] >= max_cloud_cover: + if item.properties.get('landsat:cloud_cover_land', -1) < 0: + log.log(log_level, f'{item.id} disqualifies for processing because cloud coverage is unknown') + return False + + if item.properties['landsat:cloud_cover_land'] > max_cloud_cover: log.log(log_level, f'{item.id} disqualifies for processing because it has too much cloud cover') return False diff --git a/tests/landsat/test_main.py b/tests/landsat/test_main.py index 122920c0..aacfcb09 100644 --- a/tests/landsat/test_main.py +++ b/tests/landsat/test_main.py @@ -11,7 +11,7 @@ def get_mock_pystac_item() -> unittest.mock.NonCallableMagicMock: 'landsat:collection_category': 'T1', 'landsat:wrs_path': '001', 'landsat:wrs_row': '005', - 'eo:cloud_cover': 50, + 'landsat:cloud_cover_land': 50, 'view:off_nadir': 0, } return item @@ -46,15 +46,31 @@ def test_qualifies_for_processing(): assert not main._qualifies_for_processing(item) item = get_mock_pystac_item() - item.properties['eo:cloud_cover'] = 59 - assert main._qualifies_for_processing(item) + del item.properties['landsat:cloud_cover_land'] + assert not main._qualifies_for_processing(item) item = get_mock_pystac_item() - item.properties['eo:cloud_cover'] = 60 + item.properties['landsat:cloud_cover_land'] = -1 assert not main._qualifies_for_processing(item) item = get_mock_pystac_item() - item.properties['eo:cloud_cover'] = 61 + item.properties['landsat:cloud_cover_land'] = 0 + assert main._qualifies_for_processing(item) + + item = get_mock_pystac_item() + item.properties['landsat:cloud_cover_land'] = 1 + assert main._qualifies_for_processing(item) + + item = get_mock_pystac_item() + item.properties['landsat:cloud_cover_land'] = main.MAX_CLOUD_COVER_PERCENT - 1 + assert main._qualifies_for_processing(item) + + item = get_mock_pystac_item() + item.properties['landsat:cloud_cover_land'] = main.MAX_CLOUD_COVER_PERCENT + assert main._qualifies_for_processing(item) + + item = get_mock_pystac_item() + item.properties['landsat:cloud_cover_land'] = main.MAX_CLOUD_COVER_PERCENT + 1 assert not main._qualifies_for_processing(item) item = get_mock_pystac_item()