A Python-based workflow for generating high-resolution valley floor polygons across California using 10m Digital Elevation Models (DEMs) and National Hydrography Dataset (NHD) flowlines.
This project uses valleyx to extract valley floor boundaries from:
- USGS 3DEP 10-meter Digital Elevation Models
- NHD Medium Resolution Flowlines
The workflow processes data by Hydrologic Unit Code (HUC) regions, allowing for flexible regional analysis and parallel processing.
- Automated downloading of DEM and flowline data
- Parallel processing support through Snakemake
- Configurable parameters for valley floor extraction
- Tools for mosaicking and clipping results
- California-specific boundary and ocean clipping
- Python 3.10 or higher
- Poetry for dependency management
- Git for version control
- Clone the repository:
git clone [email protected]:avkoehl/ca-valley-floors.git
cd ca-valley-floors
- Install dependencies:
# Basic installation
poetry install
# With development tools (matplotlib, jupyter)
poetry install --with dev
- Copy and edit the configuration file:
cp config.yaml my_config.yaml
- Configure the output directory in
my_config.yaml
:
output_base: '/path/to/your/output/directory/'
The workflow supports three methods for selecting HUC regions (configure only one):
- Single HUC:
huc_id: '18050002'
- Multiple specific HUCs:
huc_ids:
- '1802016306'
- '1804001211'
- HUC manifest file:
huc_manifest: './data/target_huc10s.csv'
prefix: '18' # Optional: Filter by prefix
sample_size: 5 # Optional: Sample size
random_seed: 14 # Optional: Random seed
Download DEMs and flowlines:
poetry run snakemake prep_all --configfile my_config.yaml -j 10 --resources download_slots=10
If its the first time, initialize whitebox tools:
poetry run snakemake initialize_whitebox
Process the downloaded data:
poetry run snakemake extract_all --configfile my_config.yaml -j 10
Mosaic results and clip to California boundary (includes ocean clipping):
poetry run snakemake mosaic_ca
Mosaic results with ocean clipping only:
poetry run snakemake mosaic
- Create a custom parameters file:
cp params/params_10m.toml params/my_params.toml
- Update the configuration to use your parameters:
params_file: 'params/my_params.toml'
ca-valley-floors/
├── config.yaml # Main configuration file
├── params/
│ └── params_10m.toml # Valley floor extraction parameters
├── data/ # Input data directory
└── README.md
For questions or issues, contact:
- Arthur Koehl
- Email: avkoehl at ucdavis.edu