-
Notifications
You must be signed in to change notification settings - Fork 4
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
Xarray-to-vtk #106
Comments
to netcdf file to paraviewFile > Open and choose NetCDF Reader |
to netcdf file to Python (PyVista Plotter for display)
|
Interim example:
|
(also in #99) |
Here is the WIP MR for the full xarray to vtk: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11513 |
@danlipsa here is link to sample xarray datasets: https://github.com/pydata/xarray-data that we should try to load in your PR |
The attached script works with the xarray MR: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11513 Variables are shallow copied (unless the numpy array needs to be made contiguous: https://numpy.org/devdocs/reference/generated/numpy.ascontiguousarray.html). Coordinates are deep copied at the moment, because the are stored as double array in the netcdf reader so they require a bit more work - they need to be stored as the orginal type in the reader. |
This is the script that produces these images from https://github.com/pydata/xarray-data |
@danlipsa are everything available in the nightly VTK wheel? Also do you have a small Python example using the reader from VTK? |
Yes, everything is there. I used: https://gitlab.kitware.com/vtk/vtk/-/jobs/10654362 I use In few cases you'll need to:
and then get the dataset from the xarray as before. |
Where did you get the salt dataset? |
All datasets are from: https://github.com/pydata/xarray-data/ |
Here is the API we have in our dataset builder that we would need to map to the VTK API. Some are rectilinear specific but for now I'm just listing everything so we can create an adapter that is more python friendly. So far, by installing vtk nightly, I was able to load xarray dataset using the accessor. But because PyVista is not compatible with 9.4, I could not easily render the mesh within Jupyter. Reader requirements
Questions: For the VTK reader how do I ...
Next step: Once we understand how do some of those operations, we should create a Python adapter or improve the C++ code to help that integration process. Comments:
|
The reader returned is a vtkNetCDFCFReader so:
|
Some weird behavior that I'm noticing... When loading an XArray without enabling any field, the output is a I think the switch of dataset type is messing up the VTK pipeline. I'm going to talk with Berk about that and may implement a work around into our viewers/explorers. |
Try to load ROMS_example.nc in paraview. You'll see that you can select Dimensions. (you should choose (s_rho, eta_rho, xi_rho)). The list you see is AllDimensions you asked about earlier: the list of all possible set of dimensions for all variables. Once you select a dimension, all variables that have that dimension are loaded. Probably you'll need to do something similar in trame. |
For different variables, you can have different types of output. If you don't specify and variable I assume it just uses the default which is image data. |
Using vtkNetCDFCFReader as described in #99
The text was updated successfully, but these errors were encountered: