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

[1pt] PR: Bug fixes for test_cases (missing benchmark types) #1387

Merged
merged 7 commits into from
Jan 10, 2025
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
16 changes: 15 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
All notable changes to this project will be documented in this file.
We follow the [Semantic Versioning 2.0.0](http://semver.org/) format.

## v4.5.13.6 - 2025-1-10 - [PR#1387](https://github.com/NOAA-OWP/inundation-mapping/pull/1387)

Fixes two issues in test_cases:
1. An error in `synthesize_test_cases` and `run_test_case` if any directories of the 5 benchmark sources (BLE, NWS, IFC, USGS, or ras2fim) do not exist. This issue was originally discovered and fixed in #1178, but is being elevated to its own PR here. Fixes #1386.
2. Updated `run_test_cases` to accommodate levee and waterbody masking in Alaska. As part of these changes, hardcoded paths were replaced by environment variables.

### Changes

- `tools/`
- `run_test_case.py`: Fixed error if missing validation data. Updated masking data to include Alaska.
- `synthesize_test_cases.py`: Fixed error if missing validation data.

<br/><br/>


## v4.5.13.5 - 2025-01-09 - [PR#1389](https://github.com/NOAA-OWP/inundation-mapping/pull/1389)

Updates Python packages to resolve dependency conflicts that were preventing `Dockerfile.dev` to build on Mac. This also resolves two security warnings: https://github.com/NOAA-OWP/inundation-mapping/security/dependabot/51 and https://github.com/NOAA-OWP/inundation-mapping/security/dependabot/52.
Expand All @@ -12,7 +27,6 @@ Updates Python packages to resolve dependency conflicts that were preventing `Do
<br/><br/>



## v4.5.13.4 - 2024-01-03 - [PR#1382](https://github.com/NOAA-OWP/inundation-mapping/pull/1382)

Cleans up Python files within `delineate_hydros_and_produce_HAND.sh` to improve performance, especially memory management, including removing unused imports, deleting object references when objects are no longer needed, and removing GDAL from the `fim_process_unit_wb.sh` step of FIM pipeline. Contributes to #1351 and #1376.
Expand Down
40 changes: 27 additions & 13 deletions tools/run_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def magnitudes(self):
def huc_data(self):
'''Returns a dict of HUC8, magnitudes, and sites.'''
huc_mags = {}
if not os.path.exists(self.validation_data):
return huc_mags

for huc in os.listdir(self.validation_data):
if not re.match(r'\d{8}', huc):
continue
Expand Down Expand Up @@ -126,19 +129,30 @@ def __init__(self, test_id, version, archive=True):
# Benchmark data path
self.benchmark_dir = os.path.join(self.validation_data, self.huc)

# Create list of shapefile paths to use as exclusion areas.
self.mask_dict = {
'levees': {
'path': '/data/inputs/nld_vectors/Levee_protected_areas.gpkg',
'buffer': None,
'operation': 'exclude',
},
'waterbodies': {
'path': '/data/inputs/nwm_hydrofabric/nwm_lakes.gpkg',
'buffer': None,
'operation': 'exclude',
},
}
if self.huc[:2] == '19':
self.mask_dict = {
'levees': {
'path': os.getenv('input_nld_levee_protected_areas_Alaska'),
'buffer': None,
'operation': 'exclude',
},
'waterbodies': {
# 'path': '/data/inputs/nwm_hydrofabric/nwm_lakes.gpkg',
'path': os.getenv('input_nwm_lakes_Alaska'),
'buffer': None,
'operation': 'exclude',
},
}

else:
self.mask_dict = {
'levees': {
'path': os.getenv('input_nld_levee_protected_areas'),
'buffer': None,
'operation': 'exclude',
},
'waterbodies': {'path': os.getenv('input_nwm_lakes'), 'buffer': None, 'operation': 'exclude'},
}

@classmethod
def list_all_test_cases(cls, version, archive, benchmark_categories=[]):
Expand Down
3 changes: 3 additions & 0 deletions tools/synthesize_test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def create_master_metrics_csv(
# Iterate through 5 benchmark sources
for benchmark_source in ['ble', 'nws', 'usgs', 'ifc', 'ras2fim']:
benchmark_test_case_dir = os.path.join(TEST_CASES_DIR, benchmark_source + '_test_cases')
if not os.path.exists(benchmark_test_case_dir):
continue

test_cases_list = [d for d in os.listdir(benchmark_test_case_dir) if re.match(r'\d{8}_\w{3,7}', d)]

if benchmark_source in ['ble', 'ifc', 'ras2fim']:
Expand Down
Loading