valleyx
is a python package for extracting valley floors from digital elevation models.
Combines two approaches:
- low slope areas connected to the flowlines
- elevation above stream thresholding
- Python 3.10 or higher
- Poetry (package manager)
- Clone the repository
git clone git@github.com:avkoehl/valleyx.git
cd valleyx
- Install dependencies using Poetry
poetry install
Optionally install with additional development dependencies including matplotlib and jupyter
poetry install --with dev
Import and use the modules in your python code:
import rioxarray as rxr
import geopandas as gpd
from valleyx import ValleyConfig
from valleyx import extract_valleys
dem = rxr.open_rasterio('path/to/dem.tif')
flowlines = gpd.read_file('path/to/flowlines.shp')
config = ValleyConfig()
floors, flowlines = extract_valleys(dem, flowlines, config)
To customize parameters, create a ValleyConfig
object and modify the
parameters:
config = ValleyConfig()
config.reach.hand_threshold = 5
For more information on the parameters:
help(ValleyConfig)
Arthur Koehl
avkoehl at ucdavis .edu