../../_images/logo.png

Fractures class#

class fracability.Entities.Fractures(gdf: GeoDataFrame = None, csv: str = None, shp: str = None, set_n: int = None, check_geometry: bool = False)#

Base entity for fractures, represents all the fractures in the network.

Parameters:
  • gdf (GeoDataFrame) – Use as input a geopandas dataframe

  • csv (str) – Use as input a csv indicated by the path

  • shp (str) – Use as input a shapefile indicated by the path

  • set_n (int) – Fracture set number.

  • check_geometry (Bool) – Perform geometry check. Default is False

Notes

  • The csv needs to have a “geometry” column. If missing the import will fail.

  • If the input csv or shapefile has an f_set column then the set_n will be ignored

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_geometries(remove_dup=True, save_shp=False)#

Method used to check if 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

  • save_shp – Save in the same folder of the input shp with only the geometries that need to be corrected. This is a useful support file to be imported in gis to quickly find the problematic geometries. False by default. todo to be implemented

property crs: str#

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 get_copy#

Property used to return a deep copy of the entity

Returns:

mat_plot(linewidth=1, color='black', color_set=False, return_plot=False, show_plot=True)#

Plot fracture object with matplotlib

Parameters:
  • linewidth

  • color

  • color_set

  • return_plot

  • show_plot

Returns:

property name: str#

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

network_object() Graph#

Each entity can be represented with a networkx graph. This returns the network object using the vtk object (and so the df).

Getter:

Returns a networkx Graph object

Setter:

Sets a Graph object

Type:

pyvista Graph

Notes

When the get method is applied the Graph is build on the fly using the object and so the entity_df.

remove_double_points()#

Utility used to clean geometries with double points

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

Save the entity df as csv

Parameters:
  • index (Bool) – Indicate whether to include or not the index column

  • sep (String) – Indicate the separator string used to save the csv

  • path (String) – Indicate the path in where to save the csv. DO NOT include the extension (.csv).

Notes

The csv will be saved in the output/csv directory in the indicated path in the working directory. If this path does not exist, then it will be created.

save_shp(path: str)#

Save the entity df as shapefile

Parameters:

path (String.) – Indicate the path in where to save the csv. DO NOT include the extension (.shp).

Notes

The shapefile will be saved in output/shp directory in the indicated path in the working directory. If this path does not exist, then it will be created.

property set_n: int#

Get the set number

property vtk_object: PolyData#

Each entity can be represented with a vtk object. This returns a Pyvista PolyData object representing the entity_df.

Getter:

Returns a Pyvista PolyData object

Setter:

Sets a generic Pyvista DataSet

Type:

pyvista PolyData

Notes

When the get method is applied the PolyData is build on the fly using the entity_df as a source.

When set the DataSet is cast to a PolyData.

vtk_plot(linewidth=1, color='black', color_set=False, return_plot=False, show_plot=True, display_property: str = None, notebook=True)#

Plot fracture object with VTK :param linewidth: :param color: :param color_set: :param return_plot: :param show_plot: :param display_property: :return: