From 7a8215c76e96f913c755a9325d62c79f7b7994f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Wed, 13 Nov 2024 09:50:38 +0100 Subject: [PATCH] Backport PR #5052: BUG: fix load_uniform_grid with cell_widths and multiple fields --- yt/frontends/stream/tests/test_stream_stretched.py | 5 ++++- yt/loaders.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/yt/frontends/stream/tests/test_stream_stretched.py b/yt/frontends/stream/tests/test_stream_stretched.py index 10e8a34dd5b..2b4b3dded40 100644 --- a/yt/frontends/stream/tests/test_stream_stretched.py +++ b/yt/frontends/stream/tests/test_stream_stretched.py @@ -60,7 +60,10 @@ def test_variable_dx(): def data_cell_widths_N16(): np.random.seed(0x4D3D3D3) N = 16 - data = {"density": np.random.random((N, N, N))} + data = { + "density": np.random.random((N, N, N)), + "temperature": np.random.random((N, N, N)), + } cell_widths = [] for _ in range(3): diff --git a/yt/loaders.py b/yt/loaders.py index ebd90cf81dd..f13e3180fc4 100644 --- a/yt/loaders.py +++ b/yt/loaders.py @@ -369,9 +369,9 @@ def load_uniform_grid( bbox, cell_widths=cell_widths, ) - cell_widths = grid_cell_widths grid_dimensions = np.array(list(shapes), dtype="int32") temp[key] = [data[key][slice] for slice in slices] + cell_widths = grid_cell_widths for gid in range(nprocs): new_data[gid] = {}