I am trying to plot fault planes and epicenters. I was thinking that this would be a nice exercise to learn paraview. My basic process is to create CSV files of the fault coordinates. I then wrote paraview script to take all of these and create Delaunay2D surfaces of the faults. Here is the script:
from pathlib import Path
from paraview.simple import *
root = Path(__file__).parent
table = CSVReader(FileName=str(root / 'data/events.csv'), guiName='Events')
pts = TableToPoints(table, XColumn='easting', YColumn='northing', ZColumn='depth')
Show()
dp = GetDisplayProperties(pts)
dp.Representation = 'Point Gaussian'
for fpath in (root / 'exported').glob('source-*.csv'):
table = CSVReader(FileName=str(fpath), guiName=fpath.stem)
pts = TableToPoints(table, XColumn='easting', YColumn='northing', ZColumn='depth')
surf = Delaunay2D(pts)
surf.ProjectionPlaneMode = 'Best-Fitting Plane'
Show()
renderView = GetActiveView()
ag = renderView.AxesGrid
ag.Visibility = 1
ag.XTitle = 'Easting (km)'
ag.YTitle = 'Northing (km)'
ag.ZTitle = 'Depth (km)'
ResetCamera()
Render()
And the resulting output:
I have a few questions/comments:
- Is there a better way to create the faults? At the surface, the triangulation fills in areas when the faults curve. I was thinking I might be able to put all of the faults into one file.
- The current approach creates a pretty complicated Pipeline. Is there a good way to create a tree view or group sources and filters? I see this is done when I do things manually, but not programmatically.
- I can adjust the size epicenters (spheres) by “Use Scale Array” and selecting “magnitude”, but I couldn’t figure out how to do this via the Python interface. How do people usually figure how the relationship between the buttons and the Python?