Skip to content

Derive basal contacts from geology map in thickness calculators - #121

Open
lachlangrose wants to merge 4 commits into
mainfrom
feat/thickness-calculator-auto-basal-contacts
Open

lachlangrose wants to merge 4 commits into
mainfrom
feat/thickness-calculator-auto-basal-contacts

Conversation

@lachlangrose

Copy link
Copy Markdown
Member

Summary

  • The thickness calculators (GUI widget and Processing Toolbox algorithm) previously required a basal-contacts line layer to already exist, forcing users through a separate "Extract Basal Contacts" step first.
  • Basal contacts are now optional: when omitted, they're extracted automatically from the geology layer and stratigraphic column, reusing the existing extract_basal_contacts / map2loop ContactExtractor logic (no duplication).
  • Fixes a related gap where the "AlongSection" calculator type skipped geology/basal-contacts validation entirely in the widget.

Test plan

  • In QGIS, open the Thickness Calculator dialog, select a geology layer and a defined stratigraphic column, leave "Basal Contacts Layer" empty, and confirm thickness calculates successfully.
  • Confirm the existing manual-basal-contacts-layer workflow still works unchanged.
  • Run the Processing Toolbox "Thickness Calculator" algorithm with the Basal Contacts parameter left empty.

The Processing thickness calculator now extracts basal contacts from the
geology layer and the stratigraphic column when no basal contacts layer
is given. The basal contacts input is optional.
Before, an error in map2loop gave an empty result and the user did not
see the cause. Now extract_basal_contacts raises a RuntimeError with the
cause. The GUI and the Processing algorithms show this message.
The algorithm now uses the geology feature source for the units, the
bounding box and the basal contact extraction. Thus "selected features
only" applies to all of them, and an input that is not a map layer works.

Add an optional faults input. The faults are used when the algorithm
extracts the basal contacts from the geology. Show an error if the
extraction finds no basal contacts.

Add tests for basal contacts from the geology layer and from the
selected features only.
@lachlangrose
lachlangrose force-pushed the feat/thickness-calculator-auto-basal-contacts branch from 48f6296 to 5cd2a60 Compare October 31, 2026 00:45
- extract_basal_contacts had a mutable default (ignore_units=[]) and
  added None to it, so the list grew at each call. It also changed the
  list of the caller. Use None and a new list.
- The thickness algorithm read MAX_LINE_LENGTH with parameterAsSource, so
  StructuralPoint always got None. Use parameterAsDouble.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant