Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop vtk-xarray interface #84

Closed
johnkit opened this issue Jul 2, 2024 · 2 comments
Closed

Develop vtk-xarray interface #84

johnkit opened this issue Jul 2, 2024 · 2 comments
Assignees
Labels
expired No longer relevant or superseded by other issues task New feature or request

Comments

@johnkit
Copy link
Collaborator

johnkit commented Jul 2, 2024

Develop an Xarray acessor for importing numpy data from Xarray arrays and converting to the applicable vtkDataSet type. Use https://github.com/pyvista/pyvista-xarray as an exemplar.

Xarray accessor documentation at https://docs.xarray.dev/en/stable/internals/extending-xarray.html

First step probably an explicit function to return vtkDataSet from input numpy arrays for coordinates & values.

  • optional args to specify x, y, [z], [time]
  • also let's copy Bane's heuristic for assigning coords
  • future add conduit/blueprint and/or Fides option to specify grid type, coordinate arrays, & data arrays

To start, let's support "current" examples (rectilinear, structured, image)

@johnkit johnkit assigned johnkit and danlipsa and unassigned johnkit Jul 31, 2024
@johnkit
Copy link
Collaborator Author

johnkit commented Jul 31, 2024

See the example at https://github.com/pyvista/pyvista-xarray:

Previous (pyvista-xarray module)

import pvxarray
import xarray as xr

ds = xr.tutorial.load_dataset("air_temperature")
da = ds.air[dict(time=0)]  # Select DataArray for a timestep

# Plot in 3D
da.pyvista.plot(x="lon", y="lat", show_edges=True, cpos='xy')

# Or grab the mesh object for use with PyVista
mesh = da.pyvista.mesh(x="lon", y="lat")

Todo (vtk-xarray module)

import vtk_xarray    # <== new module
import xarray as xr

ds = xr.tutorial.load_dataset("air_temperature")
da = ds.air[dict(time=0)]  # Select DataArray for a timestep

# Get/create corresponding mesh object
mesh = da.vtk.mesh(x="lon", y="lat")    # <== da.vtk property replaces da.pyvista

# Plot in 3D
# ...

@johnkit johnkit added the task New feature or request label Jul 31, 2024
@johnkit
Copy link
Collaborator Author

johnkit commented Sep 4, 2024

Superseded by #106

@johnkit johnkit closed this as completed Sep 4, 2024
@johnkit johnkit added the expired No longer relevant or superseded by other issues label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expired No longer relevant or superseded by other issues task New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants