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

Fix cloud cover requirements #39

Merged
merged 3 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion landsat/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 17 additions & 5 deletions tests/landsat/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -46,15 +46,27 @@ def test_qualifies_for_processing():
assert not main._qualifies_for_processing(item)

item = get_mock_pystac_item()
item.properties['eo:cloud_cover'] = 59
item.properties['landsat:cloud_cover_land'] = -1
assert not main._qualifies_for_processing(item)

item = get_mock_pystac_item()
item.properties['landsat:cloud_cover_land'] = 0
assert main._qualifies_for_processing(item)

item = get_mock_pystac_item()
item.properties['eo:cloud_cover'] = 60
assert not main._qualifies_for_processing(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['eo:cloud_cover'] = 61
item.properties['landsat:cloud_cover_land'] = main.MAX_CLOUD_COVER_PERCENT + 1
assert not main._qualifies_for_processing(item)
jhkennedy marked this conversation as resolved.
Show resolved Hide resolved

item = get_mock_pystac_item()
Expand Down
Loading