@@ -34,24 +34,48 @@ def __init__(self, projectfile, use_thickness=None):
3434 projectfile ["stratigraphicLog" ].ThicknessMedian ,
3535 )
3636 )
37- fault_properties = self .projectfile .faultLog
38- fault_properties .rename (
39- columns = {
40- "avgDisplacement" : "displacement" ,
41- "influenceDistance" : "minor_axis" ,
42- "verticalRadius" : "intermediate_axis" ,
43- "horizontalRadius" : "major_axis" ,
44- "name" : "fault_name" ,
45- },
46- inplace = True ,
47- )
48- fault_locations = fault_properties .reset_index ()[["fault_name" , "eventId" ]].merge (
49- fault_locations , on = "eventId"
50- )
51- fault_orientations = fault_properties .reset_index ()[["fault_name" , "eventId" ]].merge (
52- fault_orientations , on = "eventId"
53- )
54- fault_properties .set_index ("fault_name" , inplace = True )
37+ fault_properties = None
38+ fault_edges = None
39+ fault_edge_properties = None
40+ if self .projectfile .faultLog .shape [0 ] > 0 :
41+
42+ fault_properties = self .projectfile .faultLog
43+ fault_properties .rename (
44+ columns = {
45+ "avgDisplacement" : "displacement" ,
46+ "influenceDistance" : "minor_axis" ,
47+ "verticalRadius" : "intermediate_axis" ,
48+ "horizontalRadius" : "major_axis" ,
49+ "name" : "fault_name" ,
50+ },
51+ inplace = True ,
52+ )
53+ fault_locations = fault_properties .reset_index ()[["fault_name" , "eventId" ]].merge (
54+ fault_locations , on = "eventId"
55+ )
56+ fault_orientations = fault_properties .reset_index ()[["fault_name" , "eventId" ]].merge (
57+ fault_orientations , on = "eventId"
58+ )
59+ fault_properties .set_index ("fault_name" , inplace = True )
60+ for i in fault_relationships .index :
61+ fault_relationships .loc [i , "Fault1" ] = faultLog .loc [
62+ fault_relationships .loc [i , "eventId1" ], "name"
63+ ]
64+ fault_relationships .loc [i , "Fault2" ] = faultLog .loc [
65+ fault_relationships .loc [i , "eventId2" ], "name"
66+ ]
67+ fault_edges = []
68+ fault_edge_properties = []
69+ for i in fault_relationships .index :
70+ fault_edges .append (
71+ (fault_relationships .loc [i , "Fault1" ], fault_relationships .loc [i , "Fault2" ])
72+ )
73+ fault_edge_properties .append (
74+ {
75+ "type" : fault_relationships .loc [i , "type" ],
76+ "angle" : fault_relationships .loc [i , "angle" ],
77+ }
78+ )
5579 colours = dict (
5680 zip (
5781 self .projectfile .stratigraphicLog .name ,
@@ -65,34 +89,15 @@ def __init__(self, projectfile, use_thickness=None):
6589 )
6690 )
6791
68- for i in fault_relationships .index :
69- fault_relationships .loc [i , "Fault1" ] = faultLog .loc [
70- fault_relationships .loc [i , "eventId1" ], "name"
71- ]
72- fault_relationships .loc [i , "Fault2" ] = faultLog .loc [
73- fault_relationships .loc [i , "eventId2" ], "name"
74- ]
75- fault_edges = []
76- fault_edge_properties = []
77- for i in fault_relationships .index :
78- fault_edges .append (
79- (fault_relationships .loc [i , "Fault1" ], fault_relationships .loc [i , "Fault2" ])
80- )
81- fault_edge_properties .append (
82- {
83- "type" : fault_relationships .loc [i , "type" ],
84- "angle" : fault_relationships .loc [i , "angle" ],
85- }
86- )
8792 super ().__init__ (
8893 contacts = contacts ,
8994 contact_orientations = orientations ,
9095 stratigraphic_order = [
9196 ("sg" , list (self .projectfile .stratigraphicLog .name ))
9297 ], # needs to be updated,
9398 thicknesses = thicknesses ,
94- fault_orientations = fault_orientations ,
95- fault_locations = fault_locations ,
99+ fault_orientations = fault_orientations if fault_orientations . shape [ 0 ] > 0 else None ,
100+ fault_locations = fault_locations if fault_locations . shape [ 0 ] > 0 else None ,
96101 fault_properties = fault_properties ,
97102 fault_edges = fault_edges , # list(fault_graph.edges),
98103 colours = colours ,
0 commit comments