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/map2model fault fault relationships #140

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 6 additions & 3 deletions map2loop/deformation_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import geopandas
import math


class DeformationHistory:
"""
A class containing all the fault and fold summaries and relationships
Expand Down Expand Up @@ -285,12 +284,16 @@ def get_fault_relationships_with_ids(self, fault_fault_relationships: pandas.Dat
Returns:
pandas.DataFrame: The fault_relationships with the correct eventIds
"""

faultIds = self.get_faults_for_export()[["eventId", "name"]].copy()
rel = fault_fault_relationships.copy()
rel = rel.merge(faultIds, left_on="Fault1", right_on="name")
rel['Fault1'] = rel['Fault1'].astype(str)
rel['Fault2'] = rel['Fault2'].astype(str)
faultIds['eventId'] = faultIds['eventId'].astype(str)
rel = rel.merge(faultIds, left_on="Fault1", right_on="eventId")
rel.rename(columns={"eventId": "eventId1"}, inplace=True)
rel.drop(columns=["name"], inplace=True)
rel = rel.merge(faultIds, left_on="Fault2", right_on="name")
rel = rel.merge(faultIds, left_on="Fault2", right_on="eventId")
rel.rename(columns={"eventId": "eventId2"}, inplace=True)
rel.drop(columns=["name"], inplace=True)
return rel
2 changes: 1 addition & 1 deletion map2loop/map2model_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def run(self, verbose_level: VerboseLevel = None):
df[1] = [re.findall("\(.*?\)", i) for i in df[1]] # Valid escape for regex
df[0] = list(df[0].str.replace("^[0-9]*, ", "", regex=True))
df[0] = list(df[0].str.replace(", ", "", regex=False))
df[0] = "Fault_" + df[0]
# df[0] = "Fault_" + df[0] #removed 7/10/24 as it seems to break the merge in
relations = df[1]
for j in range(len(relations)):
relations[j] = [i.strip("()").replace(" ", "").split(",") for i in relations[j]]
Expand Down
1 change: 1 addition & 0 deletions map2loop/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ def run_all(self, user_defined_stratigraphic_column=None, take_best=False):
# Calculate the stratigraphic column
if issubclass(type(user_defined_stratigraphic_column), list):
self.stratigraphic_column.column = user_defined_stratigraphic_column
self.map2model.run() # if we use a user defined stratigraphic column, we still need to calculate the results of map2model
else:
if user_defined_stratigraphic_column is not None:
print(
Expand Down
Loading