Deltares / xugrid

Xarray and unstructured grids
https://deltares.github.io/xugrid/
MIT License
53 stars 8 forks source link

Ugrid1D.merge_partitions throws error if dataset contains attrs #210

Closed JoerivanEngelen closed 5 months ago

JoerivanEngelen commented 5 months ago

Related to https://github.com/Deltares/xugrid/issues/86, https://github.com/Deltares/xugrid/issues/134

If a grid contains attrs and is grid.merge_partitions is called, the following is raised: ValueError: indexes must be provided for attrs

Because in Ugrid1D.merge_partitions, the following call is made:

...
        merged_grid = Ugrid1d(
            *node_coordinates.T,
            fill_value,
            new_edges,
            name=grid.name,
            projected=grid.projected,
            crs=grid.crs,
            attrs=grid._attrs,
        )
        return merged_grid, indexes

So no indexes are provided as arg. Ugrid2d does provide indexes. Fixing this is trivial, however what is lacking is testing of merging partitions for Ugrid1d grids. Presumably because setting up tests requires some extra manual work, since we cannot easily partition 1d grids yet.