Boundary class#
- class fracability.Entities.Boundary(gdf: GeoDataFrame = None, csv: str = None, shp: str = None, group_n: int = 1, check_geometry: bool = False)#
Base entity for boundaries, represents all the boundaries 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
group_n (int) – Boundary 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.
- 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
- 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='red', return_plot=False, show_plot=True)#
Plot Boundary object with matplotlib :param linewidth: :param color: :param return_plot: :param show_plot: :return:
- 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 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='red', color_set=False, return_plot=False, show_plot=True, notebook=True)#
Plot Boundary object with vtk :param linewidth: :param color: :param color_set: :param return_plot: :param show_plot: :return: