Skip to content

[ana5] Add extBottomOption to extend the DFA path to the deposit front#1296

Merged
fso42 merged 3 commits into
OpenNHM:masterfrom
NUForever:dfaPathExtBottomOption
Jun 23, 2026
Merged

[ana5] Add extBottomOption to extend the DFA path to the deposit front#1296
fso42 merged 3 commits into
OpenNHM:masterfrom
NUForever:dfaPathExtBottomOption

Conversation

@NUForever

Copy link
Copy Markdown

What this adds

A new option extBottomOption in DFAPathGeneration controlling how the
mass-averaged path is extended at the bottom:

  • extBottomOption = 0 (default, unchanged): the current fixed-length
    extrapolation (extendProfileBottom), which extends the path in the
    direction of its last points by factBottomExt * sMax, clipped at the
    DEM border.
  • extBottomOption = 1 (new): extend the path to the front of the
    simulated deposit.

Motivation

The mass-averaged path ends short of the deposit once the front
decelerates. The default bottom extension extrapolates a straight line of
fixed relative length, independently of where the avalanche actually
stopped, so the path end does not coincide with the simulated runout.
Targeting the deposit front yields a path that ends at the simulated
runout, which is useful for corridor-scale and road-crossing analyses.

How it works

  1. The front of the deposit is located in the peak flow thickness field
    (pft) as the flow-thickness-weighted centroid of the flow cells in the
    lowest part of the flow elevation range (findFlowFront), with a
    lowest-cell fallback for flat deposits and a snap to the deposit when the
    centroid falls between disjoint lobes.
  2. The path end is connected to that front by a Dijkstra least-cost path
    over the DEM (leastCostPath). The cost of a step is its horizontal
    length plus a penalty on the positive elevation gain and on the distance
    from the flow footprint, so the extension descends along the deposit.
    Distances use meters (distance_transform_edt with sampling=cellsize)
    so the penalties are resolution independent.
  3. If the front cannot be located or reached, or no flow thickness field is
    available, the path falls back to the fixed-length extension, so the
    AIMEC buffer is preserved.

The option is dispatched in extendDFAPath (which gains an optional
fieldFT argument, mirroring the existing extTopOption); the pft field
is read in generatePathAndSplitpoint only when the option is active. New
parameters live in DFAPathGenerationCfg.ini (ftThreshold,
lowFrontFraction, upSlopePenalty, flowDistPenalty) and resType
gains pft.

Default behaviour

Unchanged. With extBottomOption = 0 (the default) the existing pipeline
is not affected.

Tests

Unit tests added for findFlowFront (front band, flat deposit, two-lobe
snap, no flow), leastCostPath (channel routing, unreachable goal behind
nodata), extendProfileToFront (extension to the front, both fallbacks)
and readPeakFT (lookup by name and by hash, missing field). Docs updated
in docs/moduleAna5Utils.rst.

Context

Developed for the corridor-scale thalweg extraction on Route 115-CH (Chile)
and validated there against 208 manually delineated reference thalwegs
(median endpoint distance 64 m).

@fso42 fso42 self-assigned this Jun 17, 2026
@fso42 fso42 added the enhancement New feature or request label Jun 17, 2026
@fso42 fso42 self-requested a review June 17, 2026 07:10
@fso42 fso42 changed the title Add extBottomOption to extend the DFA path to the deposit front [ana5] Add extBottomOption to extend the DFA path to the deposit front Jun 17, 2026

@fso42 fso42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Ivan for your PR. I have 2 comments, one is only minor.

Comment thread avaframe/ana5Utils/DFAPathGeneration.py Outdated
Comment thread avaframe/ana5Utils/DFAPathGeneration.py
@fso42 fso42 requested a review from awirb June 22, 2026 06:46
@awirb

awirb commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Does the new extension need peak flow thickness or is also just flow thickness of the final time step sufficient? the fieldFT variable is initialized with the peak flow thickness and pft has also been added as a required simulation result but later on when used in docstring also referred to as flow thickness field? I guess the peak flow thickness field is needed as otherwise the computation of the lowBand (lowest part of the flow elevation range) is changed

Comment thread avaframe/ana5Utils/DFAPathGeneration.py Outdated
Comment thread avaframe/ana5Utils/DFAPathGeneration.py Outdated
Comment thread docs/moduleAna5Utils.rst Outdated
Comment thread docs/moduleAna5Utils.rst Outdated
@OpenNHM OpenNHM deleted a comment from awirb Jun 22, 2026
@NUForever

Copy link
Copy Markdown
Author

Thanks for the review, Anna. To your question: it is the peak flow thickness (pft). The flow thickness of the final time step could be used to locate the front as well, but I went with pft because it is a default com1DFA output that is always computed, independent of whether the path is built from the particles or from the fields, while the final time step thickness would depend on that choice. The pft also covers the full extent the flow reached, which is what we need to place the front. I also renamed nrows/ncols to nRows/nCols in leastCostPath for camelCase consistency, as you suggested. All points are addressed in 331c543, with replies in the inline threads.

@fso42

fso42 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Standardtests ok (apart from known com5)

Iván Latorre V. added 3 commits June 23, 2026 09:05
…posit front

The mass-averaged path ends short of the deposit once the front
decelerates, and the existing bottom extension extrapolates a straight
line of fixed relative length (factBottomExt * sMax) clipped at the DEM
border, independently of where the avalanche actually stopped.

This adds extBottomOption = 1: the front of the deposit is located in
the peak flow thickness field (flow-thickness-weighted centroid of the
flow cells in the lowest part of the flow elevation range, with a
lowest-cell fallback for flat deposits) and the path is extended to it
along a Dijkstra least-cost path over the DEM, penalizing uphill steps
and cells away from the flow footprint. The distance from the flow is
computed in meters (distance_transform_edt with sampling=cellsize) so
the penalties are resolution independent.

Default behaviour is unchanged (extBottomOption = 0); the option is
dispatched in extendDFAPath, which gains an optional fieldFT argument,
and the pft field is read in generatePathAndSplitpoint only when the
option is active. Used for the corridor-scale thalweg extraction on
Route 115-CH (Chile), validated there against 208 manually delineated
reference thalwegs (median endpoint distance 64 m).
Move the makeSimDF call out of the per-simulation loop in
generatePathAndSplitpoint: the peak files are parsed once and the
dataframe is passed to readPeakFT, instead of re-reading and re-parsing
all peak files for every simulation. Document why findFlowFront needs
no divide-by-zero guard on the flow-weight sum.
The least-cost bottom extension uses the peak flow thickness field (pft),
so rename fieldFT to fieldPFT and make the docstrings and messages say
peak flow thickness consistently. Relabel the option-0 extension as
straight-line instead of fixed-length, rename nrows/ncols to nRows/nCols
in leastCostPath, and update the docs (the mass-averaged path ends at the
last center of mass point; document lowFrontFraction and its default).
@fso42 fso42 force-pushed the dfaPathExtBottomOption branch from 331c543 to 8a5fd52 Compare June 23, 2026 07:05
@fso42 fso42 merged commit d01603b into OpenNHM:master Jun 23, 2026
2 checks passed
@NUForever NUForever deleted the dfaPathExtBottomOption branch June 24, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants