diff --git a/map2loop/config.py b/map2loop/config.py index 21d9e536..5207483f 100644 --- a/map2loop/config.py +++ b/map2loop/config.py @@ -71,6 +71,26 @@ def __init__(self): "objectid_column": "ID", } + def __getitem__(self, key): + """ + Get the value of a key in the config + + Args: + key (str): The key to get the value of + + Returns: + dict: The value of the key + """ + if key == "structure": + return self.structure_config + if key == "geology": + return self.geology_config + if key == "fault": + return self.fault_config + if key == "fold": + return self.fold_config + return None + def to_dict(self): """ Convert the config dictionary to a dictionary diff --git a/map2loop/fault_orientation.py b/map2loop/fault_orientation.py index 16692a19..1370eae9 100644 --- a/map2loop/fault_orientation.py +++ b/map2loop/fault_orientation.py @@ -92,3 +92,12 @@ def calculate( orientations.loc[i, "Y"] = p.y return orientations.drop(columns="geometry") + + +__json__ = [ + { + 'classname': "FaultOrientationNearest", + 'description': 'Assigns the nearest fault orientation to a fault', + 'parameters': [], + } +] diff --git a/map2loop/project.py b/map2loop/project.py index 02630ebc..6b57efeb 100644 --- a/map2loop/project.py +++ b/map2loop/project.py @@ -170,8 +170,17 @@ def __init__( # Assign filenames if use_australian_state_data != "": # Sanity check on state string - if use_australian_state_data in ["WA", "SA", "QLD", "NSW", "TAS", "VIC", "ACT", "NT"]: - self.map_data.set_filenames_from_australian_state(use_australian_state_data) + if use_australian_state_data.upper() in [ + "WA", + "SA", + "QLD", + "NSW", + "TAS", + "VIC", + "ACT", + "NT", + ]: + self.map_data.set_filenames_from_australian_state(use_australian_state_data.upper()) else: raise ValueError( f"Australian state {use_australian_state_data} not in state url database" diff --git a/map2loop/sampler.py b/map2loop/sampler.py index 9d97d73d..3b290625 100644 --- a/map2loop/sampler.py +++ b/map2loop/sampler.py @@ -6,7 +6,7 @@ import numpy from .m2l_enums import Datatype from .mapdata import MapData -from typing import Optional +from typing import Optional, Union class Sampler(ABC): @@ -101,7 +101,7 @@ class SamplerSpacing(Sampler): """ @beartype.beartype - def __init__(self, spacing: float = 50.0): + def __init__(self, spacing: Union[float, int] = 50.0): """ Initialiser for spacing sampler @@ -174,3 +174,17 @@ def sample( df.reset_index(drop=True, inplace=True) return df + + +__json__ = [ + { + 'classname': "SamplerDecimator", + 'description': 'Sample by decimation', + 'parameters': [{'name': 'decimation', 'type': 'number', 'value': 1}], + }, + { + 'classname': 'SamplerSpacing', + 'description': 'Sample using a fixed spacing along a line or polygon', + 'parameters': [{'name': 'spacing', 'type': 'number', 'value': 50.0}], + }, +] diff --git a/map2loop/sorter.py b/map2loop/sorter.py index 2d6e05b5..6f5ba774 100644 --- a/map2loop/sorter.py +++ b/map2loop/sorter.py @@ -510,3 +510,13 @@ def sort( dd.add_node(edge[1]) dd.add_edge(edge[0], edge[1]) return list(nx.dfs_preorder_nodes(dd, source=list(dd.nodes())[0])) + + +__json__ = [ + {'classname': "SorterUseHint", 'decription': '', 'parameters': []}, + {'classname': "SorterUseNetworkX", 'decription': '', 'parameters': []}, + {'classname': 'SorterAgedBased', 'decription': '', 'parameters': []}, + {'classname': 'SorterAlpha', 'decription': '', 'parameters': []}, + {'classname': 'SorterMaximiseContacts', 'decription': '', 'parameters': []}, + {'classname': 'SorterObservationProjections', 'decription': '', 'parameters': []}, +] diff --git a/map2loop/thickness_calculator.py b/map2loop/thickness_calculator.py index af016800..beb1245a 100644 --- a/map2loop/thickness_calculator.py +++ b/map2loop/thickness_calculator.py @@ -615,3 +615,23 @@ def compute( output_units.loc[output_units["name"] == unit, "ThicknessStdDev"] = -1 return output_units + + +__json__ = [ + { + 'classname': "ThicknessCalculatorAlpha", + 'description': 'Calculate thickness using shortest map distance between basal contacts', + 'parameters': [], + }, + { + 'classname': "InterpolatedStructure", + 'description': 'Calculate thickness by interpolating structures and projecting map distance into 3d', + 'parameters': [], + }, + { + 'classname': "StructuralPoint", + 'description': 'Calculates thickness for each structural measurement by projecting a line across\n' + + 'stratigraphy and projecting the map thickness using the dip', + 'parameters': [], + }, +] diff --git a/map2loop/throw_calculator.py b/map2loop/throw_calculator.py index 96ca4605..3ff049dd 100644 --- a/map2loop/throw_calculator.py +++ b/map2loop/throw_calculator.py @@ -97,3 +97,12 @@ def compute( lambda row: 100 if row["avgDisplacement"] == -1 else row["avgDisplacement"], axis=1 ) return faults + + +__json__ = [ + { + 'classname': "ThrowCalculatorAlpha", + 'description': "ThrowCalculator class which estimates fault throw values based on units, basal_contacts and stratigraphic order", + 'parameters': [], + } +]