Skip to content

Commit

Permalink
Fix it for multi-topology datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
Huite committed Oct 7, 2023
1 parent c5848cb commit 7580267
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_ugrid_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def test_total_bounds(self):
assert self.uds.ugrid.total_bounds == (0.0, 0.0, 2.0, 2.0)


class TestMultiToplogyUgridDataset:
class TestMultiTopologyUgridDataset:
@pytest.fixture(autouse=True)
def setup(self):
self.uds = xugrid.UgridDataset(grids=GRID())
Expand Down
6 changes: 3 additions & 3 deletions xugrid/core/dataset_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,15 @@ def reindex_like(
"Expected Ugrid1d, Ugrid2d, UgridDataArray, or UgridDataset,"
f"received instead: {type(other).__name__}"
)
grids = self.grids
# Convert to dict to match by name
other_grids = {grid.name: grid for grid in other_grids}

new_grids = []
result = self.obj
for grid in grids:
for grid in self.grids:
other = other_grids.get(grid.name)
if other:
result = self.grid.reindex_like(other, obj=result, tolerance=tolerance)
result = grid.reindex_like(other, obj=result, tolerance=tolerance)
new_grids.append(other)
else:
new_grids.append(grid)
Expand Down

0 comments on commit 7580267

Please sign in to comment.