../../_images/logo.png

FractureNetwork class#

class fracability.Entities.FractureNetwork(gdf: GeoDataFrame = None, csv: str = None)#

Fracture network base entity. Fracture networks are defined by one or more:

  • Fracture base entities

  • Boundary base entities

  • Nodes base entities

All the data is represented in the entity_df and the different objects are defined by the ‘type’ column.

FractureNetwork objects can be created in two ways depending on how the dataset is structured.

1. If fractures and boundaries and nodes are saved in different shp files then use the add_fracture,add_boundary and add_nodes methods on an empty FractureNetwork object.

2. If fractures and boundaries and nodes are saved in a single shp the geopandas dataframe can be directly fed when instantiating the class. In this case a type column must be set to indicate of which type the geometries are

activate_boundaries(group_n: list = None)#

Method that activates the boundary provided in the group_n list. :param group_n: List of groups to be activated

activate_fractures(set_n: list = None)#

Method that activates the fractures provided in the set_n list. :param set_n: List of sets to be activated

activate_nodes(node_type: list = None)#

Method that activates the nodes provided in the node_type list. :param node_type: List of node types to be activated

add_boundaries(boundary: Boundary = None)#

Method used to add boundary components to the fracture network Dataframe :param boundary: Boundary object to be added

Notes

The boundary are added to the fracture network dataframe using the assigned group_n present in the Boundary object dataframe. If the group is already present the boundary object will be overwritten if not it will be appended

add_fractures(fractures: Fractures = None)#

Method used to add fracture components to the fracture network Dataframe :param fractures: Fracture object to be added

Notes

The fractures are added to the fracture network dataframe using the assigned fracture_set present in the Fracture object dataframe. If the set is already present the fracture object will be overwritten if not it will be appended

add_nodes(nodes: Nodes = None)#

Method used to add nodes components to the fracture network Dataframe :param nodes: Nodes object to be added

Notes

The nodes are added to the fracture network dataframe using the assigned node_type present in the Nodes object dataframe. If the node type is already present the node object will be overwritten if not it will be appended

add_nodes_from_dict(node_dict, classes=None, origin_dict: dict = None)#

Add nodes a dict of shapely geometry (key), classes and optionally node origin (value).

Parameters:
  • node_dict – Dict of shapely node geometries as keys and a list (class, node_index).

  • classes – List of node classes that are needed to be added. If none are provided all the classes are used [1, 3, 4, 5, 6]

  • origin_dict – Dict of shapely node geometries as keys and a list of node origin.

property backbone#

Property that returns a Fractures entity object of the backbone. :return: Fracture entity object

backbone_plot(method='vtk', fracture_linewidth=1, boundary_linewidth=1, fracture_color='black', boundary_color='red', return_plot=False, show_plot=True, notebook=True)#

Method used to plot the fracture network using vtk :return:

property boundaries: Boundary#

Property that returns a Boundary entity object of all the active boundary groups. :return: Boundary entity object

boundary_object(group_n: int) Boundary#

Method that returns the Node object of a given group_number :param group_n: Number of the group :return: Boundary object

calculate_backbone(biggest_region=True)#

Calculate the backbone(s) of the network and add the calculated nodes to the network.

Parameters:

biggest_region – Output only most connected region. Default is True

calculate_topology(clean_network=True, only_boundary=False)#

Calculate the topology of the network and add the calculated nodes to the network.

Parameters:
  • clean_network – If true, before calculating the topology the network is cleaned with the clean_network. Default is True

  • only_boundary – Apply cleaning only on the fractures intersecting the boundary

center_object(trans_center: array = None, return_center: bool = False, inplace: bool = True)#

Method used to center the center of an Entity object to a given point. If no point is specified then the object will be moved to the origin (0,0,0).

Parameters:
  • obj (Boundary, Fractures, FractureNetwork) – A fracability entity object

  • trans_center (array) – Point to which translate the object

  • return_center (bool) – Bool flag to specify to return the translation center

  • inplace (bool) – Bool flag to specify if the operation overwrites the entity or creates a new instance

Returns:

  • trans_center (array) – Point of translation. If trans_center is not specified in the output then this will return the center of the object

  • copy_obj (object) – Copy of the modified input object (preserves the original input)

property centroid: ndarray#

Property used to return the centroid of the entity. Dissolve is used to aggregate each shape in a single entity.

Returns:

1D numpy array of the centroid

check_network(check_single=True, save_shp=None)#

Method used to check if network-wide the geometries are correct i.e.: + No repeating points + No overlaps

By default, the method will return a list of geometries that need to be fixed. Additionally, a shp file can be saved with only the geometries that need to be corrected.

Parameters:
  • remove_dup – Automatically remove duplicate points. By default, True. When false, a point shapefile where double points are present will be saved

  • check_single – Perform check also for the single components

  • save_shp – Path to save the shp of the check. If check_single is true then also the results of the single component check will be saved.

clean_network(buffer=0.05, inplace=True, only_boundary=False)#

Tidy the intersection of the active entities in the fracture network. A buffer is applied to all the geometries to ensure intersection in a given radius.

Parameters:
  • only_boundary – Apply cleaning only on the fractures intersecting the boundary

  • buffer – Applied buffer to the geometries of the entity.

  • inplace – If true automatically replace the network with the clean one, if false then return the clean geopandas dataframe. Default is True

property crs#

Property used to return the crs of the entity

Returns:

Name of the coordinate system as a string

property entity_df#

Each entity is based on a geopandas dataframe. This property returns or sets the entity_df of the given entity.

Getter:

Returns the GeoDataFrame

Setter:

Sets the GeoDataFrame

Type:

GeoDataFrame

Notes

When set, the dataframe is modified to conform to the assigned entity structure.

property fraction_censored: float#

Get the fraction of censored fractures in the network

fracture_network_to_components_df() DataFrame#

Method used to return the fracture network as a single geopandas dataframe. :return: Geopandas DataFrame of the whole fracture network

fracture_object(set_n: int) Fractures#

Method that returns the Fracture object of a given set :param set_n: Number of the set :return: Fracture object

property fractures: Fractures#

Property that returns a Fracture entity object of all the active fracture sets. :return: Fracture entity object

property get_copy#

Property used to return a deep copy of the entity

Returns:

is_group_active(group_n: int) bool#

Method used to return if a given boundary group is active in the fracture network :param group_n: set to check :return: Bool value of the test

is_set_active(set_n: int) bool#

Method used to return if a given fracture set is active in the fracture network :param set_n: set to check :return: Bool value of the test

is_type_active(node_type: int) bool#

Method used to return if a given node type is active in the fracture network :param node_type: node type to check :return: Bool value of the test

mat_plot(markersize=5, fracture_linewidth=1, boundary_linewidth=1, fracture_color='black', boundary_color='red', color_set=False, show_plot=True, return_plot=False)#

Method used to plot the fracture network using matplotlib :param markersize: :param fracture_linewidth: :param boundary_linewidth: :param fracture_color: :param boundary_color: :param color_set: :param show_plot: :param return_plot: :return:

property name: str#

Property used to return the name of the current class as a string.

network_object() Graph#

Method used to return a networkx Graph representation of the fracture network :return: Graph of the fracture network

property nodes: Nodes#

Property that returns a Node entity object of all the active nodes. :return: Nodes entity object

nodes_object(node_type: int) Nodes#

Method that returns the Node object of a given node_type :param node_type: Type of the node :return: Nodes object

remove_double_points()#

Utility used to clean geometries with double points

save_csv(path: str, sep: str = ',', index: bool = False)#

Save the fracture network entity df as csv :param index: :type sep: object :param path: :return:

save_shp(path: str)#

Save the entity df as shp :param path: :return:

property sets: list#

Return the list of the number of sets

ternary_plot()#

Method used to plot the ternary diagram of the fracture network :return:

vtk_object(include_nodes: bool = True) PolyData#

Method used to return a vtkPolyData representation of the fracture network :param include_nodes: Bool flag used to control if include or not the nodes in the fracture network object :return: vtkPolyData of the fracture network

vtk_plot(markersize=5, fracture_linewidth=1, boundary_linewidth=1, fracture_color='black', boundary_color='red', color_set=False, show_plot=True, return_plot=False, notebook=True)#

Method used to plot the fracture network using vtk :param markersize: :param fracture_linewidth: :param boundary_linewidth: :param fracture_color: :param boundary_color: :param color_set: :param show_plot: :param return_plot: :return: