pyvista / pyvista-support

[moved] Please head over to the Discussions tab of the PyVista repository
https://github.com/pyvista/pyvista/discussions
60 stars 4 forks source link

csv xyz formatting and density #326

Closed zoner72 closed 3 years ago

zoner72 commented 3 years ago

Hi

I hope you all are well and having a great festive season.

Ive been trying to find the best plugin/way to visualise bathymetry data sets, and have tried quite a couple. I like the look and feel of pv and had some great results already. In addition, the demos are great teasers, really like them. Just to let you know, I am probably considered an intermediate beginner with python.

Now that that is out of the way. I want to import bathymetry data for visualisation (and later on, perform underwater acoustic calculations on the imported bathy arrays). my datasets can be of average size (200mb), or pretty big (~800mb) but the gist of it is, most of the time I first convert it to an x,y,z.csv

What I would really like is something like the Ruapehu demo. I downloaded the raw file but it was pretty much unreadable in text format. edit, it is a .vtk which looks like it is a binary file

I basically have two questions: Is there a converter (or another easy way) for an x,y,z.csv to the Ruapehu format. In addition, is there an easy way to reduce the grid density size without interpolation. For example only plot 50m x 50m instead of 1m x 1m.

kind regards

zoner72 commented 3 years ago

This link just came by miraculous on my Google feed. https://vtk.org/Wiki/VTK/Writing_VTK_files_using_python

I guess I test this out

banesullivan commented 3 years ago

Your best bet is to use a library like pandas to read/parse your CSV file and create a PyVista mesh from those data arrays.

See:

You'll either make a pv.PolyData or pv.StructuredGrid mesh of your XYZ points. Hard to help any further without having the data file

In addition, is there an easy way to reduce the grid density size without interpolation. For example only plot 50m x 50m instead of 1m x 1m.

You'd need to subsample the grid. We have some helpers methods to do that with the pv.StructuredGrid class. If you upload your data, we can try to help create a simple example.

zoner72 commented 3 years ago

Hi Bane

thanks for your reply. I did have some success with polydata and meshgrid but wasn't quite sure if this was the best option. Ive included a link with the scripts and one of the bigger test files I've been using. I have tried a lot of different modules (matlab etc) but could never find a good uniform way due to data size and post processing. https://karsdorp.myqnapcloud.com/share.cgi?ssid=0WyPkj0

hope you can hep out.

banesullivan commented 3 years ago

Apologies for the slow response, I am trying to go through and resolve stale issues.

The data link appears to have expired and you mention having success with polydata, so I am going to close this.

Please re-open/re-comment if you still have a question for this topic