@@ -165,19 +165,26 @@ def stratigraphic_column(self):
165165 unit_id = 1
166166 val = self ._stratigraphic_value ()
167167 for name , sg in self ._stratigraphic_order :
168+ # set the oldest unit to be the basement.
169+ # this has no observed basal contact and then
170+ # top of the unit is the 0 isovalue.
171+ # this is the minimum of the next unit
168172 stratigraphic_column [name ] = {}
169- for i , g in enumerate (reversed (sg )):
173+ stratigraphic_column [name ][sg [- 1 ]] = {
174+ "max" : 0 ,
175+ "min" : - np .inf ,
176+ "id" : unit_id ,
177+ "colour" : self .colours [sg [- 1 ]],
178+ }
179+ # iterate through the remaining units (in reverse)
180+ for g in reversed (sg [:- 1 ]):
170181 if g in self .thicknesses :
171182 stratigraphic_column [name ][g ] = {
172183 "max" : val [g ] + self .thicknesses [g ],
173184 "min" : val [g ],
174185 "id" : unit_id ,
175186 "colour" : self .colours [g ],
176187 }
177- if i == 0 :
178- stratigraphic_column [name ][g ]["min" ] = 0
179- if i == len (sg ) - 1 :
180- stratigraphic_column [name ][g ]["max" ] = np .inf
181188
182189 unit_id += 1
183190 # add faults into the column
@@ -438,7 +445,14 @@ def _stratigraphic_value(self):
438445 stratigraphic_value = {}
439446 for _name , sg in self .stratigraphic_order :
440447 value = 0.0 # reset for each supergroup
441- for g in reversed (sg ):
448+ if sg [0 ] not in self .thicknesses or self .thicknesses [sg [0 ]] <= 0 :
449+ self .thicknesses [sg [0 ]] = (
450+ np .inf
451+ ) # make the top unit infinite as it should extend to the top of the model
452+ for g in reversed (
453+ sg [:- 1 ]
454+ ): # don't add the last unit as we never see the base of this unit.
455+ # It should be "basement"
442456 if g not in self .thicknesses :
443457 logger .warning (f"No thicknesses for { g } " )
444458 stratigraphic_value [g ] = np .nan
0 commit comments