DEM reconditioning for hydrological applications
Project description
hydro-snap
Hydro-snap is an efficient tool for seamlessly aligning digital elevation models (DEMs) with mapped stream networks, ensuring accurate hydrological flow paths with minimal terrain alteration.
Example of a flow accumulation before (left) and after (right) alignment with hydro-snap. The DEM on the right has been aligned with the mapped stream network, ensuring accurate hydrological flow paths.
Hydro-snap allows users to:
- Align a DEM with a mapped stream network
- (Optionally) delineate a catchment from a provided outlet point
- (Optionally) force the flow accumulation to be consistent with a provided catchment boundary
The flow direction and accumulation are computed after the DEM has been aligned with the stream network, using the pysheds library.
The outputs of hydro-snap are:
- A reconditioned DEM (corrected_dem_final.tif)
- A flow direction raster (flow_direction.tif)
- A flow accumulation raster (flow_accumulation.tif)
- A catchment delineation raster (catchment.tif)
- The stream network shapefile with an additional incremental rank attribute (streams.shp)
- The stream start points shapefile (stream_starts.shp). Can be used to identify issues with the stream network data.
- The stream end points shapefile (stream_ends.shp). Can be used to identify issues with the stream network data.
Installation
Hydro-snap can be installed using pip:
pip install hydro-snap
The proj library is required to handle the spatial reference system of the DEM and stream network. If you are using Windows, you can install the proj library using conda:
conda install -c conda-forge proj
If you are using Linux, you can install the proj library using apt:
sudo apt-get install libproj-dev
If you are using macOS, you can install the proj library using brew:
brew install proj
Cannot find proj.db? Set the PROJ_DATA environment variable to the directory containing the proj.db file (see https://proj.org/en/9.4/faq.html#why-am-i-getting-the-error-cannot-find-proj-db).
Data requirements
You will need the following data to use hydro-snap:
- A digital elevation model (DEM) in GeoTIFF format (with a spatial reference system)
- A mapped stream network in shapefile format (with a spatial reference system). The lines in the shapefile must be
- oriented in the direction of flow (from upstream to downstream)! The lines can be reversed in GIS software if needed.
- (Optional) A shapefile containing the outlet point of the catchment
- (Optional) A shapefile containing the catchment boundary
- (Optional) A shapefile containing the breaches in catchment boundary
Usage
Hydro-snap can be used to align a DEM with a mapped stream network using the following code:
from hydro_snap import recondition_dem
recondition_dem('path/to/DEM', 'path/to/streams.shp', 'output/dir')
When the catchment outlet is provided, the catchment can be delineated:
from hydro_snap import recondition_dem
# Recondition the DEM
recondition_dem('path/to/DEM', 'path/to/streams.shp', 'output/dir',
outlet_shp='path/to/outlet.shp')
A catchment delineation can be provided to force the flow accumulation to be consistent with its boundary. In order to allow the water to flow out of the catchment, breach(es) in the catchment boundary (outlet) must be provided:
from hydro_snap import recondition_dem
# Recondition the DEM
recondition_dem('path/to/DEM', 'path/to/streams.shp', 'output/dir',
catchment_shp='path/to/catchment.shp',
breaches_shp='path/to/breaches.shp')
Project details
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
File details
Details for the file hydro_snap-0.1.4.tar.gz
.
File metadata
- Download URL: hydro_snap-0.1.4.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e157537beee329b15cb3ea056fe81c50357aa97b1f328bf6c07f57b7351c25e |
|
MD5 | 25c7a806156d10a4e7832b36f1c77026 |
|
BLAKE2b-256 | f462bcbc13c8784026f6b36cd287054101c8e224fc3aea9638c8fffafead1c39 |
File details
Details for the file hydro_snap-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: hydro_snap-0.1.4-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ebfa78fdb4d4bd3909697813bd89f02f15b62effc9a69c1440f6c2b34ff02d3 |
|
MD5 | 45c99f9d0530dc1ef2e4dc5d9ae63575 |
|
BLAKE2b-256 | 6861a8c2ae2fed64e6bc83b84fac2c198674b1901e7cfb4d7faebe040f87fc06 |