GithubHelp home page GithubHelp logo

Comments (3)

kinverarity1 avatar kinverarity1 commented on July 18, 2024 2

@banesullivan has very kindly helped me out with this!

So it looks like your points aren’t ordered the way the structured grid needs them. I got it to work by changing where you sort the points from the dataframe:

array = df.sort_values(["northing", "easting", "elev"]).values

then change the dimensions to (1, 30, 232):

dims = (1, 30, 232)
mesh = pv.StructuredGrid()
mesh.points = array[:, :3]
assert np.product(dims) == len(mesh.points)
mesh.dimensions = dims

mesh['log10(cond)'] = np.log10(array[:, -1])

mesh.plot( show_edges=False, show_grid=False, cpos="yz", notebook=False)

Why have the dimensions as (1, 30, 232)? That’s x, z, y - which is how we want to structure the points for this particular data. Your x is constant so ignore that and have it first, then you iterate over the points along the z axis so you will come across 30 nodes before moving to the next sounding which you have 232 of… the dimensions are less about how many nodes are on each axes and more about what is the ordering/structure of the points array because all VTK is doing is creating an indexing array to make the quads between the nodes which doesn’t care about where the nodes are located, just their order with respect to each other.

image

from pyvista-support.

banesullivan avatar banesullivan commented on July 18, 2024

Thanks for posting here @kinverarity1!

This is related to pyvista/pyvista#318

from pyvista-support.

banesullivan avatar banesullivan commented on July 18, 2024

And for completeness, the resulting grid looks like:

...
p = pv.BackgroundPlotter()
p.add_mesh(mesh, show_edges=True, nan_opacity=0.)

Screen Shot 2019-07-23 at 8 11 13 AM

from pyvista-support.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.