map2loop.project.Project#

class map2loop.project.Project(verbose_level: VerboseLevel = VerboseLevel.ALL, tmp_path: str = 'm2l_data_tmp', working_projection=None, bounding_box=None, use_australian_state_data: str = '', geology_filename: str = '', structure_filename: str = '', fault_filename: str = '', fault_orientation_filename: str = '', fold_filename: str = '', dtm_filename: str = '', config_filename: Path | str = '', config_dictionary: dict = {}, clut_filename: Path | str = '', clut_file_legacy: bool = False, save_pre_checked_map_data: bool = False, loop_project_filename: str = '', overwrite_loopprojectfile: bool = False, **kwargs)#

Bases: object

The main entry point into using map2loop

Attiributes#

verbose_level: m2l_enums.VerboseLevel

A selection that defines how much console logging is output

samplers: Sampler

A list of samplers used to extract point samples from polyonal or line segments. Indexed by m2l_enum.Dataype

sorter: Sorter

The sorting algorithm to use for calculating the stratigraphic column

thickness_calculator: ThicknessCalulator

The algorithm to use for making unit thickness estimations

loop_filename: str

The name of the loop project file used in this project

map_data: MapData

The structure that holds all map and dtm data

map2model: Map2ModelWrapper

A wrapper around the map2model module that extracts unit and fault adjacency

stratigraphic_column: StratigraphicColumn

The structure that holds the unit information and ordering

deformation_history: DeformationHistory

The structura that holds the fault and fold information and interactions

The initialiser for the map2loop project

param verbose_level:

How much console output is sent. Defaults to VerboseLevel.ALL.

type verbose_level:

VerboseLevel, optional

param tmp_path:

The directory for storing temporary files. Defaults to “./m2l_data_tmp”.

type tmp_path:

str, optional

param working_projection:

The EPSG projection to use. Defaults to None.

type working_projection:

str or int, optional

param bounding_box:

The boundary extents of the project (m). Defaults to None.

type bounding_box:

list or dict, optional

param use_australian_state_data:

Whether to use default state data and which state to use. Defaults to “”.

type use_australian_state_data:

str, optional

param geology_filename:

The filename of the geology shapefile. Defaults to “”.

type geology_filename:

str, optional

param structure_filename:

The filename of the structure shapefile. Defaults to “”.

type structure_filename:

str, optional

param fault_filename:

The filename of the fault shapefile. Defaults to “”.

type fault_filename:

str, optional

param fault_orientation_filename:

The filename of the fault orientation shapefile. Defaults to “”.

type fault_orientation_filename:

str, optional

param fold_filename:

The filename fo the fold shapefile. Defaults to “”.

type fold_filename:

str, optional

param dtm_filename:

The filename of the digital terrain map to use. Defaults to “”.

type dtm_filename:

str, optional

param config_filename:

The filename of the configuration json file to use (if not using config_dictionary). Defaults to “”.

type config_filename:

str, optional

param config_dictionary:

A dictionary version of the configuration file. Defaults to {}.

type config_dictionary:

dict, optional

param clut_filename:

The filename of the colour look up table to use. Defaults to “”.

type clut_filename:

str, optional

param clut_file_legacy:

A flag to indicate if the clut file is in the legacy format. Defaults to False.

type clut_file_legacy:

bool, optional

param save_pre_checked_map_data:

A flag to save all map data to file before use. Defaults to False.

type save_pre_checked_map_data:

bool, optional

param loop_project_filename:

The filename of the loop project file. Defaults to “”.

type loop_project_filename:

str, optional

raises TypeError:

Type of working_projection not a str or int

raises ValueError:

bounding_box not length 4 or 6

raises TypeError:

Type of bounding_box not a dict or tuple

raises ValueError:

use_australian_state_data not in state list [‘WA’, ‘SA’, ‘QLD’, ‘NSW’, ‘TAS’, ‘VIC’, ‘ACT’, ‘NT’]

__init__(verbose_level: VerboseLevel = VerboseLevel.ALL, tmp_path: str = 'm2l_data_tmp', working_projection=None, bounding_box=None, use_australian_state_data: str = '', geology_filename: str = '', structure_filename: str = '', fault_filename: str = '', fault_orientation_filename: str = '', fold_filename: str = '', dtm_filename: str = '', config_filename: Path | str = '', config_dictionary: dict = {}, clut_filename: Path | str = '', clut_file_legacy: bool = False, save_pre_checked_map_data: bool = False, loop_project_filename: str = '', overwrite_loopprojectfile: bool = False, **kwargs)#

The initialiser for the map2loop project

Parameters:
  • verbose_level (VerboseLevel, optional) – How much console output is sent. Defaults to VerboseLevel.ALL.

  • tmp_path (str, optional) – The directory for storing temporary files. Defaults to “./m2l_data_tmp”.

  • working_projection (str or int, optional) – The EPSG projection to use. Defaults to None.

  • bounding_box (list or dict, optional) – The boundary extents of the project (m). Defaults to None.

  • use_australian_state_data (str, optional) – Whether to use default state data and which state to use. Defaults to “”.

  • geology_filename (str, optional) – The filename of the geology shapefile. Defaults to “”.

  • structure_filename (str, optional) – The filename of the structure shapefile. Defaults to “”.

  • fault_filename (str, optional) – The filename of the fault shapefile. Defaults to “”.

  • fault_orientation_filename (str, optional) – The filename of the fault orientation shapefile. Defaults to “”.

  • fold_filename (str, optional) – The filename fo the fold shapefile. Defaults to “”.

  • dtm_filename (str, optional) – The filename of the digital terrain map to use. Defaults to “”.

  • config_filename (str, optional) – The filename of the configuration json file to use (if not using config_dictionary). Defaults to “”.

  • config_dictionary (dict, optional) – A dictionary version of the configuration file. Defaults to {}.

  • clut_filename (str, optional) – The filename of the colour look up table to use. Defaults to “”.

  • clut_file_legacy (bool, optional) – A flag to indicate if the clut file is in the legacy format. Defaults to False.

  • save_pre_checked_map_data (bool, optional) – A flag to save all map data to file before use. Defaults to False.

  • loop_project_filename (str, optional) – The filename of the loop project file. Defaults to “”.

Raises:
  • TypeError – Type of working_projection not a str or int

  • ValueError – bounding_box not length 4 or 6

  • TypeError – Type of bounding_box not a dict or tuple

  • ValueError – use_australian_state_data not in state list [‘WA’, ‘SA’, ‘QLD’, ‘NSW’, ‘TAS’, ‘VIC’, ‘ACT’, ‘NT’]

Methods

__init__([verbose_level, tmp_path, ...])

The initialiser for the map2loop project

apply_colour_to_units()

Apply the clut file to the units in the stratigraphic column

calculate_fault_orientations()

calculate_stratigraphic_order([take_best])

Use unit relationships, unit ages and the sorter to create a stratigraphic column

calculate_unit_thicknesses()

Use the stratigraphic column, and fault and contact data to estimate unit thicknesses

draw_geology_map([points, overlay])

Plots the geology map with optional points or specific data

extract_geology_contacts()

Use the stratigraphic column, and fault and geology data to extract points along contacts

get_fault_orientation()

Get the name of the fault orientation calculator being used

get_minimum_fault_length()

Get the cutoff length for faults

get_sampler(datatype)

Get the sampler name being used for a datatype

get_sorter()

Get the name of the sorter being used

get_thickness_calculator()

Get the name of the thickness calculator being used

get_throw_calculator()

Get the name of the throw calculator being used

run_all([user_defined_stratigraphic_column, ...])

Runs the full map2loop process

sample_map_data()

Use the samplers to extract points along polylines or unit boundaries

save_geotiff_raster([filename, projection, ...])

Saves the geology map to a geotiff

save_into_projectfile()

Creates or updates a loop project file with all the data extracted from the map2loop process

save_mapdata_to_files([save_path, extension])

Saves the map data frames to csv files

set_default_samplers()

Initialisation function to set or reset the point samplers

set_fault_orientation(fault_orientation)

Set the fault orientation calculator that estimates fault orientation values for all faults

set_ignore_codes(codes)

Set the ignore codes (a list of unit names to ignore in the geology shapefile)

set_minimum_fault_length(length)

Set the cutoff length for faults to ignore

set_sampler(datatype, sampler)

Set the point sampler for a specific datatype

set_sorter(sorter)

Set the sorter for determining stratigraphic order of units

set_thickness_calculator(thickness_calculator)

Set the thickness calculator that estimates unit thickness of all units

set_throw_calculator(throw_calculator)

Set the throw calculator that estimates fault throw values for all faults

sort_stratigraphic_column()

Sort the units in the stratigraphic column data structure to match the column order

summarise_fault_data()

Use the fault shapefile to make a summary of each fault by name

apply_colour_to_units()#

Apply the clut file to the units in the stratigraphic column

calculate_stratigraphic_order(take_best=False)#

Use unit relationships, unit ages and the sorter to create a stratigraphic column

calculate_unit_thicknesses()#

Use the stratigraphic column, and fault and contact data to estimate unit thicknesses

draw_geology_map(points: DataFrame = None, overlay: str = '')#

Plots the geology map with optional points or specific data

Parameters:
  • points (pandas.DataFrame, optional) – A dataframe to overlay on the geology map (must contains “X” and “Y” columns). Defaults to None.

  • overlay (str, optional) – Layer of points to overlay (options are “contacts”, “basal_contacts”, “orientations”, “faults”). Defaults to “”.

extract_geology_contacts()#

Use the stratigraphic column, and fault and geology data to extract points along contacts

get_fault_orientation()#

Get the name of the fault orientation calculator being used

Returns:

str – The name of the fault orientation calculator used

get_minimum_fault_length() float#

Get the cutoff length for faults

Returns:

float – The cutoff length

get_sampler(datatype: Datatype)#

Get the sampler name being used for a datatype

Parameters:

datatype (Datatype) – The datatype of the sampler

Returns:

str – The name of the sampler being used on the specified datatype

get_sorter()#

Get the name of the sorter being used

Returns:

str – The name of the sorter used

get_thickness_calculator()#

Get the name of the thickness calculator being used

Returns:

str – The name of the thickness calculator used

get_throw_calculator()#

Get the name of the throw calculator being used

Returns:

str – The name of the throw calculator used

run_all(user_defined_stratigraphic_column=None, take_best=False)#

Runs the full map2loop process

Parameters:

user_defined_stratigraphic_column (None or list, optional) – A user fed list that overrides the stratigraphic column sorter. Defaults to None.

sample_map_data()#

Use the samplers to extract points along polylines or unit boundaries

save_geotiff_raster(filename: str = 'test.tif', projection: str = '', pixel_size: int = 25)#

Saves the geology map to a geotiff

Parameters:
  • filename (str, optional) – The filename of the geotiff file to save to. Defaults to “test.tif”.

  • projection (str, optional) – A string of the format “EPSG:3857” that is the projection to output. Defaults to the project working projection

  • pixel_size (int, optional) – The size of a pixel in metres for the geotiff. Defaults to 25

save_into_projectfile()#

Creates or updates a loop project file with all the data extracted from the map2loop process

save_mapdata_to_files(save_path: str = '.', extension: str = '.shp.zip')#

Saves the map data frames to csv files

Parameters:
  • save_path (str, optional) – The path to save the file to. Defaults to “.”.

  • extension (str, optional) – An alternate extension to save the GeoDataFrame in. Defaults to “.csv”.

set_default_samplers()#

Initialisation function to set or reset the point samplers

set_fault_orientation(fault_orientation: FaultOrientation)#

Set the fault orientation calculator that estimates fault orientation values for all faults

Parameters:

fault_orientation (FaultOrientation) – The calculator to use. Must be of base class FaultOrientation

set_ignore_codes(codes: list)#

Set the ignore codes (a list of unit names to ignore in the geology shapefile)

Parameters:

codes (list) – The list of strings to ignore

set_minimum_fault_length(length: float)#

Set the cutoff length for faults to ignore

Parameters:

length (float) – The cutoff length

set_sampler(datatype: Datatype, sampler: Sampler)#

Set the point sampler for a specific datatype

Parameters:
  • datatype (Datatype) – The datatype to use this sampler on

  • sampler (Sampler) – The sampler to use

set_sorter(sorter: Sorter)#

Set the sorter for determining stratigraphic order of units

Parameters:

sorter (Sorter) – The sorter to use. Must be of base class Sorter

set_thickness_calculator(thickness_calculator: ThicknessCalculator)#

Set the thickness calculator that estimates unit thickness of all units

Parameters:

thickness_calculator (ThicknessCalculator) – The calculator to use. Must be of base class ThicknessCalculator

set_throw_calculator(throw_calculator: ThrowCalculator)#

Set the throw calculator that estimates fault throw values for all faults

Parameters:

throw_calculator (ThrowCalculator) – The calculator to use. Must be of base class ThrowCalculator

sort_stratigraphic_column()#

Sort the units in the stratigraphic column data structure to match the column order

summarise_fault_data()#

Use the fault shapefile to make a summary of each fault by name