Skip to content

Commit

Permalink
feat(gfs): Add test against file with nothing in
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed Nov 26, 2024
1 parent 2632082 commit 84b72a0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,13 @@ def _convert(path: pathlib.Path) -> ResultE[list[xr.DataArray]]:
],
)

if len(processed_das) == 0:
return Failure(ValueError(
f"The file at '{path}' does not contain any variables of interest. "
"Ensure the conversion pipeline is not accidentally dropping wanted variables, ",
"and that the file contains variables of interest.",
))

return Success(processed_das)

@staticmethod
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ class TestCase:
filename="test_HRES-GFS_r.grib",
should_error=False,
),
TestCase(
filename="test_HRES-GFS_aptmp.grib",
should_error=True,
),
TestCase(
filename="test_UM-Global_t2m.grib",
should_error=True,
Expand Down

0 comments on commit 84b72a0

Please sign in to comment.