Closed markhegnauer closed 2 years ago
@Huite, Any idea when this issue can be picked up? I can share an example 1D2D network if needed.
I'm looking at this now, just jotting down some notes. There are two parts to this issue:
The first issue is straightforward: create some logic which interrogates a dataset to provide variables in grouped form. These could then be instantiated into separate single-topology UgridDatasets. This runs into complications immediately, as many data variables may be wholly unrelated to any topology. It would be much cleaner to simply represent the entire file as a single dataset (part two).
Currently, the UgridDataset and UgridDataArray share a property .ugrid
, which returns a UgridAccessor
which contains both the xarray object and its grid object. For a UgridDataArray, it's obvious that only a single topology should be allowed. However, this is unnecessarily strict for a UgridDataset. Multiple variables (DataArrays) could support multiple topologies: they can simply be matched by dimension name. This requires separate accessors for Datasets and DataArrays, but that seems desirable anyway: many operations currently will not work on Datasets (while after separation, the dataset operations simply iterate over variables).
In a few steps:
The second part probably creates some additional complexity: e.g. how to variables with new topology. That one seems straightforward enough (ingest the grid as well as the data during setitem), but more complex stuff may pop up.
In Delft3D-FM, output files contain multiple mesh topologies ['network1d', 'mesh1d', 'mesh2d']. Ideally, xugrid can be used to read and plot data from these output files, but now this gives an NotImplementedError.