question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PyVista <==> xarray

See original GitHub issue

Discussed 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:-

image

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})

image

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:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

0reactions
banesullivancommented, Jun 21, 2022

Closing now that pyvista-xarray is implemented here: https://github.com/pyvista/pyvista-xarray

Please use that repo’s issues and discussions

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found