Skip to content

Commit

Permalink
fix: added project file processor
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Nov 23, 2021
1 parent cf241ad commit 855a690
Showing 1 changed file with 38 additions and 21 deletions.
59 changes: 38 additions & 21 deletions LoopStructural/modelling/input/project_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,45 @@
from .process_data import ProcessInputData
import numpy as np
import pandas as pd
import networkx

from matplotlib.colors import to_hex
from LoopStructural.utils import getLogger
logger = getLogger(__name__)

class Map2LoopProcessor(ProcessInputData):
def __init__(self,projectife,use_thickness=None):
if isinstance(projectife,ProjectFile) == False:
class LoopProjectfileProcessor(ProcessInputData):
def __init__(self,projectfile,use_thickness=None):
if isinstance(projectfile,ProjectFile) == False:
raise LoopTypeError("projectife must be of type ProjectFile")
self.projectife = projectife
# super().__init__(
# self.projectfile.contacts,
# self.projectfile.orientations,
# stratigraphic_order,
# thicknesses=thicknesses,
# fault_orientations=fault_orientations,
# fault_locations=fault_locations,
# fault_properties=fault_properties,
# fault_edges=list(fault_graph.edges),
# colours=dict(zip(groups['code'],groups['colour'])),
# fault_stratigraphy=None,
# intrusions=None,
# use_thickness=use_thickness,
# fault_edge_properties=fault_edge_properties
# )
column_map = {'easting':'X','northing':'Y','altitude':'Z'}
self.projectfile = projectfile
contacts = self.projectfile.stratigraphyLocations
orientations = self.projectfile.stratigraphyOrientations
fault_orientations = self.projectfile.faultOrientations
fault_locations = self.projectfile.faultLocations

orientations.rename(columns=column_map,inplace=True)
contacts.rename(columns=column_map,inplace=True)
fault_locations.rename(columns=column_map,inplace=True)
fault_orientations.rename(columns=column_map,inplace=True)
fault_locations['fault_name']=[f"Fault_{eventid}" for eventid in fault_locations['eventId']]
fault_orientations['fault_name']=[f"Fault_{eventid}" for eventid in fault_orientations['eventId']]
thicknesses = dict(zip(projectfile['stratigraphicLog'].name,
projectfile['stratigraphicLog'].thickness))
fault_properties = self.projectfile.faultLog
colours = dict(zip(self.projectfile.stratigraphicLog.name,
[to_hex(c) for c in self.projectfile.stratigraphicLog.loc[:,
['colour1Red','colour1Green','colour1Blue']].to_numpy()/255]))
super().__init__(
contacts=contacts,
contact_orientations=orientations,
stratigraphic_order=[('sg',list(project.stratigraphicLog.name))],#needs to be updated,
thicknesses=thicknesses,
fault_orientations=fault_orientations,
fault_locations=fault_locations,
fault_properties=fault_properties,
# fault_edges=list(fault_graph.edges),
colours=colours,
fault_stratigraphy=None,
intrusions=None,
use_thickness=use_thickness,
# fault_edge_properties=fault_edge_properties
)

0 comments on commit 855a690

Please sign in to comment.