Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/map2loop server updates #104

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions map2loop/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions map2loop/fault_orientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': [],
}
]
13 changes: 11 additions & 2 deletions map2loop/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 16 additions & 2 deletions map2loop/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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}],
},
]
10 changes: 10 additions & 0 deletions map2loop/sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': []},
]
20 changes: 20 additions & 0 deletions map2loop/thickness_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': [],
},
]
9 changes: 9 additions & 0 deletions map2loop/throw_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': [],
}
]
Loading