====== Efficient longest flow path algorithm ====== [[workspaces:efficient_longest_flow_path_algorithm:start|Workspace]] [[https://github.com/OSGeo/grass-addons/tree/grass8/src/raster/r.accumulate/|r.accumulate]] {{projects:r_lfp_nc_example_single_warning.png?400|}} \[ \def\LFP{\overrightarrow{\text{LFP}}} \def\FP{\overrightarrow{\text{FP}}} \def\FL{\text{FL}} \def\DFL{\text{DFL}} \def\UFL{\text{UFL}} \def\LFL{\text{LFL}} \] A flow path $\FP_i$ is the watercourse between a pair of two points $i$ within the watershed and the longest flow path $\LFP$ is defined as \[ \LFP\in\left\{\FP_i\;:\;\left|\FP_i\right|\geq\left|\FP_j\right|\;\forall i\neq j\right\}. \] The longest flow path plays an important role in hydrologic modeling, but its computation requires multi-step raster calculations for each watershed. This research project aims to improve the current process and efficiency of computing the longest flow path for a lot of watersheds. ===== Performance comparisons ===== {{projects:fig-ga-ssd-elapsed-vs-subarea-archydropro.png?400|}} {{projects:ga-elapsed-time-gwrc.png?400|}} ^ Method ^ [[https://github.com/HuidaeCho/grass-lfp-deprecated/blob/master/lfp.sh|lfp.sh]] ^ [[https://github.com/HuidaeCho/grass-lfp-deprecated/blob/master/lfp2.sh|lfp2.sh]] ^ [[https://github.com/OSGeo/grass-addons/tree/master/grass7/raster/r.lfp|r.lfp]] ^ [[https://github.com/OSGeo/grass-addons/tree/master/grass7/raster/r.accumulate|r.accumulate]] ^ ^ Elapsed time | 3h 48m | 9h 8m | 6h 46m | **56s** | ===== References ===== * Huidae Cho, July 2020 in Press. //__A recursive algorithm for calculating the longest flow path and its iterative implementation.__// [[https://www.journals.elsevier.com/environmental-modelling-and-software/|Environmental Modelling & Software]]. [[https://doi.org/10.1016/j.envsoft.2020.104774|10.1016/j.envsoft.2020.104774]]. SCIE, 2018 Impact Factor 4.552, [[https://idea.isnew.info/publications/A%20recursive%20algorithm%20for%20calculating%20the%20longest%20flow%20path%20and%20its%20iterative%20implementation.pdf|Author's Version]]. * [[https://idea.isnew.info/how-to-calculate-the-longest-flow-path-in-grass-gis.html|How to calculate the longest flow path in GRASS GIS]] {{tag>projects}}