Flow direction upscaling toolkit (DMM, NSA, COTAT)
Project description
fdup
fdup is a numba-accelerated Python toolkit containing algorithms for upscaling D8 flow direction grids.
Currently implemented algorithms
- DMM (Double Maximum Method) by Olivera et al., 2002
- NSA (Network Scaling Algorithm) by Fekete et al., 2001
- COTAT (Cell Outlet Tracing with an Area Threshold) by Reed, 2003
Installation
From the repository root:
pip install .
Requirements:
- Python
>=3.10 numpy >= 1.21.3numba >= 0.55.0rasterio >= 1.3.0
Python API usage
# Import call can take 10-15s since all @njit functions are compiled at import time
from fdup.upscalers import DMM, NSA, COTAT
# DMM
dmm = DMM()
dmm.load_flowacc("flowacc.tif")
dmm.upscale(k=20)
dmm.save("out_dmm.tif")
# NSA
nsa = NSA()
nsa.load_flowacc("flowacc.tif")
nsa.upscale(k=20)
nsa.save("out_nsa.tif")
# COTAT
cotat = COTAT()
cotat.load_flowdir("flowdir.tif")
cotat.load_flowacc("flowacc.tif")
cotat.upscale(k=20, area_threshold=10)
cotat.save("out_cotat.tif")
CLI
Besides Python API, fdup features a command-line interface:
fdup --help
DMM
fdup dmm --flowacc flowacc.tif -o out_dmm.tif -k 20
NSA
fdup nsa --flowacc flowacc.tif -o out_nsa.tif -k 20
COTAT
fdup cotat --flowdir flowdir.tif --flowacc flowacc.tif -o out_cotat.tif -k 20 --area-threshold 10
Parameters
-
k: positive integer scaling factor for resulting grid. Output grid cells will bektimes larger than input ones. Note: for DMM,kshould be an even number. -
area-threshold/area_threshold: tracing area threshold (for COTAT only). Defines when to stop tracing original fine-resolution flow directions: larger values of threshold tend to increase the number of diagonal flow directions.
Input data conventions
The tool works with ESRI-style D8 flow direction encoding for input as well as output flow directions.
For input flow accumulation, the supported data types are uint32, float32, float64/double
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fdup-0.1.0.tar.gz.
File metadata
- Download URL: fdup-0.1.0.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63f9d186be60160a20f7422437bba3bcc4b468c18061d01169c6288dc152d9ae
|
|
| MD5 |
5ea0b6e4937ab3bd545527a7bc960b0d
|
|
| BLAKE2b-256 |
36c5e56da5bd6fd2555296805788302e4c8b9bb6804477452be6b9a24e4f5bb6
|
File details
Details for the file fdup-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fdup-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f20d2b5469bbd4108a2327ce3e50ba9e2d8d1343b8e7422b494cd22c0eed5eda
|
|
| MD5 |
54e8046aa6ee0a6190f6395ee0cf4101
|
|
| BLAKE2b-256 |
1e5e529526b16090e2bc348f8d9e40cfc45f828c98381913d780ec64f8b7becc
|