Replies: 4 comments 5 replies
-
reproducing some things said by @deltamarnix in #49 about #58 I've researched some of the packages that seem to support UGRID. It's hard to find a library that supports 3D unstructured grids. I found the following so far: I'm still playing in my head with the fact that DISU is actually just a graph, and should be treated that way. The graph itself might fit into memory, but the data on the nodes and edges might not. I'm diving a little deeper into what XArray supports for representing a graph (DISU) in its data format. [XArray](https://docs.xarray.dev/en/latest/user-guide/duckarrays.html) supports [numpy sparse arrays](https://sparse.pydata.org/en/stable/).
|
Beta Was this translation helpful? Give feedback.
-
Huite recommends we represent DISU with flat arrays in the same way as mf6 for now. We can add cell id as an xarray index for some convenience. Over the coming months the fate of xugrid vs uxarray will become clearer, at which point we can decide which to adopt for DISV, and at that point maybe reconsider options for DISU. |
Beta Was this translation helpful? Give feedback.
-
prior art: grid classes in xgcm, xugrid, uxarray |
Beta Was this translation helpful? Give feedback.
-
an xarray development to watch pydata/xarray#1475.. cell boundaries as coordinates |
Beta Was this translation helpful? Give feedback.
-
Some notes on representing grids.
DISU
A DISU grid is a directed graph. There are several options to represent these.
Currently MODFLOW 6 uses an adjacency list, where
ja
specifies adjacent cells andihc
indicates direction.Flopy currently follows MF6 in using the adjacency list representation. It computes neighbors lazily and caches them to speed up subsequent searches.
@deltamarnix has looked into interop with
networkx
in #58, which provides an adjacency matrix representation — storing these in dense numpy arrays and sparse scipy arrays, as well as in xarray. It seems we could manually store a sparse array in an xarray dataset in CSR format, or use asparse
array since xarray supports these and they can be converted to/from scipy sparse arrays.Beta Was this translation helpful? Give feedback.
All reactions