Today, instead of discussing geological models, we will see an example of their programming in the Jupyter Notebook environment in Python 3 and with the Pandas, NumPy, SciPy, XArray, Dask Distributed, Numba, VTK, PyVista, Matplotlib libraries. This is a fairly simple laptop with support for multithreading and the ability to run locally and in a cluster for processing big data, lazy computation and visual 3D visualization of the results. Indeed, I've tried to put together a whole bunch of complex technical concepts and keep them simple. To create a cluster on Amazon AWS, see the AWS Init script for Jupyter Python GIS processing to create a set of instances and run the resource scheduler on the master instance at once.
Visualization with the Visualization Toolkit (VTK) and PyVista is no longer Matplotlib
, , , , ( ) . -, Python , . , , , , . , , , — , . — ( ) , , , . , Python , . , . PyVista VTK — Visualization Toolkit, … , ParaView N-Cube ParaView plugin for 3D/4D GIS Data Visualization, Python + VTK.
GitHub basic.ipynb , , . dask , . AWS Init script for Jupyter Python GIS processing . NumPy, , , , XArray NumPy (object.values). NumPy , Numba (, 15%):
from numba import jit
@jit(nopython=True, parallel=True)
def delta_grav_vertical(delta_mass, x, y, z):
G=6.67408*1e-11
return -np.sum((100.*1000)*G*delta_mass*z/np.power(x**2 + y**2 + z**2, 1.5))
(, , ) :
def forward_gravity(da):
(da_y, da_x, da_z) = xr.broadcast(da.y, da.x, da.z)
deltagrav = lambda x0, y0: delta_grav_vertical(da.values.ravel(), (da_x.values.ravel()-x0), (da_y.values.ravel()-y0), (da_z.values.ravel()-0))
gravity = xr.apply_ufunc(deltagrav, da_x.isel(z=0).chunk(50), da_y.isel(z=0).chunk(50), vectorize=True, dask='parallelized')
...
xarray.broadcast ravel() x, y, z . da_x.isel(z=0) da_y.isel(z=0) x, y , (, , .. ). xarray.apply_ufunc() dask deltagrav. , XArray , dask dask , da_x.isel(z=0).chunk(50) da_y.isel(z=0).chunk(50), 50 x, y ( ). , — chunk() XArray , dask .
, dask- (), forward_gravity() , , load(). , , . , NetCDF — , . , . , dask , "".
. . , ( ), . , . ( ).
In conclusion, I invite everyone to visit the GitHub repositories with a variety of geological models and their visualization in Blender and ParaView, as well as examples of various analyzes. Also see ready-made visualizations on the YouTube channel .