@@ -60,8 +60,8 @@ def __init__( self,
6060 The processor will generate the best possible data set given the input data. If you only want to build a fault
6161 network then only fault locations, orientations edges and properties are required
6262 """
63-
64- self ._stratigraphic_order = stratigraphic_order
63+ self . _stratigraphic_order = None
64+ self .stratigraphic_order = stratigraphic_order
6565 self ._thicknesses = thicknesses
6666 self ._use_thickness = use_thickness
6767 if self .thicknesses is None :
@@ -85,7 +85,8 @@ def __init__( self,
8585 self ._fault_properties = None
8686 self .fault_properties = fault_properties
8787 self ._fault_network = None
88- self .set_fault_network (fault_edges ,fault_edge_properties )# = fault_graph
88+ if fault_edges is not None and fault_edge_properties is not None :
89+ self .set_fault_network (fault_edges ,fault_edge_properties )# = fault_graph
8990 self ._fault_stratigraphy = fault_stratigraphy
9091 self ._intrusions = intrusions
9192 self ._thicknesses = thicknesses
@@ -96,7 +97,21 @@ def __init__( self,
9697 self ._foliation_properties = {} #empty dictionary of foliation parameters
9798 self .foliation_properties = None
9899
100+ @property
101+ def stratigraphic_order (self ):
102+ return self ._stratigraphic_order
99103
104+ @stratigraphic_order .setter
105+ def stratigraphic_order (self , stratigraphic_order ):
106+ if isinstance (stratigraphic_order [0 ][1 ],list ) == False :
107+ raise TypeError ('Stratigraphic_order must of the format [[(\' group_name\' ,[\' unit1\' ,\' unit2\' ]),(\' group_name2\' ,[\' unit3\' ,\' unit4\' ])]]' )
108+ if isinstance (stratigraphic_order ,list ) == False :
109+ raise TypeError ('Stratigraphic_order must be a list' )
110+ if isinstance (stratigraphic_order [0 ][1 ][0 ],str ) == False :
111+ raise TypeError ('Stratigraphic_order elements must be strings' )
112+ self ._stratigraphic_order = stratigraphic_order
113+
114+
100115 @property
101116 def colours (self ):
102117 return self ._colours
@@ -119,10 +134,12 @@ def stratigraphic_column(self):
119134 for name , sg in self ._stratigraphic_order :
120135 stratigraphic_column [name ] = {}
121136 for g in reversed (sg ):
122- stratigraphic_column [name ][g ] = {'max' : val [g ]+ self .thicknesses [g ], 'min' : val [g ] , 'id' : unit_id , 'colour' :self .colours [g ]}
137+ if g in self .thicknesses :
138+ stratigraphic_column [name ][g ] = {'max' : val [g ]+ self .thicknesses [g ], 'min' : val [g ] , 'id' : unit_id , 'colour' :self .colours [g ]}
123139 unit_id += 1
124140 # add faults into the column
125- stratigraphic_column ['faults' ] = self .fault_properties .to_dict ('index' )
141+ if self .fault_properties is not None :
142+ stratigraphic_column ['faults' ] = self .fault_properties .to_dict ('index' )
126143 return stratigraphic_column
127144
128145
@@ -280,8 +297,10 @@ def data(self):
280297 before any of the calculated attributes are accessed
281298 """
282299 dataframes = []
283- dataframes .append (self .contacts )
284- dataframes .append (self .contact_orientations )
300+ if self .contacts is not None :
301+ dataframes .append (self .contacts )
302+ if self .contact_orientations is not None :
303+ dataframes .append (self .contact_orientations )
285304 if self .fault_orientations is not None :
286305 dataframes .append (self .fault_orientations )
287306 if self .fault_locations is not None :
@@ -310,7 +329,7 @@ def vector_scale(self,vector_scale):
310329 @property
311330 def stratigraphic_name (self ):
312331 names = []
313- for sg in self ._stratigraphic_order :
332+ for name , sg in self ._stratigraphic_order :
314333 for g in sg :
315334 names .append (g )
316335 return names
@@ -330,8 +349,12 @@ def _stratigraphic_value(self):
330349 for name , sg in self ._stratigraphic_order :
331350 value = 0. #reset for each supergroup
332351 for g in reversed (sg ):
333- stratigraphic_value [g ] = value #+ self._thicknesses[g]
334- value += self ._thicknesses [g ]
352+ if g not in self ._thicknesses :
353+ logger .warning ('No thicknesses for {}' .format (g ))
354+ stratigraphic_value [g ] = np .nan
355+ else :
356+ stratigraphic_value [g ] = value #+ self._thicknesses[g]
357+ value += self ._thicknesses [g ]
335358 return stratigraphic_value
336359
337360 def _update_feature_names (self ,dataframe ):
@@ -386,6 +409,8 @@ def contacts(self,contacts):
386409
387410 @property
388411 def contact_orientations (self ):
412+ if self ._contact_orientations is None :
413+ return None
389414 contact_orientations = self ._contact_orientations .copy ()
390415 #scale
391416 contact_orientations .loc [~ np .isnan (contact_orientations ['nz' ]),['nx' , 'ny' , 'nz' ]]*= self .vector_scale * \
0 commit comments