fault_mesh.faults.generic

Classes to act as a general/multifault. Leapfrog classes inherit from these.

Classes

GenericMultiFault

Class to hold data for multiple faults, read in from shapefile (and hopefully also tsurfaces)

Functions

smallest_difference(value1, value2)

Finds smallest angle between two bearings

normalize_bearing(bearing)

change a bearing (in degrees) so that it is an azimuth between 0 and 360.

bearing_leq(value, benchmark[, tolerance])

Check whether a bearing (value) is anticlockwise of another bearing (benchmark)

bearing_geq(value, benchmark[, tolerance])

Check whether a bearing (value) is clockwise of another bearing (benchmark)

reverse_bearing(bearing)

180 degrees from supplied bearing

reverse_line(line)

Change the order that points in a LineString object are presented.

calculate_dip_direction(line)

Calculate the strike of a shapely linestring object with coordinates in NZTM,

root_mean_square(value_array)

Helper function to turn max and min to stdev for inclusion in XML.

Module Contents

fault_mesh.faults.generic.smallest_difference(value1, value2)

Finds smallest angle between two bearings :param value1: :param value2: :return:

fault_mesh.faults.generic.normalize_bearing(bearing)

change a bearing (in degrees) so that it is an azimuth between 0 and 360. :param bearing: :return:

Parameters:

bearing (Union[float, int])

fault_mesh.faults.generic.bearing_leq(value, benchmark, tolerance=0.1)

Check whether a bearing (value) is anticlockwise of another bearing (benchmark) :param value: :param benchmark: :param tolerance: to account for rounding errors etc :return:

Parameters:
  • value (Union[int, float])

  • benchmark (Union[int, float])

  • tolerance (Union[int, float])

fault_mesh.faults.generic.bearing_geq(value, benchmark, tolerance=0.1)

Check whether a bearing (value) is clockwise of another bearing (benchmark) :param value: :param benchmark: :param tolerance: to account for rounding errors etc :return:

Parameters:
  • value (Union[int, float])

  • benchmark (Union[int, float])

  • tolerance (Union[int, float])

fault_mesh.faults.generic.reverse_bearing(bearing)

180 degrees from supplied bearing :param bearing: :return:

Parameters:

bearing (Union[int, float])

fault_mesh.faults.generic.reverse_line(line)

Change the order that points in a LineString object are presented. Updated to work with 3d lines (has_z), September 2021 Important for OpenSHA, I think :param line: :return:

Parameters:

line (shapely.geometry.LineString)

fault_mesh.faults.generic.calculate_dip_direction(line)

Calculate the strike of a shapely linestring object with coordinates in NZTM, then adds 90 to get dip direction. Dip direction is always 90 clockwise from strike of line. :param line: Linestring object :return:

Parameters:

line (shapely.geometry.LineString)

fault_mesh.faults.generic.root_mean_square(value_array)

Helper function to turn max and min to stdev for inclusion in XML. :param value_array: Differences of values (e.g. sr_min and sr_max) from mean. :return:

Parameters:

value_array (Union[numpy.ndarray, list, tuple])

class fault_mesh.faults.generic.GenericMultiFault(fault_geodataframe, sort_sr=False, remove_colons=False, dip_choice='pref', check_optional_fields=True)

Class to hold data for multiple faults, read in from shapefile (and hopefully also tsurfaces)

Parameters:
  • fault_geodataframe (geopandas.GeoDataFrame)

  • sort_sr (bool)

  • remove_colons (bool)

  • dip_choice (str)

  • check_optional_fields (bool)

static gdf_from_nz_cfm_shp(filename, exclude_region_polygons=None, depth_type=None, exclude_region_min_sr=1.8, include_names=None, exclude_aus=True, exclude_zero=True)

Read CFM shapefile

Parameters:
  • filename (str)

  • exclude_region_polygons (List[shapely.geometry.Polygon])

  • depth_type (str)

  • exclude_region_min_sr (float)

  • include_names (list)

  • exclude_aus (bool)

  • exclude_zero (bool)