DataFusionTools.d_series_parser
Contents
DataFusionTools.d_series_parser#
DataFusionTools.clustering module#
- class datafusiontools.d_series_parser.clustering.ClusteringLayers(points: Union[List, None, numpy.array] = None, normalized_points: Union[List, None, numpy.array] = None, clusters: Union[List, None, numpy.array] = None, global_polygon_list: Union[List, None, numpy.array] = None, simplified_polygons: Union[List, None, numpy.array] = None, extracted_value_per_polygon: Union[List, None, numpy.array] = None, extracted_std_per_polygon: Union[List, None, numpy.array] = None)[source]#
Bases:
datafusiontools._core.base_class.BaseClass
Class that clusters points with a certain value to a polygon list
- Parameters
points – List of initial points
normalized_points – List of normalized points
clusters – Clusters of points after the analysis
global_polygon_list – Created polygon list with a dense points in edges
extracted_value_per_polygon – Value extracted per polygon
extracted_std_per_polygon – Std extracted per polygon
- cluster_2d_surface_agglomerative_clusterin(points: numpy.ndarray, cluster_variables: List[str], spatial_connectivity_methods: Any, k_candidates: int = 10, run_dash_app: bool = False)[source]#
Function that clusters a surface depending on the x, y coordinates and the values given by the user.
- Parameters
points – list of x,y locations along with the value that will facilitate the clustering
k_candidates – number of k means candidates
run_dash_app – value that determines if the user want to run a dash application with an evaluation of the
clustering :param cluster_variables: List of variables to cluster with these can be [“x”, “y”, “value”] :param spatial_connectivity_methods: Spatial weights as defined in the libpysal library (for more information https://pysal.org/libpysal/api.html)
:returns list of clustered polygons
- cluster_with_schc_method(n_of_clusters: int, encopassing_shape: shapely.geometry.polygon.Polygon, cluster_variables: List[str], spatial_connectivity_methods: Any) pandas.core.frame.DataFrame [source]#
Function that clusters points based on the Spatially Constrained Hierarchical Clustering method. More on that method can be read on https://geographicdata.science/book/notebooks/10_clustering_and_regionalization.html
- Parameters
n_of_clusters – Number of clusters that are required
encopassing_shape – 2D slice encopassing shape
cluster_variables – List of variables to cluster with these can be [“x”, “y”, “value”]
spatial_connectivity_methods – Spatial weights as defined in the libpysal library (for more information https://pysal.org/libpysal/api.html)
- clusters: Union[List, None, numpy.array] = None#
- denormalise_coordinates(x: List, y: List)[source]#
Denormalize point data with the min max technique.
- Parameters
x – List of x coordinates
y – List of y coordinates
- Returns
De-normalized tuple of (x, y) coordinates
- evaluation_plots(polygons_dataframe)[source]#
Function that creates evaluation plots as a Dash app for the 2D clustering method.
- Parameters
polygons_dataframe – Dataframe with the clustered polygons
- extracted_std_per_polygon: Union[List, None, numpy.array] = None#
- extracted_value_per_polygon: Union[List, None, numpy.array] = None#
- get_encompassing_shape() shapely.geometry.polygon.Polygon [source]#
Function that gets the encompassing shape of a geometry.
- get_index_of_polygon_list(poly: shapely.geometry.polygon.Polygon, polygon_list: List[shapely.geometry.polygon.Polygon])[source]#
Function that returns the index of a polygon if it part of a list
- Parameters
poly – Polygon that the function will search for
polygon_list – List of polygons that for the index to be found
- Returns
the index that the polygon corresponds to
- get_value_per_polygon()[source]#
Function that calculates values and standard deviation per polygon.
- global_polygon_list: Union[List, None, numpy.array] = None#
- intersect_all_polygon_combinations(polygon_list: List[shapely.geometry.polygon.Polygon]) List[shapely.geometry.polygon.Polygon] [source]#
Function that intersects all every polygon in a list with all other polygons.
- Parameters
polygon_list – List of shapely polygons.
- normalized_points: Union[List, None, numpy.array] = None#
- points: Union[List, None, numpy.array] = None#
- simplified_polygons: Union[List, None, numpy.array] = None#
- datafusiontools.d_series_parser.clustering.alpha_shape(points, alpha, only_outer=True) set [source]#
Compute the alpha shape (concave hull) of a set of points.
- Parameters
points – np.array of shape (n,2) points.
alpha – alpha value.
only_outer – boolean value to specify if we keep only the outer border or also inner edges.
- Returns
set of (i,j) pairs representing edges of the alpha-shape. (i,j) are the indices in the points array.
DataFusionTools.d_stability_parser module#
- class datafusiontools.d_series_parser.d_stability_parser.DStabilityModel[source]#
Bases:
object
Class that creates a D-Stability model.
- static create_model(polygon_list: List, filename: str, soil_list: Optional[List] = None)[source]#
Function that creates and saves a D-Stability model based on a polygon list.
- Parameters
polygon_list – List of shapely polygons
filename – Name of D-Stability file that is serialized.
polygon_list – List of shapely polygons
filename – Name of D-Stability file that is serialized
- Returns
A geolib D-Stability model