-
Notifications
You must be signed in to change notification settings - Fork 74
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
A new tutorial for Field.mesh()
#93
Comments
Field.mesh
Field.mesh()
You are totally right! I'll take a look at this next week. |
It'd be awesome to have this tutorial use PyVista 😉 |
Why not provide 2 or more tutorials? - Maybe you already have something like a minimal working example? |
ogs5py has its own tutorial: https://geostat-framework.readthedocs.io/projects/ogs5py/en/stable/tutorial_02_pump.html |
Even though this issue has been already closed, what I am still missing is a tutorial with the Calling the Inspired by the example for discrete fields, this is how I got it to work: import gstools as gs
import pyvista as pv
dim, spacing = (30, 20, 10), (.1, .1, 0.1)
grid = pv.UniformGrid(dim, spacing)
model = gs.Gaussian(dim=3, len_scale=[2, 1, 0.1])
srf = gs.SRF(model, seed=19970221)
srf.mesh(grid, points="points", name="random-field") # stores "random-field" scalar array in the `grid` object
vals = np.linspace(np.min(srf.field), np.max(srf.field), 5)
srf.transform("discrete", field="field", store="discrete", values=vals) # stores "discrete" field in `srf` object
grid['discrete'] = srf['discrete'] # copies data from `srf` to `grid`
plotter = pv.Plotter(window_size=(800, 600))
plotter.background_color = 'gray'
plotter.enable_anti_aliasing()
plotter.add_mesh(grid, scalars="discrete", show_edges=True)
plotter.show() Result: Is this how those two APIs are supposed to be used together? It would make sense to call |
Just a drive-by thought/comment: After calling, I also want to give a plug for an example I put together here: https://banesullivan.com/pyvista/examples/kriging.html |
Kudos for that link to your blog website! Looks fantastic. Added to my reading list. |
As @banesullivan pointed out, you can add more fields afterwards. Closing this for now. If you have further ideas on how to improve the interoperability, just open another issue or discussion. |
We should add a tutorial showing how to use the
Field.mesh
method to generate random fields on pre-existing meshes.The text was updated successfully, but these errors were encountered: