Nodes class#
- class fracability.Entities.Nodes(gdf: GeoDataFrame = None, csv: str = None, shp: str = None, node_type: int = -9999)#
Node base entity, represents all the nodes 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
node_type (int) – Node type. I:1, Y:3, X:4, U:5
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: GeoDataFrame#
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(markersize=7, return_plot=False, show_plot=True)#
Plot Nodes object with matplot :param markersize: :param return_plot: :param show_plot: :return:
- property n_censored: int#
Return the number of censored nodes
- property n_complete: int#
Return the number of I nodes
- 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.
- property node_count: dict#
Calculate the node count dictionary
- Returns:
A dictionary of nodes and their count
- node_origin(node_type: int) GeoSeries#
Return the node origin for the given node type (i.e. which set/sets is/are associated to the node) :param node_type: :return:
- 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 ternary_node_count: tuple[float, float, float, float, float]#
Calculate the node proportions and precise connectivity value following Manzocchi 2002 :return: A tuple of values PI, PY, PX, PU, CI
- ternary_plot()#
- 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(markersize=7, return_plot=False, show_plot=True, notebook=True)#
Plot Nodes object with VTK :param markersize: :param return_plot: :param show_plot: :return: