From 527de6c339e56ead036ab5ed5d94d06d77673ae6 Mon Sep 17 00:00:00 2001 From: RoyThomsonMonash Date: Thu, 25 Jan 2024 10:04:20 +1100 Subject: [PATCH] fix: Typo in intrusion flag, ignoring intrusions for contact calculations, remove errant sorter from take_best option --- map2loop/mapdata.py | 5 ++++- map2loop/project.py | 2 +- map2loop/sorter.py | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/map2loop/mapdata.py b/map2loop/mapdata.py index b90b170f..48d3b0c7 100644 --- a/map2loop/mapdata.py +++ b/map2loop/mapdata.py @@ -719,7 +719,7 @@ def parse_geology_map(self) -> tuple: geology["INTRUSIVE"] = self.raw_data[Datatype.GEOLOGY][config["rocktype_column"]].astype(str).str.contains(config["intrusive_text"]) geology["ROCKTYPE1"] = self.raw_data[Datatype.GEOLOGY][config["rocktype_column"]].astype(str) else: - geology["INSTRUSIVE"] = False + geology["INTRUSIVE"] = False geology["ROCKTYPE1"] = "" if config["alt_rocktype_column"] in self.raw_data[Datatype.GEOLOGY]: @@ -1213,6 +1213,9 @@ def extract_all_contacts(self, save_contacts=True): """ geology = self.get_map_data(Datatype.GEOLOGY).copy() geology = geology.dissolve(by="UNITNAME", as_index=False) + # Remove intrusions + geology = geology[geology["INTRUSIVE"]==False] + geology = geology[geology["SILL"]==False] # Remove faults from contact geomety if self.get_map_data(Datatype.FAULT) is not None: faults = self.get_map_data(Datatype.FAULT).copy() diff --git a/map2loop/project.py b/map2loop/project.py index a3fe4390..0a24dd32 100644 --- a/map2loop/project.py +++ b/map2loop/project.py @@ -348,7 +348,7 @@ def calculate_stratigraphic_order(self, take_best=False): Use unit relationships, unit ages and the sorter to create a stratigraphic column """ if take_best: - sorters = [SorterUseHint(), SorterAgeBased(), SorterAlpha(), SorterUseNetworkX(), SorterMaximiseContacts(), SorterObservationProjections()] + sorters = [SorterUseHint(), SorterAgeBased(), SorterAlpha(), SorterUseNetworkX()] columns = [sorter.sort(self.stratigraphic_column.stratigraphicUnits, self.map2model.get_unit_unit_relationships(), self.map2model.get_sorted_units(), diff --git a/map2loop/sorter.py b/map2loop/sorter.py index 63f72f03..3c30da69 100644 --- a/map2loop/sorter.py +++ b/map2loop/sorter.py @@ -205,7 +205,7 @@ def sort(self, units: pandas.DataFrame, unit_relationships: pandas.DataFrame, st while graph.number_of_nodes() > 0: if cnode is None: df = pandas.DataFrame(columns=["unit", "num_neighbours"]) - df["unit"] = units + df["unit"] = list(graph.nodes) df["num_neighbours"] = df.apply(lambda row: len(list(graph.neighbors(row["unit"]))), axis=1) df.sort_values(by=["num_neighbours"], inplace=True) df.reset_index(inplace=True, drop=True) @@ -320,6 +320,8 @@ def sort(self, units: pandas.DataFrame, unit_relationships: pandas.DataFrame, st return stratigraphic_order_hint geol = map_data.get_map_data(Datatype.GEOLOGY).copy() + geol = geol[geol["INTRUSIVE"]==False] + geol = geol[geol["SILL"]==False] orientations = map_data.get_map_data(Datatype.STRUCTURE).copy() verbose = False