Skip to content

Commit c9d3c60

Browse files
committed
fix: value should be the basal value of a unit
1 parent e09ed0b commit c9d3c60

1 file changed

Lines changed: 22 additions & 23 deletions

File tree

loopstructural/main/model_manager.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -787,30 +787,27 @@ def update_foliation_features(self):
787787
groupname = group.name
788788
stratigraphic_column[groupname] = {}
789789
for u in reversed(group.units):
790-
# `reversed(group.units)` walks youngest-to-oldest (matching
791-
# StratigraphicColumn.update_unit_values's own cumulative
792-
# walk), so `val` must accumulate every unit's thickness
793-
# *before* being used as that unit's own training value --
794-
# regardless of whether the unit has any digitised data --
795-
# to land on `u.max()`, not `u.min()`.
790+
# A unit's own `val` is `u.min()` -- the cumulative
791+
# thickness *before* this unit's own thickness is added --
792+
# matching `StratigraphicColumn.update_unit_values` (a unit
793+
# is only added to the column oldest-first via `where=
794+
# 'top'`, so `min()` is the boundary shared with the
795+
# next-*older* neighbour processed just before it, i.e.
796+
# this unit's own base) and `get_isovalues()` (LoopStructural
797+
# core; both walk `reversed(group.units)` accumulating the
798+
# same way, so a unit's own training value and the isovalue
799+
# `get_isovalues()` later labels with this unit's name
800+
# agree -- see test_stratigraphic_value_consistency.py).
796801
#
797-
# `u.min()` is the boundary shared with the next *younger*
798-
# neighbour (this unit's top); `u.max()` is the boundary
799-
# shared with the next *older* neighbour (this unit's true
800-
# base). Digitised "basal contact" data represents a unit's
801-
# base, so it belongs at `u.max()`. Using `u.min()` instead
802-
# anchors every unit's own contact points to its top
803-
# boundary rather than its base -- confirmed on a live
804-
# project: every unit's own mapped points evaluated into its
805-
# next-younger neighbour's bracket instead of its own.
806-
#
807-
# Accumulating unconditionally (not skipped for a unit with
808-
# no digitised data, e.g. an undigitised "Top"/basement
809-
# placeholder) also keeps every later unit's value aligned
810-
# with `get_isovalues()`'s own cumulative-thickness bracket
811-
# boundaries, which don't know or care which units were
812-
# actually mapped.
813-
val += u.thickness
802+
# `val` must accumulate every unit's thickness regardless of
803+
# whether that unit has any digitised data -- get_isovalues()
804+
# assigns each unit's isovalue purely from cumulative
805+
# thickness, with no knowledge of which units were actually
806+
# mapped. Skipping the increment for an unmapped unit (e.g.
807+
# a "Top" placeholder with no contact points) would shift
808+
# every val assigned to units after it in this loop, so
809+
# extracted isosurfaces would get labelled with the wrong
810+
# unit name even though the geometry itself is fine.
814811
unit_data = self.stratigraphy.get(u.name, None)
815812
if unit_data is not None:
816813
if 'contact' in unit_data:
@@ -825,6 +822,8 @@ def update_foliation_features(self):
825822
orientations['val'] = np.nan
826823
orientations['feature_name'] = groupname
827824
data.append(orientations)
825+
826+
val += u.thickness
828827
if len(data) == 0:
829828
self._debug_manager.log(
830829
f"No data found for group {groupname}, skipping.", log_level=2

0 commit comments

Comments
 (0)