Skip to content

Commit

Permalink
LGVISIUM-102: rename AToBIntervalExtractor.from_material_description_…
Browse files Browse the repository at this point in the history
…lines() + add example to docs
  • Loading branch information
stijnvermeeren-swisstopo committed Nov 22, 2024
1 parent fb2affc commit 8ff58a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/stratigraphy/depth/a_to_b_interval_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,23 @@ class AToBIntervalExtractor:
"""Methods for finding AToBInterval instances (e.g. "0.5m - 1.8m") in a text."""

@classmethod
def from_lines(cls, lines: list[TextLine]) -> AToBInterval | None:
"""Extract depth interval from text lines.
def from_material_description_lines(cls, lines: list[TextLine]) -> AToBInterval | None:
"""Extract depth interval from text lines from a material description.
For borehole profiles in the Deriaz layout, the depth interval is usually found in the text of the material
description. Often, these text descriptions contain a further separation into multiple sub layers.
These sub layers have their own depth intervals. This function extracts the overall depth interval,
spanning across all mentioned sub layers.
For example (from GeoQuat 12306):
1) REMBLAIS HETEROGENES
0.00 - 0.08 m : Revêtement bitumineux
0.08- 0.30 m : Grave d'infrastructure
0.30 - 1.40 m : Grave dans importante matrice de sable
moyen, brun beige, pulvérulent.
From this material description, this method will extract a single depth interval that starts at 0m and ends
at 1.40m.
Args:
lines (list[TextLine]): The lines to extract the depth interval from.
Expand Down
2 changes: 1 addition & 1 deletion src/stratigraphy/sidebar/layer_identifier_sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def identify_groups(
result = []
for block in blocks:
depth_intervals = []
depth_interval = AToBIntervalExtractor.from_lines(block.lines)
depth_interval = AToBIntervalExtractor.from_material_description_lines(block.lines)
if depth_interval:
depth_intervals.append(depth_interval)
result.append(IntervalBlockGroup(depth_intervals=depth_intervals, blocks=[block]))
Expand Down

0 comments on commit 8ff58a4

Please sign in to comment.