Rain and Variable Evapotranspiration, Nieve, and Streamflow
Project description
:black_nib: RaVENS
Rain and Variable Evapotranspiration, Nieve, and Streamflow
Package name:
hydroravens
Simple reservoir-based hydrological model
Description
HydroRaVENS is a simple "conceptual" hydrological model that routes daily precipitation through an optional snowpack stage and then through a cascade of one or more linked linear reservoirs (soil-zone water, groundwater, etc.). Evapotranspiration can be supplied from an external data file or computed from temperature using the Thornthwaite–Chang 2019 equation. A water-balance component scales ET (typically the most uncertain input) so that P − Q − ET ≈ 0 over each water year. Model skill is assessed with the Nash–Sutcliffe Efficiency (NSE).
Model overview
Water moves through HydroRaVENS in three sequential stages each day.
Snowpack (optional). When mean air temperature T ≤ 0 °C, precipitation accumulates as snow (stored as snow-water equivalent, SWE). When T > 0 °C, snowpack melts at a positive-degree-day rate and the meltwater is routed to the top subsurface reservoir. Precipitation on warm days bypasses the snowpack and infiltrates directly.
Linear reservoir cascade. One or more subsurface reservoirs are stacked from shallowest (soil zone) to deepest (baseflow groundwater). Each reservoir drains exponentially with a characteristic e-folding residence time τ. At each time step a fraction f of drainage exits as river discharge; the remainder infiltrates to the next-deeper reservoir. Overflow above a maximum storage capacity exits immediately as direct runoff.
Evapotranspiration and water balance. ET is either read from the input file or estimated with the Thornthwaite–Chang 2019 equation (requiring daily Tmax, Tmin, and photoperiod). In either case, ET is scaled by a per-water-year multiplier so that long-term water balance is enforced.
Installation
pip install hydroravens
To install from source for development:
git clone https://github.com/MNiMORPH/hydroRaVENS.git
cd hydroRaVENS
pip install -e .
Quick start
Python API
import hydroravens
b = hydroravens.Buckets()
b.initialize('config.yml')
b.run()
b.computeNSE(verbose=True)
b.plot()
Command-line interface
hydroravens -y config.yml
Configuration file
The model is fully configured through a YAML file. A minimal two-reservoir example:
timeseries:
datafile: input_data.csv # path to the CSV input file
initial_conditions:
water_reservoir_effective_depths__m:
- 2 # top (shallowest) reservoir initial depth
- 400 # bottom reservoir initial depth
snowpack__m_SWE: 0 # initial snowpack depth
catchment:
drainage_basin_area__km2: 3800
evapotranspiration_method: datafile # or ThorntwaiteChang2019
water_year_start_month: 10 # 10 = October (USGS convention)
general:
scalar_dt: true # all time steps must be 1 day
spin_up_cycles: 1 # full-record loops before main run
# Reservoirs listed top (shallowest) to bottom (deepest)
reservoirs:
e_folding_residence_times__days:
- 16
- 2000
exfiltration_fractions: # fraction of drainage going to river discharge
- 0.8 # 0.2 infiltrates to the next layer
- 1.0 # bottom layer: all to discharge
maximum_effective_depths__m:
- .inf
- .inf
snowmelt:
PDD_melt_factor: 1. # mm SWE per positive °C per day
Key configuration options:
| Section | Key | Description |
|---|---|---|
timeseries |
datafile |
Path to the CSV input file |
initial_conditions |
water_reservoir_effective_depths__m |
Initial water depth in each reservoir (m) |
initial_conditions |
snowpack__m_SWE |
Initial snowpack depth (m SWE) |
catchment |
drainage_basin_area__km2 |
Basin area used to convert discharge to specific discharge (mm/day) |
catchment |
evapotranspiration_method |
datafile or ThorntwaiteChang2019 |
catchment |
water_year_start_month |
Month number at which a new water year begins |
general |
spin_up_cycles |
Number of full-record spin-up passes before the main simulation |
reservoirs |
e_folding_residence_times__days |
Exponential residence time for each reservoir (days) |
reservoirs |
exfiltration_fractions |
Fraction of each reservoir's drainage routed to river discharge |
reservoirs |
maximum_effective_depths__m |
Storage cap per reservoir (use .inf for no cap) |
snowmelt |
PDD_melt_factor |
Positive-degree-day melt rate (mm SWE °C⁻¹ day⁻¹) |
Input data format
Input is a daily CSV file. Required and optional columns:
| Column | Units | When required |
|---|---|---|
Date |
— | Always; must be daily with no gaps |
Precipitation [mm/day] |
mm/day | Always |
Discharge [m^3/s] |
m³/s | Always; used to compute NSE |
Mean Temperature [C] |
°C | Snowpack processes |
Minimum Temperature [C] |
°C | ThorntwaiteChang2019 ET |
Maximum Temperature [C] |
°C | ThorntwaiteChang2019 ET |
Photoperiod [hr] |
hours | ThorntwaiteChang2019 ET |
Evapotranspiration [mm/day] |
mm/day | datafile ET method |
The model raises a ValueError if any time step is not exactly 1 day.
Model description
HydroRaVENS is a lumped, daily-timestep conceptual hydrological model. All fluxes are expressed as depth over the drainage basin (mm/day), and the model conserves mass to within numerical precision over each water year.
Snowpack
If Mean Temperature [C] is present in the input file, snowpack processes are enabled.
- Accumulation: When T ≤ 0 °C, P accumulates as SWE.
- Melt: When T > 0 °C, melt = min(SWE, PDD_melt_factor × T × dt). All melt is routed to the top reservoir; surface runoff from snowmelt is not modeled.
- ET deficit: A negative net water input (ET > P) first sublimates snow; any remaining deficit is passed downward to the reservoirs.
Linear reservoirs
Each reservoir drains by first-order exponential decay:
ΔH = H × (1 − exp(−dt / τ))
where H is the current water depth, dt is the time step (days), and τ is the e-folding residence time (days). Of the water drained, a fraction f (exfiltration_fraction) exits as river discharge, and 1 − f infiltrates to the next-deeper reservoir. If inflow exceeds the maximum storage capacity Hmax, the excess exits immediately as discharge.
Reservoirs are stacked top to bottom, and infiltration from one layer becomes the recharge input for the layer below. The bottom reservoir must fully discharge to the river (f = 1) to conserve mass; a warning is issued if this is not the case.
Evapotranspiration
Two methods are supported:
datafile: ET is read directly from the input CSV and scaled per water year so that P − Q − ET ≈ 0.ThorntwaiteChang2019: Daily ET₀ is estimated from Tmax, Tmin, and photoperiod using the modified Thornthwaite equation of Chang et al. (2019), https://doi.org/10.1002/ird.2309. Long-term monthly temperature normals must be passed toBuckets(T_monthly_normals=...)to compute the thermal index I and exponent a beforeinitialize()is called.
In both cases, ET is multiplied by a per-water-year factor (derived from observed P and Q) so that the annual water balance closes. This corrects for systematic bias in ET estimates without altering the seasonal pattern.
Model skill
computeNSE() computes the Nash–Sutcliffe Efficiency:
NSE = 1 − Σ(Q_mod − Q_obs)² / Σ(Q_obs − Q̄_obs)²
NSE = 1 is a perfect simulation; NSE < 0 means the model performs worse than the observed mean as a predictor.
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 hydroravens-2.3.0.tar.gz.
File metadata
- Download URL: hydroravens-2.3.0.tar.gz
- Upload date:
- Size: 34.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d98fe5a722b510e0c65d2fd9a13e3770be711cb25376f0e08c9d183abbbfa4a
|
|
| MD5 |
bdd86e64e74b0ef9de266e4db063bcf0
|
|
| BLAKE2b-256 |
0c922ab5bb6f9d575f556e53a927c9e517b50aabbfc031bbcb129d4a529da492
|
Provenance
The following attestation bundles were made for hydroravens-2.3.0.tar.gz:
Publisher:
publish.yml on MNiMORPH/hydroRaVENS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hydroravens-2.3.0.tar.gz -
Subject digest:
8d98fe5a722b510e0c65d2fd9a13e3770be711cb25376f0e08c9d183abbbfa4a - Sigstore transparency entry: 1509439255
- Sigstore integration time:
-
Permalink:
MNiMORPH/hydroRaVENS@cb6884a643993478e964743d74f40a26e2279ae9 -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/MNiMORPH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cb6884a643993478e964743d74f40a26e2279ae9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file hydroravens-2.3.0-py3-none-any.whl.
File metadata
- Download URL: hydroravens-2.3.0-py3-none-any.whl
- Upload date:
- Size: 36.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
472f3ccf12f22c643a443b282419d9a018fce0cf5dd98423b4947f03c49252a4
|
|
| MD5 |
b9323acac0b7a3577b2669e52b6abc49
|
|
| BLAKE2b-256 |
f9d85dac7123555e6b9d5690ee8dee65f04ca902766e20d2a23d1b4f21c74ce0
|
Provenance
The following attestation bundles were made for hydroravens-2.3.0-py3-none-any.whl:
Publisher:
publish.yml on MNiMORPH/hydroRaVENS
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hydroravens-2.3.0-py3-none-any.whl -
Subject digest:
472f3ccf12f22c643a443b282419d9a018fce0cf5dd98423b4947f03c49252a4 - Sigstore transparency entry: 1509439326
- Sigstore integration time:
-
Permalink:
MNiMORPH/hydroRaVENS@cb6884a643993478e964743d74f40a26e2279ae9 -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/MNiMORPH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cb6884a643993478e964743d74f40a26e2279ae9 -
Trigger Event:
release
-
Statement type: