Skip to content

Commit f9cf0be

Browse files
authored
fix: make stratigraphic order consistent between methods and add unit test (#320)
* ci: pin map2loop/visualisation release-please versions to fix bad auto-bump Neither package has a component-scoped release-please tag yet (they were only just added to the workspace in #301/#302), so release-please had no correct anchor for their next version and fell back to misreading one of the repo's old generic v1.6.5 LoopStructural tags as their baseline, proposing 1.6.5 for both in the open release PR instead of a proper minor bump from their real current versions (map2loop 3.3.1, loopstructuralvisualisation 0.1.17). One-time release-as pins to the correct next versions; remove once that release PR has merged and each package has its own release-please tag to anchor future bumps. * fix: ensuring stratigraphic order is consistent between methods + adding test
1 parent 69884f1 commit f9cf0be

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

LoopStructural/modelling/core/stratigraphic_column.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def get_isovalues(self) -> dict[str, float]:
668668
surface_values = {}
669669
for g in reversed(self.get_groups()):
670670
v = 0
671-
for u in g.units:
671+
for u in reversed(g.units):
672672
surface_values[u.name] = {'value':v,'group':g.name,'colour':u.colour}
673673
v += u.thickness
674674
return surface_values

tests/unit/modelling/test_stratigraphic_column.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,20 @@ def test_get_isovalues(self):
430430
assert isovalues["B"]["value"] == 0
431431
assert isovalues["B"]["group"] == "Group_0"
432432

433+
def test_get_isovalues_multi_unit_group(self):
434+
# Isovalues must match update_unit_values: the base of the oldest
435+
# unit in a group is 0, and each unit's thickness gives the base
436+
# value of the next (younger) unit.
437+
column = StratigraphicColumn()
438+
column.clear(basement=False)
439+
column.add_unit("A", thickness=10, id=0)
440+
column.add_unit("B", thickness=5, id=1)
441+
column.add_unit("C", thickness=3, id=2)
442+
isovalues = column.get_isovalues()
443+
assert isovalues["A"]["value"] == 0
444+
assert isovalues["B"]["value"] == 10
445+
assert isovalues["C"]["value"] == 15
446+
433447

434448
class TestOrderingAndUpdates:
435449
def test_update_order_reorders_elements(self):

0 commit comments

Comments
 (0)