fracture_analysis_2d.fracture_analysis_kit package¶
Submodules¶
fracture_analysis_2d.fracture_analysis_kit.analysis_and_plotting module¶
Handles analysis and plotting using a MultiTargetAreaAnalysis class. Analysis (i.e. heavy calculations) and plotting have been separated into two different methods.
-
class
fracture_analysis_2d.fracture_analysis_kit.analysis_and_plotting.
MultiTargetAreaAnalysis
(layer_table_df, plotting_directory, analysis_name, group_names_cutoffs_df, set_df, choose_your_analyses, logger)¶ Bases:
object
-
analysis
()¶ Method that runs analysis i.e. heavy calculations for trace, branch and node data.
-
plot_results
()¶ Method that runs plotting based on analysis results for trace, branch and node data.
-
fracture_analysis_2d.fracture_analysis_kit.main module¶
Main module for the control of analysis and plotting.
-
fracture_analysis_2d.fracture_analysis_kit.main.
initialize_analysis_logging
(plotting_directory)¶ Initializes a logger that collects all analysis statistics some of which are not drawn onto the finished plots.
- Parameters
plotting_directory (str) – The logger file is saved into the plotting_directory
- Returns
- Return type
-
fracture_analysis_2d.fracture_analysis_kit.main.
main_multi_target_area
(layer_table_df, results_folder, analysis_name, group_names_cutoffs_df, set_df, choose_your_analyses)¶ Main method for firstly initializing data analysis, then starting data analysis, and then starting plotting of analysis results. Also initializes plotting directories, debugging methods and the plotting config parameters.
- Parameters
layer_table_df (pandas.DataFrame) – DataFrame with trace, branch, node, etc. vector layer data.
results_folder (str) – Path to folder in which plots_{analysis_name} folder will be built to and where plots will be saved to.
analysis_name (str) – Name for the analysis. Will be used in the plots_{analysis_name} folder name.
group_names_cutoffs_df (pandas.DataFrame) – DataFrame with group name and cut-off data for both traces and branches.
set_df (pandas.DataFrame) – DataFrame with set names and ranges.
- Returns
Returns analysis object.
- Return type
taaq.MultiTargetAreaAnalysis
fracture_analysis_2d.fracture_analysis_kit.multiple_target_areas module¶
Handles multiple given target areas and makes groups of them based on user inputs using a MultiTargetAreaQGIS class. MultiTargetAreaQGIS-objects are made separately for trace and branch data. Both contain the same node data.
-
class
fracture_analysis_2d.fracture_analysis_kit.multiple_target_areas.
MultiTargetAreaQGIS
(table_df, gnames_cutoffs_df, branches, logger)¶ Bases:
object
-
calc_anisotropy
(unified: bool)¶
-
calc_attributes_for_all
()¶ Calculates attributes for all target areas.
-
calc_curviness_for_all
(use_branches_anyway=False)¶
-
create_setframes_for_all_unified
()¶
-
define_sets_for_all
(set_df)¶ Categorizes data based on azimuth to sets.
- Parameters
set_df (DataFrame) – DataFrame with sets. Columns: “Set”, “SetLimits”
-
determine_crosscut_abutting_relationships
(unified: bool)¶ Determines cross-cutting and abutting relationships between all inputted sets by using spatial intersects between node and trace data. Sets result as a class parameter self.relations_df that is used for plotting.
- Parameters
unified (bool) – Calculate for unified datasets or individual target areas
- Raises
AssertionError – When attempting to determine cross-cutting and abutting relationships from branch data or if self.using_branches is True even though you are using trace data.
ValueError – When there’s only one set defined. You cannot determine cross-cutting and abutting relationships from only one set.
-
gather_topology_parameters
(unified: bool)¶ Gathers topological parameters of both traces and branches
- Parameters
unified (bool) – Use unified datasets or individual target areas
- Returns
- Return type
-
static
plot_anisotropy
(using_branches: bool, unified: bool, frame, save=False, savefolder='')¶ Plot anisotropy of connectivity
- Parameters
using_branches (bool) – Check to make sure branch data is used
unified (gpd.GeoDataFrame) – Plot unified datasets or individual target areas
frame – GeoDataFrame with data
save (bool) – Whether to save
savefolder (str) – Folder to save to
-
plot_azimuths
(unified: bool, rose_type: str, save=False, savefolder='')¶ Plots azimuths.
- Parameters
unified (bool) – Plot unified datasets or individual target areas
rose_type (str) – Whether to plot equal-radius or equal-area rose plot e.g. ‘equal-radius’ or ‘equal-area’
save (bool) – Whether to save
savefolder (str) – Folder to save to
-
plot_azimuths_exp
(unified: bool, rose_type: str, save=False, savefolder='')¶ Plots azimuths.
- Parameters
unified (bool) – Plot unified datasets or individual target areas
rose_type (str) – Whether to plot equal-radius or equal-area rose plot e.g. ‘equal-radius’ or ‘equal-area’
save (bool) – Whether to save
savefolder (str) – Folder to save to
-
plot_azimuths_weighted
(unified: bool, save=False, savefolder='')¶
-
plot_branch_ternary
(unified: bool, save=False, savefolder='')¶ Plots Branch classification-ternary plots for target areas or grouped data.
- Parameters
unified (bool) – Plot unified datasets or individual target areas
save (bool) – Whether to save
savefolder (str) – Folder to save to
-
plot_crosscut_abutting_relationships
(unified: bool, save=False, savefolder='')¶ Plots cross-cutting and abutting relationships for individual target areas or for grouped data.
- Parameters
unified (bool) – Calculate for unified datasets or individual target areas
save (bool) – Save plots or not
savefolder (str) – Folder to save plots to
- Raises
TypeError – When attempting to determine cross-cutting and abutting relationships from branch data or if self.using_branches is True even though you are using trace data.
-
plot_curviness_for_unified
(violins=False, save=False, savefolder='')¶
-
plot_hexbin_plot
(unified: bool, save=False, savefolder='')¶ Plot a hexbinplot to estimate sample size differences.
- Parameters
unified – Plot unified datasets or individual target areas :type unified: bool :param save: Whether to save :type save: bool :param savefolder: Folder to save to :type savefolder: str :return: :rtype:
-
plot_length_fit_cut_ax
(ax, unified: bool)¶ Plots the numerical power-law fit to a cut length distribution to a given ax.
- Parameters
ax (matplotlib.axes.Axes) – ax to plot to.
unified (bool) – Whether to plot for target area or grouped data.
- Raises
ValueError – When there are too many values from np.polyfit i.e. values != 2.
-
plot_lengths
(unified: bool, save=False, savefolder='', use_sets=False)¶ Plots length distributions.
- Parameters
unified (bool) – Plot unified datasets or individual target areas
save (bool) – Whether to save
savefolder (str) – Folder to save to
use_sets (bool) – Whether to use sets
-
plot_topology
(unified: bool, save=False, savefolder='')¶ Plot topological parameters
- Parameters
unified (bool) – Plot unified datasets or individual target areas
save (bool) – Whether to save
savefolder (str) – Folder to save to
-
plot_xyi_ternary
(unified: bool, save=False, savefolder='')¶ Plots XYI-ternary plots for target areas or grouped areas.
- Parameters
unified (bool) – Plot unified datasets or individual target areas
save (bool) – Whether to save
savefolder (str) – Folder to save to
-
unified
()¶ Creates new datasets (TargetAreaLines + TargetAreaNodes for each group) based on groupings by user.
- Raises
ValueError – When there are groups without any target areas.
-
fracture_analysis_2d.fracture_analysis_kit.qgis_tools module¶
Contains tools relevant to QGIS layer transformations and plugin functionality.
-
fracture_analysis_2d.fracture_analysis_kit.qgis_tools.
df_to_gdf
(df, coord_system)¶ Converts pandas DataFrame to a GeoDataFrame along with setting the given coordinate system.
- Parameters
df (pd.DataFrame) – Pandas DataFrame with QGIS vector layer data.
coord_system (qgis.core.QgsCoordinateReferenceSystem) – Given coordinate system.
- Returns
Converted GeoDataFrame
- Return type
GeoDataFrame
-
fracture_analysis_2d.fracture_analysis_kit.qgis_tools.
layer_to_df
(layer)¶ Converts QGIS vector layer to a pandas DataFrame and extracts coordinate system from the layer.
- Parameters
layer (qgis.core.QgsVectorLayer) – QGIS vector layer.
- Returns
Converted pandas DataFrame and layer coord system.
- Rtypes
pd.DataFrame | qgis.core.QgsCoordinateReferenceSystem
-
fracture_analysis_2d.fracture_analysis_kit.qgis_tools.
layer_to_gdf
(layer)¶ Converts QGIS vector layer to a GeoDataFrame.
- Parameters
layer (qgis.core.QgsVectorLayer) – QGIS vector layer
- Returns
Converted GeoDataFrame
- Return type
GeoDataFrame
-
fracture_analysis_2d.fracture_analysis_kit.qgis_tools.
plotting_directories
(results_folder, name)¶ Creates plotting directories and handles FileExistsErrors when raised.
- Parameters
results_folder (str) – Base folder to create plots_{name} folder to.
name (str) – Analysis name.
- Returns
Newly made path to plotting directory where all plots will be saved to.
- Return type
str
fracture_analysis_2d.fracture_analysis_kit.target_area module¶
Handles a single target area or a single grouped area. Does not discriminate between a single target area and grouped target areas.
-
class
fracture_analysis_2d.fracture_analysis_kit.target_area.
TargetAreaLines
(lineframe, areaframe, name, group, using_branches: bool, cut_off_length=0)¶ Bases:
object
Class for a target area or a group of target areas that consists of lines (traces or branches) and interpretation areas for these lines. Additionally contains cut offs and calculates parameters for analysis and plotting, information whether the lines are traces or branches and the name for the target area. The name parameter acts as the unique indicator to differentiate these objects. Duplicate target area or group names are therefore not allowed.
-
static
calc_anisotropy
(lineframe_main)¶ Calculates annisotropy of connectivity for branch DataFrame
-
calc_attributes
()¶ Calculates important attributes of target area.
-
calc_curviness
()¶
-
define_sets
(set_df)¶ Categorizes both non-cut and cut DataFrames with set limits.
- Parameters
set_df (pd.DataFrame) – DataFrame with set limits and set names.
-
static
plot_anisotropy_styled
(anisotropy, for_ax=False, ax=None)¶ Plots a styled anisotropy of connectivity figure.
Spline done with: https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.CubicSpline.html
- Parameters
for_ax (bool) – Whether plotting to a ready-made ax or not
ax (matplotlib.axes.Axes) – ax to plot to (optional)
-
plot_azimuth_ax_weighted
(set_visualization, ax, name, rose_type)¶ Plot weighted azimuth rose-plot to given ax. Type can be ‘equal-radius’ or ‘equal-area’.
- Parameters
set_visualization (bool) – Whether to visualize sets into the same plot
ax (matplotlib.projections.polar.PolarAxes) – Polar axis to plot on.
name (str) – Name of the target area or group
rose_type (str) – Type can be ‘equal-radius’ or ‘equal-area’
- Raises
ValueError – When given invalid rose_type string. Valid: ‘equal-radius’ or ‘equal-area’
-
plot_azimuth_weighted
(rose_type, set_visualization)¶ Plot weighted azimuth rose-plot. Type can be ‘equal-radius’ or ‘equal-area’.
- Parameters
rose_type (str) – Whether to plot equal-radius or equal-area rose plot: ‘equal-radius’ or ‘equal-area’
set_visualization (bool) – Whether to visualize sets into the same plot
-
plot_branch_ternary_plot
(unified: bool, color_for_plot='black', save=False, savefolder='')¶ Plot a branch classification ternary plot to a new ternary figure. Single point in each figure.
- Parameters
unified (bool) – Plot for target area or grouped data
color_for_plot (str or tuple) – Color for point in plot.
save (bool) – Save or not
savefolder (str) – Folder to save plot to
-
plot_branch_ternary_point
(tax, color_for_plot='black')¶ Plot a branch classification ternary scatter point to a given tax.
- Parameters
tax (ternary.TernaryAxesSubplot) – python-ternary AxesSubPlot
color_for_plot (str or tuple) – Color for point in plot.
-
plot_length_distribution
(unified: bool, color_for_plot='black', save=False, savefolder='', fit=None, fit_distribution='')¶ Plots a length distribution to its own figure.
- Parameters
unified (bool) – Is data from target area or grouped data?
color_for_plot (str or tuple) – Color for scatter plot points.
save (bool) – Whether to save
savefolder (str) – Folder to save to
-
static
plot_length_distribution_ax
(lineframe, name, ax, color_for_plot='black', normalize_for_powerlaw=False, powerlaw_cut_off=0)¶ Plots a length distribution to a given ax.
- Parameters
ax (matplotlib.axes.Axes) – Ax to plot to
color_for_plot (str or tuple) – Color for scatter plot points.
-
static
plot_length_distribution_fit
(fit: powerlaw.Fit, fit_distribution: str, ax: matplotlib.axes._axes.Axes)¶
-
plot_length_distribution_with_all_fits
(unified: bool, color_for_plot='black', save=False, savefolder='', fit=None, fit_distributions=[])¶ Plots a length distribution to its own figure along with powerlaw, lognormal and exponential fits.
- Parameters
unified (bool) – Is data from target area or grouped data?
color_for_plot (str or tuple) – Color for scatter plot points.
save (bool) – Whether to save
savefolder (str) – Folder to save to
-
topology_parameters_2d_branches
(branches=False)¶ Gather topology parameters for branch data.
- Parameters
branches (bool) – Branches or traces
- Raises
AttributeError – When given vector layer doesn’t contain valid column names. e.g. (Connection: [‘C - C’, ‘C - I’, …]
-
static
-
class
fracture_analysis_2d.fracture_analysis_kit.target_area.
TargetAreaNodes
(nodeframe, name, group)¶ Bases:
object
Class for topological nodes. Used in conjunction with TargetAreaLines.
-
static
plot_xyi_plot
(nodeframe, name, unified: bool, color_for_plot='black', save=False, savefolder='')¶ Plot a XYI-node ternary plot to a new ternary figure. Single point in each figure.
- Parameters
unified (bool) – Plot for target area or grouped data
color_for_plot (str or tuple) – Color for point.
save (bool) – Save or not
savefolder (str) – Folder to save plot to
-
static
plot_xyi_point
(nodeframe, name, tax, color_for_plot='black')¶ Plot a XYI-node ternary scatter point to a given tax.
- Parameters
tax (ternary.TernaryAxesSubplot) – python-ternary AxesSubPlot
color_for_plot (str or tuple) – Color for plotting point.
-
topology_parameters_2d_nodes
()¶ Gathers topology parameters of nodes
-
static
fracture_analysis_2d.fracture_analysis_kit.tools module¶
Contains calculation and plotting tools.
-
fracture_analysis_2d.fracture_analysis_kit.tools.
aniso_calc_anisotropy
(halved, c, length)¶ Calculates anisotropy of connectivity for a branch based on azimuth, classification and length. Value is calculated for preset angles (angles_of_study = np.arange(0, 179, 30))
E.g.
Anisotropy for a C-C classified branch:
>>> aniso_calc_anisotropy(90, 'C - C', 10) array([6.12323400e-16, 5.00000000e+00, 8.66025404e+00, 1.00000000e+01, 8.66025404e+00, 5.00000000e+00])
Other classification for branch:
>>> aniso_calc_anisotropy(90, 'C - I', 10) array([0, 0, 0, 0, 0, 0])
- Parameters
halved (float) – Azimuth of branch in range 0 - 180
c (str) – Branch classification
length (float) – Branch length
- Returns
Result is given for every angle of study (angles_of_study array from config.py-file)
- Return type
np.ndarray
-
fracture_analysis_2d.fracture_analysis_kit.tools.
aniso_get_class_as_value
(c)¶ Return value based on branch classification. Only C-C branches have a value, but this can be changed here. Classification can differ from (‘C - C’, ‘C - I’, ‘I - I’) (e.g. ‘C - E’) in which case a value is still returned.
E.g.
>>> aniso_get_class_as_value('C - C') 1
>>> aniso_get_class_as_value('C - E') 0
- Parameters
c (str) – Branch classification
- Returns
Value for classification
- Return type
float
-
fracture_analysis_2d.fracture_analysis_kit.tools.
avg_calc
(data)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
azimu_half
(degrees)¶ Transforms azimuths from 180-360 range to range 0-180
- Parameters
degrees (float) – Degrees in range 0 - 360
- Returns
Degrees in range 0 - 180
- Return type
float
-
fracture_analysis_2d.fracture_analysis_kit.tools.
azimuth_plot_attributes
(lineframe, weights=False)¶ Calculates azimuth bins for plotting azimuth rose plots.
Examples:
Non-weighted
>>> azimuth_plot_attributes(pd.DataFrame({'azimu': np.array([0, 45, 90]), 'length': np.array([1, 2, 1])})) array([33.33333333, 0. , 0. , 0. , 0. , 33.33333333, 0. , 0. , 0. , 33.33333333, 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 33.33333333, 0. , 0. , 0. , 0. , 33.33333333, 0. , 0. , 0. , 33.33333333, 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ])
Weighted
>>> azimuth_plot_attributes(pd.DataFrame({'azimu': np.array([0, 45, 90]), 'length': np.array([1, 2, 1])}), weights=True) array([25., 0., 0., 0., 0., 50., 0., 0., 0., 25., 0., 0., 0., 0., 0., 0., 0., 0., 25., 0., 0., 0., 0., 50., 0., 0., 0., 25., 0., 0., 0., 0., 0., 0., 0., 0.])
- Parameters
lineframe (pd.DataFrame) – DataFrame containing lines with azimu (and length columns)
weights (bool) – Whether to use weights for bins.
- Returns
bin_locs: Locations for each bin, number_of_azimuths: Frequency (length-weighted) of each bin
- Return type
tuple
-
fracture_analysis_2d.fracture_analysis_kit.tools.
azimuth_plot_attributes_experimental
(lineframe, weights=False)¶ Calculates azimuth bins for plotting azimuth rose plots. Uses HALVED azimuths (i.e. column ‘halved’ in lineframe)
- Parameters
lineframe (pd.DataFrame) – DataFrame containing lines with halved azimuth (and length) columns
weights (bool) – Whether to use weights for bins.
- Returns
bin_width: Azimuth bin array, bin_locs: Bin locs, number_of_azimuths: Azimuth bin frequency (length-weighted)
- Return type
tuple
-
fracture_analysis_2d.fracture_analysis_kit.tools.
calc_azimu
(line)¶ Calculates azimuth of given line.
e.g.: Accepts LineString
>>> calc_azimu(shapely.geometry.LineString([(0, 0), (1, 1)])) 45.0
Accepts MultiLineString
>>> calc_azimu(shapely.geometry.MultiLineString([((0, 0), (1, 1)), ((1, 1), (2, 2))])) 45.0
Returns np.nan when the line cannot be merged into one continuous line.
>>> calc_azimu(shapely.geometry.MultiLineString([((0, 0), (1, 1)), ((1.5, 1), (2, 2))])) nan
- Parameters
line (shapely.geometry.LineString | shapely.geometry.MultiLineString) – Continous line feature (trace, branch, etc.)
- Returns
Azimuth of line.
- Return type
float | np.nan
-
fracture_analysis_2d.fracture_analysis_kit.tools.
calc_cut_off_length
(lineframe_main, cut_off: float)¶ Calculates minimum length for distribution with a proportional cut-off value. Exact cut-off length is calculated using cut-off value and the maximum line length in distribution.
E.g.
>>> calc_cut_off_length(pd.DataFrame({'length': np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])}), 0.55) 4.5
>>> calc_cut_off_length(pd.DataFrame({'length': np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])}), 0.5) 5.0
- Parameters
lineframe_main (pd.DataFrame) – DataFrame with lengths
cut_off (float) – Proportional cut-off value in range [0, 1]
- Returns
Cut-off length
- Return type
float
-
fracture_analysis_2d.fracture_analysis_kit.tools.
calc_strike
(dip_direction)¶ Calculates strike from dip direction. Right-handed rule. Examples:
>>> calc_strike(50) 320
>>> calc_strike(180) 90
- Parameters
dip_direction (float) – Dip direction of plane
- Returns
Strike of plane
- Return type
float
-
fracture_analysis_2d.fracture_analysis_kit.tools.
calc_xlims
(lineframe)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
calc_y_distribution
(lineframe_main, area)¶ Calculates Complementary Cumulative Number (= y) for a length distribution and normalises the values based on target area size.
- Parameters
lineframe_main (pd.DataFrame) – DataFrame with lengths
area (float) – Area value
- Returns
DataFrame with y values calculated
- Return type
pd.DataFrame
-
fracture_analysis_2d.fracture_analysis_kit.tools.
calc_ylims
(lineframe)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
construct_length_distribution_base
(lineframe: geopandas.GeoDataFrame, areaframe: geopandas.GeoDataFrame, name: str, group: str, cut_off_length=1, using_branches=False)¶ Helper function to construct TargetAreaLines to a pandas DataFrame using apply().
-
fracture_analysis_2d.fracture_analysis_kit.tools.
construct_node_data_base
(nodeframe, name, group)¶ Helper function to construct TargetAreaNodes to a pandas DataFrame using apply().
-
fracture_analysis_2d.fracture_analysis_kit.tools.
create_azimuth_set_text
(lineframe)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
curviness
(linestring)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
curviness_initialize_sub_plotting
(filecount, ncols=4)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
define_set
(azimuth, set_df)¶ Defines set based on azimuth value in degrees. Uses halved azimuth values i.e. azimuth must be: 0 < azimuth < 180.
E.g. when azimuth is in set 1:
>>> define_set(50, pd.DataFrame({'Set': [1, 2], 'SetLimits': [(10, 90), (100, 170)]})) '1'
When azimuth isn’t within ranges:
>>> define_set(99, pd.DataFrame({'Set': [1, 2], 'SetLimits': [(10, 90), (100, 170)]})) '-1'
- Parameters
azimuth (float) – azimuth as float (degrees)
set_df (DataFrame) – DataFrame with set ranges and set names
- Returns
Set name based on azimuth
- Return type
str
-
fracture_analysis_2d.fracture_analysis_kit.tools.
get_azimu_statistics
(lineframe)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
get_intersect_frame
(intersecting_nodes_frame, traceframe, set_tuple)¶ Does spatial intersects to determine how abutments and crosscuts occur between two sets
E.g. where Set 2 ends in set 1 and Set 2 crosscuts set 1 (TODO: DECREPID)
>>> nodes = gpd.GeoDataFrame({'geometry': [Point(0, 0), Point(1, 1)], 'c': ['Y', 'X']}) >>> traces = gpd.GeoDataFrame(data={'geometry': [ ... LineString([(-1, -1), (2, 2)]), LineString([(0, 0), (-0.5, 0.5)]), LineString([(2, 0), (0, 2)])] ... , 'set': [1, 2, 2]}) >>> traces['startpoint'] = traces.geometry.apply(line_start_point) >>> traces['endpoint'] = traces.geometry.apply(line_end_point) >>> sets = (1, 2) >>> intersect_frame = get_intersect_frame(nodes, traces, sets) >>> intersect_frame node nodeclass sets error sets 0 POINT (0 0) Y NaN NaN (2, 1) 1 POINT (1 1) X NaN NaN (1, 2)
- Parameters
intersecting_nodes_frame (GeoDataFrame) – GeoDataFrame with X- and Y-nodes that intersect both sets. Contains columns: “c”, “geometry”
traceframe (GeoDataFrame) – GeoDataFrame of traces. Contains columns: “set”, “geometry”, “startpoint”, “endpoint”
set_tuple (tuple) – Sets used in the comparison
- Returns
DataFrame with intersect results. Contains columns: ‘node’, ‘nodeclass’, ‘sets’, ‘error’: (node = node as shapely.geometry.Point, nodeclass = classification, i.e. X or Y, sets = tuple (set 1, set 2), error = possible error results)
- Return type
DataFrame
-
fracture_analysis_2d.fracture_analysis_kit.tools.
get_nodes_intersecting_sets
(xypointsframe, traceframe)¶ Does a spatial intersect between node GeoDataFrame with only X- and Y-nodes and the trace GeoDataFrame with only two sets. Returns only nodes that intersect traces from BOTH sets.
E.g.
>>> p = gpd.GeoDataFrame(data={'geometry': [Point(0, 0), Point(1, 1), Point(3, 3)]}) >>> l = gpd.GeoDataFrame(data={'geometry': [LineString([(0, 0), (2, 2)]), LineString([(0, 0), (0.5, 0.5)])], 'set': [1, 2]}) >>> get_nodes_intersecting_sets(p, l) geometry 0 POINT (0.00000 0.00000)
- Parameters
xypointsframe (GeoDataFrame) – GeoDataFrame with only X- and Y-nodes
traceframe (GeoDataFrame) – Trace GeoDataFrame with only two sets
- Returns
GeoDataFrame with nodes that intersect traces from BOTH sets
- Return type
GeoDataFrame
-
fracture_analysis_2d.fracture_analysis_kit.tools.
initialize_ternary_branches_points
(ax, tax)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
initialize_ternary_points
(ax, tax)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
length_distribution_plot
(length_distribution)¶ Plots a length distribution plot.
- Parameters
length_distribution (TargetAreaLines) – TargetAreaLines Class
-
fracture_analysis_2d.fracture_analysis_kit.tools.
length_distribution_plot_sets
(length_distribution)¶ Plots a length distribution plot using sets.
- Parameters
length_distribution (TargetAreaLines) – TargetAreaLines Class
-
fracture_analysis_2d.fracture_analysis_kit.tools.
length_distribution_plot_with_fit
(length_distribution)¶ Plots a length distribution plot with fit.
- Parameters
length_distribution (TargetAreaLines) – TargetAreaLines Class
-
fracture_analysis_2d.fracture_analysis_kit.tools.
line_end_point
(line)¶ Determine the end point of a given shapely Line.
- Parameters
line –
- Returns
Point or np.NaN if unsuccessful.
- Return type
shapely.geometry.Point | numpy.NaN
-
fracture_analysis_2d.fracture_analysis_kit.tools.
line_start_point
(line)¶ Determine the start point of a given shapely Line.
- Parameters
line –
- Returns
Point or np.NaN if unsuccessful.
- Return type
shapely.geometry.Point | numpy.NaN
-
fracture_analysis_2d.fracture_analysis_kit.tools.
make_point_tree
(traceframe)¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
plot_azimuth_plot
(two_halves, weights=False)¶ Plots an azimuth plot using a bin array. Weighted or non-weighted.
- Parameters
two_halves (np.ndarray) – Azimuth bin array
weights (bool) – Whether to use weights for bins.
-
fracture_analysis_2d.fracture_analysis_kit.tools.
plot_curv_plot
(lineframe, ax=<matplotlib.axes._subplots.AxesSubplot object>, name='')¶
-
fracture_analysis_2d.fracture_analysis_kit.tools.
prepare_geometry_traces
(traceframe)¶ Prepare tracefrace geometries for a spatial analysis (faster). The try-except clause is required due to QGIS differences in the shapely package
- Parameters
traceframe –
- Returns
- Return type
-
fracture_analysis_2d.fracture_analysis_kit.tools.
report_powerlaw_fit_statistics
(name: str, fit: powerlaw.Fit, logger: logging.Logger, using_branches: bool)¶ Writes powerlaw module Fit object statistics to a given logfile. Included powerlaw, lognormal and exponential fit statistics and parameters.
- Parameters
name –
fit –
logger –
- Returns
- Return type
-
fracture_analysis_2d.fracture_analysis_kit.tools.
sd_calc
(data)¶ TODO: Wrong results atm. Needs to take into account real length, not just orientation of unit vector. Calculates standard deviation for radial data (degrees)
E.g.
>>> sd_calc(np.array([2, 5, 8])) 3.0
- Parameters
data (np.ndarray) – Array of degrees
- Returns
Standard deviation
- Return type
float
-
fracture_analysis_2d.fracture_analysis_kit.tools.
setup_ax_for_ld
(ax_for_setup, using_branches)¶ Function to setup ax for length distribution plots.
- Parameters
ax_for_setup (matplotlib.axes.Axes) – Ax to setup.
using_branches (bool) – Are the lines branches or traces.
-
fracture_analysis_2d.fracture_analysis_kit.tools.
tern_plot_branch_lines
(tax)¶ Plot line of random assignment of nodes to branches to a given branch ternary tax. Line positions taken from NetworkGT open source code. Credit to: https://github.com/BjornNyberg/NetworkGT
- Parameters
tax (ternary.TernaryAxesSubplot) – Ternary axis to plot to
-
fracture_analysis_2d.fracture_analysis_kit.tools.
tern_plot_the_fing_lines
(tax, cs_locs=(1.3, 1.5, 1.7, 1.9))¶ Plots connections per branch parameter to XYI-plot.
- Parameters
tax (ternary.TernaryAxesSubplot) – Ternary axis to plot to
cs_locs (tuple) – Pre-determined locations for lines
-
fracture_analysis_2d.fracture_analysis_kit.tools.
tern_yi_func
(c, x)¶ Function for plotting Connections per branch line to branch ternary plot. Absolute values.
- Parameters
c –
x –
- Returns
- Return type
-
fracture_analysis_2d.fracture_analysis_kit.tools.
unify_lds
(list_of_lds: list, group: str, cut_off_length: float)¶ Unifies/adds multiple TargetAreaLines objects together
- Parameters
list_of_lds (list) – List of TargetAreaLines objects
group (str) – Group name for the objects
cut_off_length (float) – Cut-off for the group objects.
- Returns
Unified TargetAreaLines object
- Return type
ta.TargetAreaLines
-
fracture_analysis_2d.fracture_analysis_kit.tools.
unify_nds
(list_of_nds: list, group: str)¶ Unifies/adds multiple TargetAreaNodes objects together
- Parameters
list_of_nds (list) – List of TargetAreaNodes objects
group (str) – Group name
- Returns
Unified TargetAreaNodes object
- Return type
ta.TargetAreaNodes
-
fracture_analysis_2d.fracture_analysis_kit.tools.
unite_areaframes
(list_of_areaframes)¶