From 20b9fb4229e6a4454ed8ef14fbece188cba26432 Mon Sep 17 00:00:00 2001 From: "Thomas.Hill" Date: Wed, 29 Nov 2023 16:13:41 -0600 Subject: [PATCH 1/2] added more test cases to test_split_and_combine_fragments_with_merge_dim --- tests/test_rechunking.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_rechunking.py b/tests/test_rechunking.py index 8c43ed39..06401c12 100644 --- a/tests/test_rechunking.py +++ b/tests/test_rechunking.py @@ -17,10 +17,11 @@ [(5, "1D"), (10, "2D")], ) @pytest.mark.parametrize("time_chunks", [1, 2, 5]) -def test_split_and_combine_fragments_with_merge_dim(nt_dayparam, time_chunks): +@pytest.mark.parametrize("other_chunks", [{}, {"lat": 5}, {"lat": 5, "lon": 5}]) +def test_split_and_combine_fragments_with_merge_dim(nt_dayparam, time_chunks, other_chunks): """Test if sub-fragments split from datasets with merge dims can be combined with each other.""" - target_chunks = {"time": time_chunks} + target_chunks = {"time": time_chunks, **other_chunks} nt, dayparam = nt_dayparam ds = make_ds(nt=nt) dsets, _, _ = split_up_files_by_variable_and_day(ds, dayparam) From 47801019cfcee4b5335e7bab68e7503afe240e3a Mon Sep 17 00:00:00 2001 From: Charles Stern <62192187+cisaacstern@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:15:38 -0800 Subject: [PATCH 2/2] fix multidim rechunk error --- pangeo_forge_recipes/rechunking.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pangeo_forge_recipes/rechunking.py b/pangeo_forge_recipes/rechunking.py index bab9fcc9..26fbf3d6 100644 --- a/pangeo_forge_recipes/rechunking.py +++ b/pangeo_forge_recipes/rechunking.py @@ -146,7 +146,8 @@ def _invert_meshgrid(*arrays): selectors[n] = tuple(selectors[n]) xi = [a[s] for a, s in zip(arrays, selectors)] assert all( - np.equal(actual, expected).all() for actual, expected in zip(arrays, np.meshgrid(*xi)) + np.equal(actual, expected.squeeze()).all() + for actual, expected in zip(arrays, np.meshgrid(*xi)) ) return xi