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

exit successfully with no changes when run via hyp3 with weather_model=HRRR and outside HRRR coverage #702

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* [701](https://github.com/dbekaert/RAiDER/pull/701) - Fixed a few path typos and handle some edge cases, add unit tests, lint project
* [672](https://github.com/dbekaert/RAiDER/pull/672) - Linted the project with `ruff`.
* [683](https://github.com/dbekaert/RAiDER/pull/683) - Fixed a naive datetime and added default template to template generation argument
* `prepFromGunw.check_weather_model_availability` now returns `False` for HRRR when outside the CONUS or AK coverage areas, rather than raising `ValueError`.
As a result, HRRR jobs run via HyP3 for GUNWs outside HRRR coverage will exit successfully without making any changes to the GUNW.

### Fixed
* [700](https://github.com/dbekaert/RAiDER/pull/700) - Fixed a few path typos and handle some edge cases
Expand Down
2 changes: 2 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def factory(location: str = 'california-t71') -> Path:
file_name = 'S1-GUNW-D-R-071-tops-20200130_20200124-135156-34956N_32979N-PP-913f-v2_0_4.nc'
elif location == 'alaska':
file_name = 'S1-GUNW-D-R-059-tops-20230320_20220418-180300-00179W_00051N-PP-c92e-v2_0_6.nc'
elif location == 'philippines':
file_name = 'S1-GUNW-D-R-032-tops-20200220_20200214-214625-00120E_00014N-PP-b785-v3_0_1.nc'
Comment on lines +40 to +41
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for including this.

else:
raise NotImplementedError
return TEST_DIR / 'gunw_test_data' / file_name
Expand Down
Binary file not shown.
6 changes: 6 additions & 0 deletions test/test_GUNW.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ def test_check_weather_model_availability_over_alaska(test_gunw_path_factory, we
assert cond


def test_check_hrrr_availability_outside_united_states(test_gunw_path_factory):
# S1-GUNW-D-R-032-tops-20200220_20200214-214625-00120E_00014N-PP-b785-v3_0_1.nc
test_gunw_path = test_gunw_path_factory(location='philippines')
assert not check_weather_model_availability(test_gunw_path, 'HRRR')


@pytest.mark.parametrize('weather_model_name', ['ERA5', 'GMAO', 'MERRA2', 'HRRR'])
def test_check_weather_model_availability_2(weather_model_name):
gunw_id = Path("test/gunw_test_data/S1-GUNW-D-R-059-tops-20230320_20220418-180300-00179W_00051N-PP-c92e-v2_0_6.nc")
Expand Down
7 changes: 3 additions & 4 deletions tools/RAiDER/aria/prepFromGUNW.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,13 @@ def check_weather_model_availability(gunw_path: Path, weather_model_name: str) -
Returns:
-------
bool:
True if both reference and secondary acquisitions are within the valid range. We assume that
reference_date > secondary_date (i.e. reference scenes are most recent)
True if both reference and secondary acquisitions are within the valid temporal and spatial ranges for the given
weather model. We assume that reference_date > secondary_date (i.e. reference scenes are most recent)

Raises:
------
ValueError
- If weather model is not correctly referencing the Class from RAiDER.models
- HRRR was requested and it's not in the HRRR CONUS or HRRR AK coverage area
"""
ref_slc_ids = get_slc_ids_from_gunw(gunw_path, reference_or_secondary='reference')
sec_slc_ids = get_slc_ids_from_gunw(gunw_path, reference_or_secondary='secondary')
Expand All @@ -134,7 +133,7 @@ def check_weather_model_availability(gunw_path: Path, weather_model_name: str) -
elif AK_GEO.intersects(gunw_poly):
weather_model_name = 'HRRRAK'
else:
raise ValueError('HRRR was requested but it is not available in this area')
return False

# source: https://stackoverflow.com/a/7668273
# Allows us to get weather models as strings
Expand Down