Skip to content

HuidaeCho/melfp

Repository files navigation

Memory-Efficient Longest Flow Path (MELFP)

Part of the Memory-Efficient I/O-Improved Drainage Analysis System (MIDAS)

A journal manuscript on this algorithm is currently under review.

Predefined flow direction encodings in GeoTIFF: power2 (default, r.terraflow, ArcGIS), taudem (d8flowdir), 45degree (r.watershed), degree
image image image image

Custom flow direction encoding is also possible by passing -e E,SE,S,SW,W,NW,N,NE (e.g., 1,8,7,6,5,4,3,2 for taudem).

Test data

You can find test data at https://data.isnew.info/melfp.html.

How to test on Linux

  1. Build MELFP first
  2. Test it
cd test
./pretest.sh
./test.sh

How to test on Windows

For testing on Windows, you don't need to build MELFP yourself. test\test.bat will use the included binary windows\melfp.exe. However, the Windows version was about 12 times slower than the Linux version for 515,152 outlets on the same hardware.

cd test
pretest.bat
test.bat

How to build on Linux

  1. First, install the GDAL library.
  2. Build MELFP
make

or

mkdir build
cd build
cmake ..
make

How to build on Windows

  1. Install Visual Studio Community Edition. Select these two components:
    • MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
    • Windows 11 SDK (10.0.26100.0)
  2. Install Git for Windows
  3. Install Miniconda
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
Miniconda3-latest-Windows-x86_64.exe /S /D=C:\opt\miniconda
C:\opt\miniconda\condabin\conda.bat init
  1. Start Developer Command Prompt for VS 2022
  2. Setup Conda for GRASS build
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create -n melfp cmake libgdal
conda activate melfp
  1. Download the source code
cd \opt
git clone git@github.com:HuidaeCho/melfp.git
cd melfp
mkdir build
cd build
  1. Build MELFP
cmake ..
msbuild melfp.sln -p:configuration=release

or

cmake ..
cmake --build . --config Release

or

cmake -DCMAKE_CONFIGURATION_TYPES=Release
msbuild melfp.sln
  1. Find melfp.exe in Release\melfp.exe

About

Memory-Efficient Longest Flow Path (MELFP)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages