From b34b45975ea08e76d33e8e0aac02c544b5bc280e Mon Sep 17 00:00:00 2001 From: Joeri van Engelen Date: Mon, 13 May 2024 11:57:51 +0200 Subject: [PATCH 1/7] Reduce amount of timesteps structured model fixture --- imod/tests/fixtures/mf6_twri_fixture.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imod/tests/fixtures/mf6_twri_fixture.py b/imod/tests/fixtures/mf6_twri_fixture.py index c884ca8fe..6fe1cc425 100644 --- a/imod/tests/fixtures/mf6_twri_fixture.py +++ b/imod/tests/fixtures/mf6_twri_fixture.py @@ -227,7 +227,7 @@ def transient_twri_model(): save_flows=True, ) simulation.create_time_discretization( - additional_times=pd.date_range("2000-01-01", " 2000-01-31") + additional_times=pd.date_range("2000-01-01", " 2000-01-03") ) return simulation @@ -255,7 +255,7 @@ def transient_unconfined_twri_model(): # Write specific discharges gwf_model["npf"]["save_specific_discharge"] = True simulation.create_time_discretization( - additional_times=pd.date_range("2000-01-01", " 2000-01-31") + additional_times=pd.date_range("2000-01-01", " 2000-01-03") ) return simulation From 14dffcf1aa3ef3736c44f8621ef36e0aa3ee5820 Mon Sep 17 00:00:00 2001 From: Joeri van Engelen Date: Mon, 13 May 2024 11:58:04 +0200 Subject: [PATCH 2/7] Reduce number timesteps unstructured model fixture --- imod/tests/fixtures/mf6_circle_fixture.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/imod/tests/fixtures/mf6_circle_fixture.py b/imod/tests/fixtures/mf6_circle_fixture.py index 2c4c38b37..4cd21defd 100644 --- a/imod/tests/fixtures/mf6_circle_fixture.py +++ b/imod/tests/fixtures/mf6_circle_fixture.py @@ -74,7 +74,7 @@ def make_circle_model(): reordering_method=None, relaxation_factor=0.97, ) - simtimes = pd.date_range(start="2000-01-01", end="2001-01-01", freq="W") + simtimes = pd.date_range(start="2000-01-01", end="2000-01-03") simulation.create_time_discretization(additional_times=simtimes) return simulation @@ -157,7 +157,7 @@ def make_circle_model_flow_with_transport_data(species: list[str]): reordering_method=None, relaxation_factor=0.97, ) - simtimes = pd.date_range(start="2000-01-01", end="2001-01-01", freq="W") + simtimes = pd.date_range(start="2000-01-01", end="2000-01-03") simulation.create_time_discretization(simtimes) return simulation @@ -336,7 +336,7 @@ def circle_model_transport(): reordering_method=None, relaxation_factor=0.97, ) - simtimes = pd.date_range(start="2000-01-01", end="2001-01-01", freq="W") + simtimes = pd.date_range(start="2000-01-01", end="2000-01-03") simulation.create_time_discretization(additional_times=simtimes) return simulation @@ -413,6 +413,6 @@ def circle_model_transport_multispecies_variable_density(): reordering_method=None, relaxation_factor=0.97, ) - simtimes = pd.date_range(start="2000-01-01", end="2001-01-01", freq="W") + simtimes = pd.date_range(start="2000-01-01", end="2000-01-03") simulation.create_time_discretization(additional_times=simtimes) return simulation From 00e10342675680a8b6012d6ad450efbd1faf4ed4 Mon Sep 17 00:00:00 2001 From: Joeri van Engelen Date: Mon, 13 May 2024 12:43:37 +0200 Subject: [PATCH 3/7] update test --- .../test_multimodel/test_mf6_partitioning_unstructured.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imod/tests/test_mf6/test_multimodel/test_mf6_partitioning_unstructured.py b/imod/tests/test_mf6/test_multimodel/test_mf6_partitioning_unstructured.py index 00fd324e0..59282a2ba 100644 --- a/imod/tests/test_mf6/test_multimodel/test_mf6_partitioning_unstructured.py +++ b/imod/tests/test_mf6/test_multimodel/test_mf6_partitioning_unstructured.py @@ -362,14 +362,14 @@ def run_simulation(tmp_path, simulation, species=None): simulation.run() head = simulation.open_head() flow_budget = simulation.open_flow_budget() - flow_budget = flow_budget.sel(time=364) + flow_budget = flow_budget.sel(time=2) concentration = None transport_budget = None transport_budget = None if has_transport: concentration = simulation.open_concentration() transport_budget = simulation.open_transport_budget(species) - transport_budget = transport_budget.sel(time=364) + transport_budget = transport_budget.sel(time=2) return head, concentration, flow_budget, transport_budget From 585d06563ae140aef8f50a36c80fa3d22136b4f6 Mon Sep 17 00:00:00 2001 From: Joeri van Engelen Date: Mon, 13 May 2024 13:27:47 +0200 Subject: [PATCH 4/7] Reduce amount of timesteps in result --- ...6_partitioned_simulation_postprocessing.py | 35 ++----------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/imod/tests/test_mf6/test_multimodel/test_mf6_partitioned_simulation_postprocessing.py b/imod/tests/test_mf6/test_multimodel/test_mf6_partitioned_simulation_postprocessing.py index 763b37274..54cd34ec4 100644 --- a/imod/tests/test_mf6/test_multimodel/test_mf6_partitioned_simulation_postprocessing.py +++ b/imod/tests/test_mf6/test_multimodel/test_mf6_partitioned_simulation_postprocessing.py @@ -62,38 +62,7 @@ def test_import_heads_structured( assert np.allclose(merged_heads.coords["layer"].values, [1, 2, 3]) assert np.allclose( merged_heads.coords["time"].values, - [ - 1.0, - 2.0, - 3.0, - 4.0, - 5.0, - 6.0, - 7.0, - 8.0, - 9.0, - 10.0, - 11.0, - 12.0, - 13.0, - 14.0, - 15.0, - 16.0, - 17.0, - 18.0, - 19.0, - 20.0, - 21.0, - 22.0, - 23.0, - 24.0, - 25.0, - 26.0, - 27.0, - 28.0, - 29.0, - 30.0, - ], + [1.0, 2.0], ) @@ -110,7 +79,7 @@ def test_import_heads_unstructured(tmp_path, circle_partitioned): # Assert assert np.allclose(merged_heads.coords["layer"].values, [1, 2]) assert np.allclose( - merged_heads.coords["time"].values, list(np.arange(7.0, 365.0, 7.0)) + merged_heads.coords["time"].values, [1.0, 2.0] ) assert np.allclose(merged_heads.coords["mesh2d_nFaces"].values, list(range(216))) From 68e0349174f97dec254cf25b6dc8ae2505bb9d54 Mon Sep 17 00:00:00 2001 From: Joeri van Engelen Date: Mon, 13 May 2024 13:28:28 +0200 Subject: [PATCH 5/7] Reduce number of timesteps to speed up simulation times --- imod/tests/fixtures/flow_transport_simulation_fixture.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imod/tests/fixtures/flow_transport_simulation_fixture.py b/imod/tests/fixtures/flow_transport_simulation_fixture.py index 67f54d37b..3fa54064c 100644 --- a/imod/tests/fixtures/flow_transport_simulation_fixture.py +++ b/imod/tests/fixtures/flow_transport_simulation_fixture.py @@ -210,7 +210,7 @@ def flow_transport_simulation(): duration = pd.to_timedelta("2000d") start = pd.to_datetime("2000-01-01") simulation.create_time_discretization(additional_times=[start, start + duration]) - simulation["time_discretization"]["n_timesteps"] = 100 + simulation["time_discretization"]["n_timesteps"] = 50 return simulation # %% From bfa83e43dca75ddb91e21c8c5c4204179ab1351b Mon Sep 17 00:00:00 2001 From: Joeri van Engelen Date: Mon, 13 May 2024 13:37:18 +0200 Subject: [PATCH 6/7] format --- .../test_mf6_partitioned_simulation_postprocessing.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/imod/tests/test_mf6/test_multimodel/test_mf6_partitioned_simulation_postprocessing.py b/imod/tests/test_mf6/test_multimodel/test_mf6_partitioned_simulation_postprocessing.py index 54cd34ec4..e6995b309 100644 --- a/imod/tests/test_mf6/test_multimodel/test_mf6_partitioned_simulation_postprocessing.py +++ b/imod/tests/test_mf6/test_multimodel/test_mf6_partitioned_simulation_postprocessing.py @@ -78,9 +78,7 @@ def test_import_heads_unstructured(tmp_path, circle_partitioned): # Assert assert np.allclose(merged_heads.coords["layer"].values, [1, 2]) - assert np.allclose( - merged_heads.coords["time"].values, [1.0, 2.0] - ) + assert np.allclose(merged_heads.coords["time"].values, [1.0, 2.0]) assert np.allclose(merged_heads.coords["mesh2d_nFaces"].values, list(range(216))) From 9f631732b0945ff84adc49c1b00deaefb0253403 Mon Sep 17 00:00:00 2001 From: Joeri van Engelen Date: Mon, 13 May 2024 15:12:00 +0200 Subject: [PATCH 7/7] Update tests to work with fixtures with less timesteps --- imod/tests/test_mf6/test_mf6_out.py | 12 ++++++------ imod/tests/test_mf6/test_mf6_simulation.py | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/imod/tests/test_mf6/test_mf6_out.py b/imod/tests/test_mf6/test_mf6_out.py index 639444543..4feb36241 100644 --- a/imod/tests/test_mf6/test_mf6_out.py +++ b/imod/tests/test_mf6/test_mf6_out.py @@ -222,7 +222,7 @@ def test_open_cbc__dis_transient(transient_twri_result): "wel", ] for array in cbc.values(): - assert array.shape == (30, 3, 15, 15) + assert array.shape == (2, 3, 15, 15) assert isinstance(array, xr.DataArray) assert isinstance(array.data, dask.array.Array) @@ -266,7 +266,7 @@ def test_open_cbc__dis_transient_unconfined(transient_unconfined_twri_result): "wel", ] for array in cbc.values(): - assert array.shape == (30, 3, 15, 15) + assert array.shape == (2, 3, 15, 15) assert isinstance(array, xr.DataArray) assert isinstance(array.data, dask.array.Array) @@ -289,10 +289,10 @@ def test_open_cbc__disv(circle_result): ] for key, array in cbc.items(): if key in ("chd", "flow-lower-face"): - assert array.shape == (52, 2, 216) + assert array.shape == (2, 2, 216) assert array.dims[-1] == array.ugrid.grid.face_dimension else: - assert array.shape == (52, 2, 342) + assert array.shape == (2, 2, 342) assert array.dims[-1] == array.ugrid.grid.edge_dimension assert isinstance(array, xu.UgridDataArray) assert isinstance(array.data, dask.array.Array) @@ -333,10 +333,10 @@ def test_open_cbc__disv_sto(circle_result_sto): ] for key, array in cbc.items(): if key in ("chd", "flow-lower-face", "sto-ss"): - assert array.shape == (52, 2, 216) + assert array.shape == (2, 2, 216) assert array.dims[-1] == array.ugrid.grid.face_dimension else: - assert array.shape == (52, 2, 342) + assert array.shape == (2, 2, 342) assert array.dims[-1] == array.ugrid.grid.edge_dimension assert isinstance(array, xu.UgridDataArray) assert isinstance(array.data, dask.array.Array) diff --git a/imod/tests/test_mf6/test_mf6_simulation.py b/imod/tests/test_mf6/test_mf6_simulation.py index c820458b4..6941343df 100644 --- a/imod/tests/test_mf6/test_mf6_simulation.py +++ b/imod/tests/test_mf6/test_mf6_simulation.py @@ -71,15 +71,15 @@ def test_simulation_open_head(circle_model, tmp_path): assert isinstance(head_notime, xu.UgridDataArray) assert head_notime.dims == ("time", "layer", "mesh2d_nFaces") - assert head_notime.shape == (52, 2, 216) + assert head_notime.shape == (2, 2, 216) # open heads with time conversion. head = simulation.open_head( simulation_start_time=datetime(2013, 3, 11, 22, 0, 0), time_unit="w" ) assert head.dims == ("time", "layer", "mesh2d_nFaces") - assert head.shape == (52, 2, 216) - assert str(head.coords["time"].values[()][0]) == "2013-04-29T22:00:00.000000000" + assert head.shape == (2, 2, 216) + assert str(head.coords["time"].values[()][0]) == "2013-03-18T22:00:00.000000000" @pytest.mark.usefixtures("circle_model") @@ -100,7 +100,7 @@ def test_simulation_open_head_relative_path(circle_model, tmp_path): assert isinstance(head, xu.UgridDataArray) assert head.dims == ("time", "layer", "mesh2d_nFaces") - assert head.shape == (52, 2, 216) + assert head.shape == (2, 2, 216) @pytest.mark.usefixtures("circle_model")