# Now that you have the topography and a grid data set, # let's go ahead and use the **Extract Topography** filter. Be sure to properly # select the inputs to the algorithm. extracted = ExtractTopography().apply(mesh, topo) extracted.plot(scalars='Extracted') ############################################################################### # op='underneath', tolerance=0.001, offset=0.0, invert=False, remove=False # This will show the cells that are active underneath the topography surface # (0 for above surface and 1 for below surface). Now we can threshold this gridded # data set to remove parts of the model that are above the topography surface by # applying a *Threshold* filter to chop out all values below 1. # # The resulting grid with cells above the topography extracted will look like the # rendering below: threshed = extracted.threshold(0.5) threshed.plot(color=True, show_edges=True) ############################################################################### # How well did this remove cells above the topography surface? p = pyvista.Plotter() p.add_mesh(topo, cmap='terrain') p.add_mesh(threshed, color=True, show_edges=True) p.show_grid() p.show() ############################################################################### # Is that extraction too close to the topography surface? To better extract the # topographic surface, you can set a tolerance: extracted = ExtractTopography(tolerance=100., remove=True).apply(mesh, topo)
# Now that you have the topography and a grid data set, # let's go ahead and use the **Extract Topography** filter. Be sure to properly # select the inputs to the algorithm. extracted = ExtractTopography().apply(mesh, topo) extracted.plot(scalars="Extracted") ############################################################################### # op='underneath', tolerance=0.001, offset=0.0, invert=False, remove=False # This will show the cells that are active underneath the topography surface # (0 for above surface and 1 for below surface). Now we can threshold this gridded # data set to remove parts of the model that are above the topography surface by # applying a *Threshold* filter to chop out all values below 1. # # The resulting grid with cells above the topography extracted will look like the # rendering below: threshed = extracted.threshold(0.5, scalars="Extracted") threshed.plot(color=True, show_edges=True) ############################################################################### # How well did this remove cells above the topography surface? p = pyvista.Plotter() p.add_mesh(topo, cmap="terrain") p.add_mesh(threshed, color=True, show_edges=True) p.show_grid() p.show() ############################################################################### # Is that extraction too close to the topography surface? To better extract the # topographic surface, you can set a tolerance: extracted = ExtractTopography(tolerance=100.0, remove=True).apply(mesh, topo)