Creating Trimesh from hvplot/xarray

Hello,

is it possible to use trimesh directly from hvplot? I’m getting not, since only the quadmesh and vector show up…

Would that be difficult to implement?

Certainly possible in theory, but what format would this mesh be stored in?

I had orientiert myself with the example of Trimesh on the Holoviews website. I guess in that case its a 3xN array of node coordinates. It’d be really cool to have that for geographic plots of unstructured grids…

TriMesh takes two separate sets of data, the vertices are a 3xN array of node ids, and the coordinates a 3xN array of x, y and node id. It’d be nice to have a good way to represent that in a single xarray dataset but I honestly don’t see a great way to do that.

That’s probably something the unstructured mesh community needs to at some points standardize. Our meshes are stored in plain text, other groups have some proprietary binary format…it’s a mess…

I realize that’s probably more a missing part in xarray. Would it it however be possible to do something like this?

ds = xr.Dataset(...)
# Assume the user has somehow added two arrays storing nodes/coordinates
nodes_arr = ...
simplex_arr = ...
ds.variable.hvplot.trimesh(nodes=nodes_arr, simplexes=simplex_arr, *args, **kwargs)
1 Like