PyVista <==> xarray
See original GitHub issueDiscussed in https://github.com/pyvista/pyvista/discussions/2375
<div type='discussions-op-text'>Originally posted by RichardScottOZ March 25, 2022 Two things I use more and more it seems.
There’s a discussions here:-
https://github.com/pydata/xarray/issues/4470#issuecomment-1068428147
e.g. @banesullivan did an extremely useful https://banesullivan.com/pyvista/examples/raster.html#sphx-glr-pyvista-examples-raster-py [and an earlier version, but I am a big fan of rioxarray too]
and things I have literally done recently:-
to xarray
data = result['density'].reshape(result.dimensions[2],result.dimensions[1],result.dimensions[0])
XC = [result.bounds[0]+200*i for i in range(result.dimensions[0])]
YC = [result.bounds[2]+200*i for i in range(result.dimensions[1])]
ZC = [result.bounds[4]+200*i for i in range(result.dimensions[2])]
da = xr.DataArray(data=data, dims=["z", "y","x"], coords={"z": ZC, "y": YC, "x": XC})
as a quick version
so having this officially integrated where you didn’t have to think about it for various types of things would be excellent.
So where would you start?
A wrap thing and accessors on the other side, or all in that?
I don’t have a good idea of where I would start, yet, PyVista developers might though.
</div>Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
xarray DataArray accessors for PyVista - GitHub
PyVista xarray. PyPI codecov MyBinder. xarray DataArray accessors for PyVista to visualize datasets in 3D. Usage. You must import pvxarray in order to ......
Read more >Introducing pyvista-xarray for 3D visualization - Pangeo
I've recently been working on pyvista-xarray to create a DataArray accessor that builds a direct line of interoperability between xarray and ...
Read more >PyVista Data Model
A dataset has geometry, topology, and attributes describing that geometry in the form of point, cell, or field arrays. Geometry in PyVista is...
Read more >Read a raster using xarray - — Bane Sullivan
Use xarray and rasterio to load a raster into a StructuredGrid. import numpy as np import pooch import pyvista as pv from rasterio.warp...
Read more >Xarray related projects
pyvista -xarray: xarray DataArray accessor for 3D visualization with PyVista and DataSet engines for reading VTK data formats.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s a start, anyway :- https://github.com/RichardScottOZ/pyvista/blob/feat/xarray/pyvista/utilities/pvxarray.py
Closing now that
pyvista-xarray
is implemented here: https://github.com/pyvista/pyvista-xarrayPlease use that repo’s issues and discussions