A Python module for the spatial analysis of geological fractures from shapefile data. Includes plotting functions.
This module takes shapefiles containing either polylines or points and spatially analyses them by user defined inputs (cell size in km and angle bins).
Analysis outputs include:
-
Number density.
-
Length density.
-
Number anisotropy.
-
Group Dominance Frequency (GDF).
Single or multiple analysed shapefiles can then be put into a fancy plot with rose diagrams like so:
Import the module:
>>> import geo_frac_analysis as GFA
Set address for shapefile which contains polyline fractures.
>>> address1 = "/Data/wexfaults.dbf"
Set the cell size to be 10km, and angle bins per 180 degrees to be 3 (i.e., 30 degree bins):
>>> cell_size, angle_bins = 10, 3
Create the FracAnalysisPoly object:
>>> a = GFA.FracAnalysisPoly(address1, cell_size, angle_bins)
Plot the analysed data with number density patches:
>>> GFA.FancyPlot(a, patches = "Number")
To install using pip:
pip install geo_frac_analysis
pyshp
matplotlib
numpy
Written by Sean Blake in Trinity College Dublin, 2014-2016
Email: blakese__at__tcd.ie
GITHUB: https://github.com/TerminusEst
Uses the MIT license.
Using a as our analysed polyline object (see quick example above), the basic plot
>>> GFA.FancyPlot(a)
gives the following plot:
To include squares (size = cell_size) showing number density, we can call:
>>> GFA.FancyPlot(a, Patches = "Number")
Patches can also equal "Length" or "NumberAnisotropy"
An example of the plot working with all of the bells and whistles:
>>> GFA.FancyPlot(a, Rose = True, Fractures = True, Patches = "NumberAnisotropy", Circles = True, SquareNumbers = True, FigureNumber = 1)
Suppose we had another shapefile of a different region, and we wanted to plot them together. We can simply do the following:
>>> address2 = "/dungarv.dbf`
>>> b = GFA.FracAnalysisPoly(address2, cell_size, angle_bins)
>>> analysed_list = [a, b]
>>> GFA.FancyPlot(analysed_list, Rose = True, Fractures = True, Patches = "NumberAnisotropy", Circles = True, SquareNumbers = True, FigureNumber = 1)
Shapefiles which contain points can also be added:
>>> address3 = "/mypointdata.dbf"
>>> p = GFA.FracAnalysisPoint(address3, cell_size ,angle_bins)
>>> analysed_list.append(p)
>>> GFA.FancyPlot(analysed_list, Rose = True, Fractures = True, Patches = "Number", Circles = False, SquareNumbers = False, FigureNumber = 1)
NOTE No length analysis can be undertaken on a group of analysed shapefiles if one or more of them contain points.
If you want to plot one rose diagram per region, we use the second plotting function:
GFA.FancyPlotTotals(analysed_list, Fractures = True, Circles = True, FigureNumber = 1)
Now that you are happy with the analysis, you can save the analysed data from a into a shapefile. This can be done as follows:
>>> output_address = "/my_output"
>>> a.save_output(output_address)
Once this is done, you will have a shapefile with fields:
[('DeletionFlag', 'C', 1, 0),
['X', 'F', 10, 8],
['Y', 'F', 10, 8],
['N0', 'F', 10, 8],
['N1', 'F', 10, 8],
['N2', 'F', 10, 8],
['L0', 'F', 10, 8],
['L1', 'F', 10, 8],
['L2', 'F', 10, 8],
['N_tot', 'F', 10, 8],
['N_Anisotro', 'F', 10, 8]]
where:
X, Y = X and Y coordinates of squares
N0-Nn = number density per bin (bins 0-n)
L0-Ln = length density per bin (bins 0-n)
N_tot = true number density per square (so as to avoid double counting fractures which are in >1 angle bins)
N_Anisotro = number anisotropy per square