Code accompanying "Can streamflow constrain snow mass reconstruction? Lessons from two synthetic experiments"
This repository contains scientific code and is not actively maintained. The compilation of the correct hydrological model version and python packages is not straightforward, if you're interested in reproducing the experiments using the code presented here, please contact me at [email protected]. If you're interested in reproducing the experiments with your own snow and runoff models, we refer to the Zenodo repository for the necessary data: 10.5281/zenodo.16146617.
This project implements a streamflow-constrained SWE reconstruction framework that:
- Prepares all necessary input data and loads the wflow_sbm hydrological model for a catchment of choice
- Reads a config file containing all necessary model parameters to initialize the model
- Performs repeated model executions with different parameter sets sampled using different algorithms from the SPOTPY package
- Compares against observed streamflow and SWE observations, analyzes results and produces plots
- Supports both local and cluster-based computations
preproc.py- Preprocessing module that sets up experiment configurations, creates directories, and prepares parameter ranges for calibrationgenerate_forcing.py- Generates meteorological forcing data for the hydrological modelwflow_spot_setup.py- Sets up wflow model configurations for spotpy calibration framework
RunWflow_Julia.py- Executes the wflow hydrological model using Julia backendLOA.py- Large-scale analysis class for processing and analyzing model outputs
yearly_compute.py- Performs yearly computations for model calibrationyearly_postproc.py- Post-processes yearly computation resultssoil_compute.py- Computes soil-related model parameterssoil_postproc.py- Post-processes soil computation results
spotpy_calib.py- Implements calibration using the spotpy frameworkspotpy_analysis.py- Analyzes calibration results from spotpyYearlycalib.py- Handles yearly calibration procedures
calc_swe_q_metrics.py- Calculates comprehensive SWE and discharge metricsswe_metrics.py- Contains SWE-specific metric calculationsq_metrics.py- Contains discharge-specific metric calculationsEvaluation.py- Comprehensive evaluation framework for model performance
Synthetic_obs.py- Generates synthetic observations for testingPostruns.py- Handles post-run analysis and processingSwissStations.py- Processes Swiss meteorological station dataSnowClass.py- Snow classification and processing utilities
dump.py- Data dumping and loading utilitieswflow_baseflow.py- Baseflow separation utilitieshydrobricks_catchment.py- Catchment processing using hydrobricksspatial_stuff.py- Spatial data processing utilitiesMeteoSwiss_to_ERA5.py- Converts MeteoSwiss data to ERA5 formatMeteoSwiss2wflow.py- Converts MeteoSwiss data for wflow inputMeteoSwiss2wflowJulia.py- Converts MeteoSwiss data for wflow Juliagenerate_synthetic_obs.py- Generates synthetic observationskmeans_clustering.py- Implements k-means clustering for data analysiscluster_hydrograph_ranges.py- Clusters hydrograph rangesdelete_output_folders.py- Utility to clean output directorieszip_configfiles.py- Archives configuration files
The repository includes several SLURM scripts for cluster execution:
master_slurm.run- Master SLURM script for orchestrating jobsSLURM_*.run- Various SLURM scripts for different computation stages
ewatercycle_config.yaml- eWaterCycle configurationewc_wflowjl_infra.yml- wflow Julia infrastructure configurationewc_wflowjl_infra_nojupyter.yml- wflow Julia configuration without Jupyter
Contains various bash scripts for:
- Yearly calibration
- spotpy settings and execution
- Parallel processing configurations
The codebase requires various Python packages including:
-
numpy, pandas, xarray
-
matplotlib, seaborn
-
rasterio, geopandas
-
spotpy, hydrosignatures
-
wflow (Julia backend)
-
Various hydrological modeling libraries
-
This repository is designed for research purposes in hydrological modeling
-
The code supports both synthetic and real-world experiments
-
Cluster execution is supported through SLURM job scheduling
-
The framework is particularly focused on snow-dominated catchments