Skip to content

Commit

Permalink
Align datasets before comparing
Browse files Browse the repository at this point in the history
  • Loading branch information
tbody-cfs committed Dec 1, 2023
1 parent 28d842b commit 69a3a88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import pytest
import yaml
import xarray as xr
xr.set_options(display_width=300)


@pytest.fixture(scope="session")
Expand Down
5 changes: 3 additions & 2 deletions tests/test_regression_against_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_regression_against_case(case: Path):

reference_dataset = read_dataset_from_netcdf(Path(__file__).parent / "regression_results" / f"{case_name}_result.nc").load()

dataset, reference_dataset = xr.align(dataset, reference_dataset)
assert_allclose(dataset, reference_dataset, rtol=1e-8, atol=0)


Expand All @@ -35,9 +36,9 @@ def test_regression_against_case_with_update(case: Path):

dataset = xr.Dataset(input_parameters)

for alg in algorithm.algorithms: # type: ignore
dataset = alg.update_dataset(dataset)
dataset = algorithm.update_dataset(dataset)

reference_dataset = read_dataset_from_netcdf(Path(__file__).parent / "regression_results" / f"{case_name}_result.nc").load()

dataset, reference_dataset = xr.align(dataset, reference_dataset)
assert_allclose(dataset, reference_dataset, rtol=1e-8, atol=0)

0 comments on commit 69a3a88

Please sign in to comment.