Models
The following model structures are currently implemented:
Common options
All models accept the following options at instantiation:
solver: numerical solver to use; choices areheun_explicit(default),runge_kutta, andeuler_explicit.record_all(defaultFalse): whenTrue, all fluxes and state variables are recorded at every time step. This slows computation and produces large output files. Enable only for diagnostic analysis, not during calibration.land_cover_types: list of land cover types (e.g.,['open', 'glacier']). See the section on the spatial structure.land_cover_names: list of land cover names. Each entry must correspond to a type inland_cover_types. Names distinguish similar types, for example bare-ice and debris-covered glaciers. See the section on the spatial structure.
Example:
socont = models.Socont(solver="heun_explicit", record_all=False)
GSM-Socont
GSM-Socont is a conceptual glacio-hydrological model described in Schaefli et al. [2005].
Spatial structure: semi-lumped (elevation bands)
Time step: daily
Specific options
soil_storage_nb:1or2. Number of soil reservoirs; the second represents the baseflow component (not in the original model).surface_runoff:socont_runoff(the original non-linear quick reservoir) orlinear_storage(a classic linear storage).snow_melt_process: melt model to use; see melt models. Default:"melt:degree_day".glacier_infinite_storage(defaultTrue): treat the glacier ice as an infinite store.glacier_module(default"gsm"): glacier formulation; see glacier modules.
Parameters
Precipitation (snow/rain transition)
prec_t_start(optional, °C, default: 0, [-2, 2])Temperature below which precipitation is 100% snow. The rain/snow transition is linear between
prec_t_startandprec_t_end.Full name:
snow_rain_transition:transition_start.
prec_t_end(optional, °C, default: 2, [0, 4])Temperature above which precipitation is 100% liquid.
Full name:
snow_rain_transition:transition_end.
Snow (melt:degree_day)
a_snow(mm/d/°C, no default, [1, 12])Degree-day snow melt factor. \(a_\mathrm{snow}\) in Schaefli et al. [2005].
Full name:
snowpack:degree_day_factor.
melt_t_snow(optional, °C, default: 0, [0, 5])Temperature above which snow starts to melt.
Full name:
snowpack:melting_temperature.
Glacier (melt:degree_day)
a_ice(single type),a_ice_<name>,a_ice_<i>(mm/d/°C, no default, [5, 20])Degree-day ice melt factor. \(a_\mathrm{ice}\) in Schaefli et al. [2005].
<name>is the land cover name (e.g.,glacier_debris);<i>is the index of similar land covers (e.g.,a_ice_glacier_debris,a_ice_1).Full name:
<name>:degree_day_factor.
melt_t_ice(optional, °C, default: 0, [0, 5])Temperature above which ice starts to melt.
Full name:
<name>:melting_temperature.
Glacier area lumped reservoir
k_snow(1/d, no default, [0.05, 0.25])Response factor for the lumped reservoir receiving rain and snowmelt water from the glacier area. Similar to \(k_\mathrm{snow}\) in Schaefli et al. [2005], but in different units.
Full name:
glacier_area_rain_snowmelt_storage:response_factor.
k_ice(1/d, no default, [0.05, 1])Response factor for the lumped reservoir receiving ice melt water. Similar to \(k_\mathrm{ice}\) in Schaefli et al. [2005], but in different units.
Full name:
glacier_area_icemelt_storage:response_factor.
Quick runoff (non-linear version)
beta(m^(4/3)/s, no default, [100, 30000])Runoff coefficient (to calibrate).
Full name:
surface_runoff:runoff_coefficient.
Quick runoff (linear version)
k_quick(1/d, no default, [0.05, 1])Response factor for the quick reservoir.
Full name:
surface_runoff:response_factor.
Slow reservoir
A(mm, no default, [10, 3000])Maximum storage capacity of the slow reservoir.
Full name:
slow_reservoir:capacity.
k_slow,k_slow_1(1/d, no default, [0.001, 1])Response factor for the slow reservoir. Same as \(k\) in Schaefli et al. [2005], but in different units.
Full name:
slow_reservoir:response_factor.
Baseflow (optional)
percol(mm/d, no default, [0, 10])Percolation rate from the first slow reservoir to the baseflow reservoir.
Full name:
slow_reservoir:percolation_rate.
k_slow_2(1/d, no default, [0.001, 1])Response factor for the baseflow reservoir.
Full name:
slow_reservoir_2:response_factor.
For the melt:degree_day_aspect and melt:temperature_index options, see
Snow / Glacier melt parameters under Shared processes.
Pre-defined parameter constraints:
Glacier
a_snow < a_ice
Slow reservoir
k_slow_1 < k_quickk_slow_2 < k_quickk_slow_2 < k_slow_1
GR4J
GR4J (Génie Rural à 4 paramètres Journalier) is a parsimonious daily rainfall-runoff model described in Perrin et al. [2003]. It is well suited for non-glacierized or weakly glacierized catchments. Snow can optionally be accounted for using either the CemaNeige model or a simple degree-day approach.
Spatial structure: lumped
Time step: daily
Specific options
snow_melt_process: snow model to use. Options:None(default): no snow accounting."melt:cemaneige": CemaNeige thermal-state model (recommended for catchments with significant seasonal snow). See processes page."melt:degree_day": simple degree-day model.
snow_redistribution: optional snow redistribution process (e.g.,'transport:snow_slide'). See the snow redistribution section.
Parameters
Production store
X1(mm, default: 350, [100, 1200])Maximum capacity of the production store.
Full name:
production_store:capacity.
Groundwater exchange
X2(mm/d, default: 0, [-10, 5])Groundwater exchange coefficient. Negative values indicate a net loss (deep percolation); positive values indicate recharge from outside the catchment.
Full name:
uh_input:exchange_factor.
Routing store
X3(mm, default: 90, [1, 500])Maximum capacity of the routing store.
Full name:
uh_input:routing_capacity.
Unit hydrograph
X4(d, default: 1.7, [0.5, 4])Time base of the unit hydrograph. Must be > 0.5 d.
Full name:
uh_input:uh_base_time.
For CemaNeige parameters (melt:cemaneige), see
Snow / Glacier melt parameters under Shared processes.
When snow_melt_process='melt:degree_day', only a_snow (alias Kf)
and Tmelt are added.
Usage examples
Minimal run without snow:
import hydrobricks as hb
import hydrobricks.models as models
gr4j = models.GR4J()
parameters = gr4j.generate_parameters()
parameters.set_values({'X1': 350, 'X2': 0, 'X3': 90, 'X4': 1.7})
hydro_units = hb.HydroUnits()
hydro_units.load_from_csv(
'path/to/hydro_units.csv',
column_elevation='elevation',
column_area='area'
)
forcing = hb.Forcing(hydro_units)
forcing.load_station_data_from_csv(
'path/to/meteo.csv',
column_time='Date',
time_format='%d/%m/%Y',
content={'precipitation': 'precip(mm/day)', 'pet': 'pet(mm/day)'}
)
forcing.spatialize_from_station_data(
variable='precipitation',
ref_elevation=1250,
gradient=0.05
)
forcing.spatialize_from_station_data(variable='pet')
gr4j.setup(
spatial_structure=hydro_units,
output_path='path/to/outputs',
start_date='1981-01-01',
end_date='2020-12-31'
)
gr4j.run(parameters=parameters, forcing=forcing)
GR6J
GR6J (Pushpalatha et al. [2011]) is a six-parameter daily rainfall-runoff model that extends GR4J to improve low-flow simulation while preserving high-flow performance. It keeps the GR4J production store, interception, throughfall and ET unchanged, and modifies only the routing (see GR6J routing):
the groundwater exchange becomes threshold-based,
F = X2 (R/X3 - X5)(the GR5J form), where the dimensionless thresholdX5lets the exchange change sign within the year;an additional exponential routing store (coefficient
X6) is added in parallel to the power routing store, which is effective at reproducing long recessions.Spatial structure: lumped
Time step: daily
Specific options
Identical to GR4J (discrete, snow_melt_process,
snow_redistribution).
Parameters
X1-X4 are identical to GR4J. GR6J adds two parameters:
Groundwater exchange threshold
X5(-, default: 0, [-2, 2])Threshold on the routing-store filling ratio
R/X3at which the groundwater exchange changes sign (commonly negative; range follows airGR).Full name:
uh_input:exchange_threshold.
Exponential store
X6(mm, default: 4, [0.05, 20])Coefficient of the exponential routing store. Must be > 0.
Full name:
uh_input:exp_store_coeff.
For CemaNeige parameters (melt:cemaneige), see
Snow / Glacier melt parameters under Shared processes.
Usage example
GR6J is used exactly like GR4J, with two extra parameters:
import hydrobricks as hb
import hydrobricks.models as models
gr6j = models.GR6J()
parameters = gr6j.generate_parameters()
parameters.set_values({'X1': 350, 'X2': 0, 'X3': 90, 'X4': 1.7, 'X5': 0, 'X6': 4})
# ... load hydro_units and forcing as for GR4J ...
gr6j.setup(
spatial_structure=hydro_units,
output_path='path/to/outputs',
start_date='1981-01-01',
end_date='2020-12-31'
)
gr6j.run(parameters=parameters, forcing=forcing)
HBV-96
HBV-96 (Lindström et al. [1997]) is the revised version of the HBV model
(Bergström [1976]), a widely used conceptual rainfall-runoff model.
The hydrobricks implementation consists of an abstract HBV base class,
which holds the routines shared by the HBV versions, and the HBV96 model
class, which adds the HBV-96 response routine. Future HBV variants only need
to provide their own response routine.
The structure chains four routines:
Snow routine: degree-day melt (CFMAX, TT) with liquid water retention in the snowpack (holding capacity CWH) and refreezing of the retained water (refreezing coefficient CFR). As in the original model, rain falls onto the snowpack: it is added to the liquid water storage, where it can be retained and refrozen; without snow it passes through to the ground within the same time step. See snowpack water retention.
Soil moisture routine: the incoming water (rain and snowpack outflow) is split between the soil moisture storage (capacity FC) and the response routine using the beta function; evapotranspiration is limited by the LP fraction (see infiltration:hbv and et:hbv). With several land covers each has, by default, its own soil moisture store (the original HBV land-use formulation); set
share_soil=Trueto use a single shared store.Response routine (HBV-96 specific): a non-linear upper zone (\(Q_0 = k_{uz} \cdot UZ^{1+\alpha}\)), a constant-rate percolation (PERC) to a linear lower zone (\(Q_1 = k_{lz} \cdot LZ\)), and an optional capillary transport (CFLUX) returning water from the upper zone to the soil moisture storage.
Transformation function: the total runoff is smoothed by the MAXBAS triangular unit hydrograph (see routing:hbv).
The model is integrated by the ODE solver, so the results are a continuous approximation of the original discrete HBV-96 formulation.
Beyond the default open cover, HBV supports the HBV land-use classes as land
covers — forest, lake and glacier — each with its own behaviour; see
HBV land covers.
Spatial structure: lumped or semi-lumped (elevation bands)
Time step: daily
Specific options
snow_melt_process: melt model to use; see melt models. Default:"melt:degree_day". Must be"melt:degree_day"when snow refreezing is enabled.share_soil(defaultFalse): share a single soil moisture store across all land covers instead of one store per cover (see HBV land covers).forest_interception(defaultFalse): add a canopy interception store on eachforestcover (only relevant with aforestcover; see HBV land covers).glacier_infinite_storage(defaultTrue): treat the glacier ice as an infinite store (only relevant with aglaciercover).glacier_module(default"gsm"): glacier formulation; see glacier modules (only relevant with aglaciercover).snow_water_retention_process: outflow process of the snowpack liquid water storage. Default:"outflow:snow_holding"(the HBV holding capacity CWH).Nonedisables the liquid water retention (melt water then leaves the snowpack directly).snow_refreezing_process: refreezing process of the retained liquid water. Default:"refreeze:degree_day"(the HBV refreezing coefficient CFR).Nonedisables refreezing. Requires a snow water retention process.rain_to_snowpack(defaultTrue): route the rain to the snowpack liquid water storage instead of the ground, as in the original HBV snow routine. Requires a snow water retention process.snow_rain_process: rain/snow partitioning method. Default:None, i.e."snow_rain:linear", which matches the HBV-96 linear transition over TT ± TTI/2 (see rain/snow partitioning).snow_redistribution: optional snow redistribution process (e.g.,'transport:snow_slide'). See the snow redistribution section.
Parameters
The parameters are exposed under their literature names (as aliases).
Precipitation (snow/rain transition)
The linear rain/snow transition parameters prec_t_start and prec_t_end
are the same as in GSM-Socont; together they correspond to
the HBV-96 transition interval TT ± TTI/2.
Snow routine
cfmax(mm/d/°C, no default, [2, 20])Degree-day snow melt factor.
Full name:
snowpack:degree_day_factor.
tt(optional, °C, default: 0, [0, 5])Threshold/melting temperature.
Full name:
snowpack:melting_temperature.
cwh(optional, dimensionless, default: 0.1, [0, 0.2])Liquid water holding capacity of the snowpack, as a fraction of the snow water equivalent.
Full name:
snowpack:water_holding_capacity.
cfr(optional, dimensionless, default: 0.05, [0, 0.1])Refreezing coefficient of the retained liquid water.
Full name:
snowpack:refreezing_factor.
Soil moisture routine
With a single soil-bearing land cover (or share_soil=True) the aliases below are
used as-is. With several soil-bearing covers and per-class soils (the default), they
take a per-cover suffix instead — fc_<cover>, lp_<cover>, beta_<cover>,
cevpf_<cover> (e.g. fc_forest) — and the full names use the cover’s store
(<cover>_soil_moisture:...).
fc(mm, no default, [0, 3000])Maximum soil moisture storage capacity.
Full name:
soil_moisture:capacity.
lp(dimensionless, default: 0.9, [0.3, 1])Fraction of
fcabove which the actual evapotranspiration reaches the potential rate.Full name:
soil_moisture:lp.
cevpf(optional, dimensionless, default: 1, [0.5, 2])Evapotranspiration correction factor, scaling the potential evaporation: \(E_a = \mathrm{cevpf} \cdot \mathrm{PET} \cdot \min(SM/(LP \cdot FC), 1)\). Set it per cover (e.g.
cevpf_forest> 1) to give a higher evaporation over forests.Full name:
soil_moisture:et_correction_factor.
beta(dimensionless, default: 2, [1, 6])Shape coefficient of the recharge (beta) function.
Full name:
open:beta(<cover>:betain general).
Response routine
k_uz(mm^(-alpha)/d, no default, [0.0001, 1])Response factor of the non-linear upper zone.
Full name:
upper_zone:response_factor.
alpha,alfa(dimensionless, default: 1, [0, 3])Non-linearity coefficient of the upper zone runoff (
alfais the SMHI spelling).Full name:
upper_zone:alpha.
perc(mm/d, no default, [0, 10])Constant percolation rate from the upper to the lower zone.
Full name:
upper_zone:percolation_rate.
cflux(optional, mm/d, default: 0, [0, 3])Maximum capillary flux from the upper zone back to the soil moisture storage.
Full name:
upper_zone:max_capillary_flux.
k_lz,k4(1/d, no default, [0.0001, 1])Response factor of the linear lower zone.
Full name:
lower_zone:response_factor.
Transformation function
maxbas(d, default: 1, [1, 10])Base length of the triangular unit hydrograph.
Full name:
routing:maxbas.
Pre-defined parameter constraints:
k_lz < k_uza_snow < a_ice(only with aglaciercover)
Land covers
In addition to the default open cover (the HBV “open areas” class; the former
ground name is kept as an accepted alias), HBV accepts the HBV land-use classes as
land covers (land_cover_types). Each soil-bearing cover (open, forest) has,
by default, its own soil moisture store feeding the shared response routine;
share_soil=True collapses them into one. The soil/recharge parameters are then
exposed per cover (fc_<cover>, lp_<cover>, beta_<cover>).
forest — a soil-bearing cover that, when
forest_interception=True, intercepts rain in a canopy store on the rain path (upstream of the snowpack): the canopy holds up to the interception capacity, evaporates at the potential rate, and passes the excess as throughfall (snowmelt bypasses the canopy). Interception is off by default, in which case aforestcover behaves like a generic soil cover (it can still differ fromopenthrough its own per-class soil parameters andcevpf).ic(oric_<cover>with several forests) (mm, optional, default: 2, [0, 10])Canopy interception capacity (only with
forest_interception=True). Full name:<cover>_canopy:capacity.
lake — an exclusive open-water cover (a lake unit is entirely lake). All precipitation enters the lake directly (no snowpack), the open water evaporates at the potential rate, and a linear outflow drains to the outlet. Lake units use a dedicated no-snow structure variant.
k_lake(ork_lake_<cover>) (1/d, no default, [0.0001, 1])Response factor of the lake’s linear outflow. Full name:
<cover>_storage:response_factor.
glacier — Socont-style glacier handled by the glacier module: the glacierized area drains its rain + snowmelt and its ice melt to two catchment-level linear reservoirs. Parameters
a_ice(ice melt factor),k_snowandk_ice(reservoir response factors) are as in GSM-Socont.
At least one soil-bearing cover (open or forest) is required.
Usage example
import hydrobricks as hb
import hydrobricks.models as models
hbv = models.HBV96()
parameters = hbv.generate_parameters()
parameters.set_values({
'cfmax': 3, 'tt': 0, 'cwh': 0.1, 'cfr': 0.05,
'fc': 250, 'lp': 0.9, 'beta': 2,
'k_uz': 0.2, 'alpha': 1, 'perc': 0.7, 'cflux': 0.5, 'k_lz': 0.05,
'maxbas': 2.5
})
# ... load hydro_units and forcing as for the other models ...
hbv.setup(
spatial_structure=hydro_units,
output_path='path/to/outputs',
start_date='1981-01-01',
end_date='2020-12-31'
)
hbv.run(parameters=parameters, forcing=forcing)