
Quickstart for FracAbility#
Installation and upgrading#
If you are new to using Python, you will first need to install a Python 3 interpreter and also install an IDE so that you can interact with the code. There are many good IDEs available including Pycharm, Spyder and Jupyter.
Once you have Python installed, to install fracability for the first time, open your command prompt and type:
pip install fracability
To upgrade a previous installation of reliability to the most recent version, open your command prompt and type:
pip install --upgrade fracability
A quick example#
A key feature of fracability is that Entities and functions are designed to be used in a modular way. This allows flexibility for different workflows in which not all tools need to be used.
In this example, we will quickly illustrate a typical workflow to:
Create a FractureNetwork object and define its intersections
Visualize the data
Analyze the length statistics
Create a FractureNetwork entity#
import geopandas as gpd
import pyvista as pv
from fracability import Entities
n_path = 'fracability/datasets/Fracture_network.shp'
b_path = 'fracability/datasets/Interpretation_boundary_laghettoSalza.shp'
frac_gpd = gpd.read_file(n_path)
bound_gpd = gpd.read_file(b_path)
fractures = Entities.Fractures(frac_gpd)
boundaries = Entities.Boundary(bound_gpd)
fracture_net = Entities.FractureNetwork()
fracture_net.add_fractures(fractures)
fracture_net.add_boundaries(boundaries)
These steps create a fracture network entity composed by the fractures and the interpretation boundaries. We now need to identify the common nodes and define how many segments are connected to each node. This can be done using a couple of specific functions
from fracability.geometric_operations import tidy_intersections
from fracability.clean_operations import connect_dots
from fracability.topology_operations import nodes_conn
tidy_intersections(fracture_net) #tidy shapefile intersections
connect_dots(fracture_net) #merge overlapping nodes
nodes_conn(fracture_net) #calculate topological adjacency (number of segments per node)
In these few lines we:
Cleaned and tidied the intersections between fractures (F-F) and boundaries (F-B)
Defined common nodes
Calculated the number of segments connected to each node
Visualize the network#
The fracture network entity can be visualized in different ways.
We can view the geopandas dataframe, functioning as the database.
We can plot the object in a 3D window using pyvista/vtk
We can plot the object in a 2D window using matplotlib
We can visualize the topological network (not recommended for big fracture networks).
print(fracture_net.fractures.entity_df)
"""
"""
nodes = fracture_net.nodes.vtk_object
nodes.set_active_scalars('class_id')
plotter = pv.Plotter()
plotter.add_mesh(fracture_net.vtk_object, color='white')
plotter.add_mesh(nodes, render_points_as_spheres=True, point_size=10)
plotter.view_xy()
plotter.show()