Models

Documentation of all hydrological models implemented in the rrmpg.models module.

ABC-Model

Implementation of the model described in:

Myron B. Fiering "Streamflow synthesis" Cambridge, Harvard University
Press, 1967. 139 P. (1967).

Explanation of the model parameters:

  • a: describes the fraction of precipitation that percolates through the soil to the groundwater.

  • b: describes the fraction of the precipitaion that is directly lost to the atmosphere through evapotranspiration.

  • c: describes the amount of groundwater that leaves the storage and drains into the stream.

Model inputs for simulation:

  • prec: Array of (summed) precipitation for each timestep. [mm/day]

Class documentation

class rrmpg.models.ABCModel(params=None)[source]

Interface to the the ABC-Model.

This model implements the classical ABC-Model. It was developed for educational purpose and represents a simple linear model.

Original Publication:

Myron B. Fiering “Streamflow synthesis” Cambridge, Harvard University Press, 1967. 139 P. (1967).

If no model parameters are passed upon initialization, generates random parameter set.

Parameters

params – (optional) Dictonary containing all model parameters as a seperate key/value pairs.

fit(qobs, prec, initial_state=0)[source]

Fit the model to a timeseries of discharge using.

This functions uses scipy’s global optimizer (differential evolution) to find a good set of parameters for the model, so that the observed discharge is simulated as good as possible.

Parameters
  • qobs – Array of observed streaflow discharge.

  • prec – Array of precipitation data.

  • initial_state – (optional) Initial value for the storage.

Returns

A scipy OptimizeResult class object.

Return type

res

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

get_default_bounds()

Return the dictionary containing the default parameter bounds.

get_dtype()

Return the custom model datatype.

get_parameter_names()

Return the list of parameter names.

get_params()

Return a dict with all model parameters and their current value.

get_random_params(num=1)[source]

Generate random sets of model parameters for the ABC-model.

The ABC-model has specific parameter constraints, therefore we will overwrite the function of the BaseModel, to generated random model parameters, that satisfy the ABC-Model constraints.

Parameters

num – (optional) Integer, specifying the number of parameter sets, that will be generated. Default is 1.

Returns

A dict containing one key/value pair for each model parameter.

set_params(params)

Set model parameters to values passed in params.

Parameters

params – Either a dictonary containing model parameters as key/value pairs or a numpy array of the models own custom dtype. For the case of dictionaries, they can contain only one model parameter or many/all. The naming of the parameters must be identical to the names specified in the _param_list. All parameter values must be numerical.

Raises
  • ValueError – If any parameter is not a numerical value.

  • AttributeError – If the parameter dictonary contains a key, that doesn’t match any of the parameter names.

  • TypeError – If the numpy array of the parameter does not fit the custom data type of the model or it’s neither a dict nor a numpy ndarray.

simulate(prec, initial_state=0, return_storage=False, params=None)[source]

Simulate the streamflow for the passed precipitation.

This function makes sanity checks on the input and then calls the externally defined ABC-Model function.

Parameters
  • prec – Precipitation data for each timestep. Can be a List, numpy array or pandas.Series

  • initial_state – (optional) Initial value for the storage.

  • return_storage – (optional) Boolean, wether or not to return the simulated storage for each timestep.

  • params – (optional) Numpy array of parameter sets, that will be evaluated a once in parallel. Must be of the models own custom data type. If nothing is passed, the parameters, stored in the model object, will be used.

Returns

An array with the simulated stream flow for each timestep and optional an array with the simulated storage.

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

HBV education

Implementation of the model described in:

Aghakouchak, Amir, and Emad Habib. "Application of a conceptual hydrologic
model in teaching hydrologic processes." International Journal of
Engineering Education 26.4 (S1) (2010).

Explanation of the model parameters:

  • T_t: Threshold temperature. Decides if snow is melting or accumulating.

  • DD: Degree-day factor. Indicates the decrease of the water content in the snow cover.

  • FC: Field capacity. Describes the maximum soil moisture storage in the subsurface zone.

  • Beta: Shape coefficient. Controls the amount of liquid water (Precipitation + melting Snow), which contributes to runoff.

  • C: Improves model performance, when mean daily temperature deviates considerably from long-term mean.

  • PWP: Permanent Wilting Point. Is a soil-moisture limit for evapotranspiration.

  • K_0: Near surface flow storage coefficient.

  • K_1: Interflow storage coefficient. K_1 should be smaller than K_0.

  • K_2: Baseflow storage coefficient. K_2 should be smaller than K_1.

  • K_p: Percolation storage coefficient.

  • L: Threshold of the water level in the upper storage.

Model inputs for simulation:

  • temp: Array of (mean) temperature for each timestep.

  • prec: Array of (summed) precipitation for each timestep. [mm/day]

  • month: Array of integers indicating for each timestep to which month it belongs [1,2, …, 12]. Used for adjusted potential evapotranspiration.

  • PE_m: long-term mean monthly potential evapotranspiration.

  • T_m: long-term mean monthly temperature.

Class documentation

class rrmpg.models.HBVEdu(params=None)[source]

Interface to the educational version of the HBV model.

This class builds an interface to the HBV educational model as presented in [1]. This model should only be used with daily data.

If no model parameters are passed upon initialization, generates random parameter set.

Parameters

params – (optional) Dictonary containing all model parameters as a seperate key/value pairs.

Raises

ValueError – If a dictionary of model parameters is passed but one of the parameters is missing.

[1] Aghakouchak, Amir, and Emad Habib. “Application of a conceptual hydrologic model in teaching hydrologic processes.” International Journal of Engineering Education 26.4 (S1) (2010).

fit(qobs, temp, prec, month, PE_m, T_m, snow_init=0.0, soil_init=0.0, s1_init=0.0, s2_init=0.0)[source]

Fit the HBVEdu model to a timeseries of discharge.

This functions uses scipy’s global optimizer (differential evolution) to find a good set of parameters for the model, so that the observed discharge is simulated as good as possible.

Parameters
  • qobs – Array of observed streamflow discharge.

  • temp – Array of (mean) temperature for each timestep.

  • prec – Array of (summed) precipitation for each timestep.

  • month – Array of integers indicating for each timestep to which month it belongs [1,2, …, 12]. Used for adjusted potential evapotranspiration.

  • PE_m – long-term mean monthly potential evapotranspiration.

  • T_m – long-term mean monthly temperature.

  • snow_init – (optional) Initial state of the snow reservoir.

  • soil_init – (optional) Initial state of the soil reservoir.

  • s1_init – (optional) Initial state of the near surface flow reservoir.

  • s2_init – (optional) Initial state of the base flow reservoir.

Returns

A scipy OptimizeResult class object.

Return type

res

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

  • RuntimeErrror – If the monthly arrays are not of size 12 or there is a size mismatch between precipitation, temperature and the month array.

get_default_bounds()

Return the dictionary containing the default parameter bounds.

get_dtype()

Return the custom model datatype.

get_parameter_names()

Return the list of parameter names.

get_params()

Return a dict with all model parameters and their current value.

get_random_params(num=1)

Generate random sets of model parameters in the default bounds.

Samples num values for each model parameter from a uniform distribution between the default bounds.

Parameters

num – (optional) Integer, specifying the number of parameter sets, that will be generated. Default is 1.

Returns

A numpy array of the models custom data type, containing the at random generated parameters.

set_params(params)

Set model parameters to values passed in params.

Parameters

params – Either a dictonary containing model parameters as key/value pairs or a numpy array of the models own custom dtype. For the case of dictionaries, they can contain only one model parameter or many/all. The naming of the parameters must be identical to the names specified in the _param_list. All parameter values must be numerical.

Raises
  • ValueError – If any parameter is not a numerical value.

  • AttributeError – If the parameter dictonary contains a key, that doesn’t match any of the parameter names.

  • TypeError – If the numpy array of the parameter does not fit the custom data type of the model or it’s neither a dict nor a numpy ndarray.

simulate(temp, prec, month, PE_m, T_m, snow_init=0, soil_init=0, s1_init=0, s2_init=0, return_storage=False, params=None)[source]

Simulate rainfall-runoff process for given input.

This function bundles the model parameters and validates the meteorological inputs, then calls the optimized model routine. The meteorological inputs can be either list, numpy array or pandas Series.

Parameters
  • temp – Array of (mean) temperature for each timestep.

  • prec – Array of (summed) precipitation for each timestep.

  • month – Array of integers indicating for each timestep to which month it belongs [1,2, …, 12]. Used for adjusted potential evapotranspiration.

  • PE_m – long-term mean monthly potential evapotranspiration.

  • T_m – long-term mean monthly temperature.

  • snow_init – (optional) Initial state of the snow reservoir.

  • soil_init – (optional) Initial state of the soil reservoir.

  • s1_init – (optional) Initial state of the near surface flow reservoir.

  • s2_init – (optional) Initial state of the base flow reservoir.

  • return_storage – (optional) Boolean, indicating if the model storages should also be returned.

  • params – (optional) Numpy array of parameter sets, that will be evaluated a once in parallel. Must be of the models own custom data type. If nothing is passed, the parameters, stored in the model object, will be used.

Returns

An array with the simulated streamflow and optional one array for each of the four reservoirs.

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

  • RuntimeErrror – If the monthly arrays are not of size 12 or there is a size mismatch between precipitation, temperature and the month array.

GR4J

Implementation of the model described in:

Perrin, Charles, Claude Michel, and Vazken Andréassian. "Improvement of a
parsimonious model for streamflow simulation." Journal of hydrology 279.1
(2003): 275-289.

Explanation of the model parameters:

  • x1: maximum capacity of the production store [mm]

  • x2: groundwater exchange coefficient [mm]

  • x3: one day ahead maximum capacity of the routing store [mm]

  • x4: time base of the unit hydrograph UH1 [days]

Model inputs for simulation:

  • prec: Array of precipitation [mm/day]

  • etp: Array mean potential evapotranspiration [mm]

Class documentation

class rrmpg.models.GR4J(params=None)[source]

Interface to the GR4J hydrological model.

This class builds an interface to the GR4J model, as presented in [1]. This model should only be used with daily data.

If no model parameters are passed upon initialization, generates random parameter set.

[1] Perrin, Charles, Claude Michel, and Vazken Andréassian. “Improvement of a parsimonious model for streamflow simulation.” Journal of hydrology 279.1 (2003): 275-289.

Parameters

params – (optional) Dictionary containing all model parameters as a separate key/value pairs.

Raises

ValueError – If a dictionary of model parameters is passed but one of the parameters is missing.

fit(qobs, prec, etp, s_init=0.0, r_init=0.0)[source]

Fit the GR4J model to a timeseries of discharge.

This functions uses scipy’s global optimizer (differential evolution) to find a good set of parameters for the model, so that the observed discharge is simulated as good as possible.

Parameters
  • qobs – Array of observed streamflow discharge [mm/day]

  • prec – Array of daily precipitation sum [mm]

  • etp – Array of mean potential evapotranspiration [mm]

  • s_init – (optional) Initial value of the production storage as fraction of x1.

  • r_init – (optional) Initial value of the routing storage as fraction of x3.

Returns

A scipy OptimizeResult class object.

Return type

res

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

  • RuntimeErrror – If there is a size mismatch between the precipitation and the pot. evapotranspiration input.

get_default_bounds()

Return the dictionary containing the default parameter bounds.

get_dtype()

Return the custom model datatype.

get_parameter_names()

Return the list of parameter names.

get_params()

Return a dict with all model parameters and their current value.

get_random_params(num=1)

Generate random sets of model parameters in the default bounds.

Samples num values for each model parameter from a uniform distribution between the default bounds.

Parameters

num – (optional) Integer, specifying the number of parameter sets, that will be generated. Default is 1.

Returns

A numpy array of the models custom data type, containing the at random generated parameters.

set_params(params)

Set model parameters to values passed in params.

Parameters

params – Either a dictonary containing model parameters as key/value pairs or a numpy array of the models own custom dtype. For the case of dictionaries, they can contain only one model parameter or many/all. The naming of the parameters must be identical to the names specified in the _param_list. All parameter values must be numerical.

Raises
  • ValueError – If any parameter is not a numerical value.

  • AttributeError – If the parameter dictonary contains a key, that doesn’t match any of the parameter names.

  • TypeError – If the numpy array of the parameter does not fit the custom data type of the model or it’s neither a dict nor a numpy ndarray.

simulate(prec, etp, s_init=0.0, r_init=0.0, return_storage=False, params=None)[source]

Simulate rainfall-runoff process for given input.

This function bundles the model parameters and validates the meteorological inputs, then calls the optimized model routine. The meteorological inputs can be either list, numpy arrays or pandas Series.

Parameters
  • prec – Array of daily precipitation sum [mm]

  • etp – Array of mean potential evapotranspiration [mm]

  • s_init – (optional) Initial value of the production storage as fraction of x1.

  • r_init – (optional) Initial value of the routing storage as fraction of x3.

  • return_stprage – (optional) Boolean, indicating if the model storages should also be returned.

  • params – (optional) Numpy array of parameter sets, that will be evaluated a once in parallel. Must be of the models own custom data type. If nothing is passed, the parameters, stored in the model object, will be used.

Returns

An array with the simulated streamflow and optional one array for each of the two storages.

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

  • RuntimeError – If there is a size mismatch between the precipitation and the pot. evapotranspiration input.

Cemaneige

Implementation of the model described in:

Valéry, A. "Modélisation précipitations – débit sous influence nivale.
Élaboration d’un module neige et évaluation sur 380 bassins versants".
PhD thesis, Cemagref (Antony), AgroParisTech (Paris), 405 pp. (2010)

Explanation of the model parameters:

  • CTG: snow-pack inertia factor

  • Kf: day-degree factor

Model inputs for simulation:

  • prec: Array of daily precipitation sum [mm]

  • mean_temp: Array of the mean temperature [C]

  • min_temp: Array of the minimum temperature [C]

  • max_temp: Array of the maximum temperature [C]

  • met_station_height: Height of the meteorological station [m]. Needed to calculate the fraction of solid precipitation and optionally for the extrapolation of the meteorological inputs.

  • altitudes: (optionally) List of the median elevation of each elevation layer.

Class documentation

class rrmpg.models.Cemaneige(params=None)[source]

Interface to the Cemaneige snow routine.

This class builds an interface to the implementation of the Cemaneige snow acounting model, originally developed by A. Valery [1] (french) and also presented in [2] (english). This model should only be used with daily data.

If no model parameters are passed upon initialization, generates random parameter set.

[1] Valéry, A. “Modélisation précipitations – débit sous influence nivale. Élaboration d’un module neige et évaluation sur 380 bassins versants”. PhD thesis, Cemagref (Antony), AgroParisTech (Paris), 405 pp. (2010)

[2] Audrey Valery, Vazken Andreassian, Charles Perrin. “‘As simple as possible but not simpler’: What is useful in a temperature-based snow- accounting routine? Part 2 - Sensitivity analysis of the Cemaneige snow accounting routine in 380 Catchments.” Journal of Hydrology 517 (2014) 1176-1187.

Parameters

params – (optional) Dictonary containing all model parameters as a seperate key/value pairs.

Raises

ValueError – If a dictionary of model parameters is passed but one of the parameters is missing.

fit(obs, prec, mean_temp, min_temp, max_temp, met_station_height, snow_pack_init=0, thermal_state_init=0, altitudes=[])[source]

Fit the Cemaneige model to a observed timeseries

This functions uses scipy’s global optimizer (differential evolution) to find a good set of parameters for the model, so that the observed timeseries is simulated as good as possible.

Parameters
  • obs – Array of the observed timeseries [mm]

  • prec – Array of daily precipitation sum [mm]

  • mean_temp – Array of the mean temperature [C]

  • min_temp – Array of the minimum temperature [C]

  • max_temp – Array of the maximum temperature [C]

  • met_station_height – Height of the meteorological station [m]. Needed to calculate the fraction of solid precipitation and optionally for the extrapolation of the meteorological inputs.

  • snow_pack_init – (optional) Initial value of the snow pack storage

  • thermal_state_init – (optional) Initial value of the thermal state of the snow pack

  • altitudes – (optional) List of median altitudes of each elevation layer [m]

Returns

A scipy OptimizeResult class object.

Return type

res

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

  • RuntimeErrror – If there is a size mismatch between the precipitation and the pot. evapotranspiration input.

get_default_bounds()

Return the dictionary containing the default parameter bounds.

get_dtype()

Return the custom model datatype.

get_parameter_names()

Return the list of parameter names.

get_params()

Return a dict with all model parameters and their current value.

get_random_params(num=1)

Generate random sets of model parameters in the default bounds.

Samples num values for each model parameter from a uniform distribution between the default bounds.

Parameters

num – (optional) Integer, specifying the number of parameter sets, that will be generated. Default is 1.

Returns

A numpy array of the models custom data type, containing the at random generated parameters.

set_params(params)

Set model parameters to values passed in params.

Parameters

params – Either a dictonary containing model parameters as key/value pairs or a numpy array of the models own custom dtype. For the case of dictionaries, they can contain only one model parameter or many/all. The naming of the parameters must be identical to the names specified in the _param_list. All parameter values must be numerical.

Raises
  • ValueError – If any parameter is not a numerical value.

  • AttributeError – If the parameter dictonary contains a key, that doesn’t match any of the parameter names.

  • TypeError – If the numpy array of the parameter does not fit the custom data type of the model or it’s neither a dict nor a numpy ndarray.

simulate(prec, mean_temp, min_temp, max_temp, met_station_height, snow_pack_init=0, thermal_state_init=0, altitudes=[], return_storages=False, params=None)[source]

Simulate the snow-routine of the Cemaneige model.

This function checks the input data and prepares the data for the actual simulation function, which is kept outside of the model class (due to restrictions of Numba). Meteorological input arrays can be either lists, numpy arrays or pandas Series.

In the original Cemaneige model, the catchment is divided into 5 subareas of different elevations with the each of them having the same area. For each elevation layer, the snow routine is calculated separately. Therefore, the meteorological input is extrapolated from the height of the measurement station to the median height of each sub-area. This feature is optional (also the number of elevation layer) in this implementation an can be activated if the corresponding heights of each elevation layer is passed as input. In this case, also the height of the measurement station must be passed.

Parameters
  • prec – Array of daily precipitation sum [mm]

  • mean_temp – Array of the mean temperature [C]

  • min_temp – Array of the minimum temperature [C]

  • max_temp – Array of the maximum temperature [C]

  • met_station_height – Height of the meteorological station [m]. Needed to calculate the fraction of solid precipitation and optionally for the extrapolation of the meteorological inputs.

  • snow_pack_init – (optional) Initial value of the snow pack storage

  • thermal_state_init – (optional) Initial value of the thermal state of the snow pack

  • altitudes – (optional) List of median altitudes of each elevation layer [m]

  • return_storages – (optional) Boolean, indicating if the model storages should also be returned.

  • params – (optional) Numpy array of parameter sets, that will be evaluated a once in parallel. Must be of the models own custom data type. If nothing is passed, the parameters, stored in the model object, will be used.

Returns

An array with the simulated stream flow and optional one array for each of the two storages.

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

  • RuntimeError – If there is a size mismatch between meteorological input arrays.

CemaneigeGR4J

This model couples the Cemaneige snow routine with the GR4J model into one model.

Valéry, A. "Modélisation précipitations – débit sous influence nivale.
Élaboration d’un module neige et évaluation sur 380 bassins versants".
PhD thesis, Cemagref (Antony), AgroParisTech (Paris), 405 pp. (2010)

Explanation of the model parameters:

  • CTG: snow-pack inertia factor

  • Kf: day-degree factor

  • x1: maximum capacity of the production store [mm]

  • x2: groundwater exchange coefficient [mm]

  • x3: one day ahead maximum capacity of the routing store [mm]

  • x4: time base of the unit hydrograph UH1 [days]

Model inputs for simulation:

  • prec: Array of daily precipitation sum [mm]

  • mean_temp: Array of the mean temperature [C]

  • min_temp: Array of the minimum temperature [C]

  • max_temp: Array of the maximum temperature [C]

  • etp: Array mean potential evapotranspiration [mm]

  • met_station_height: Height of the meteorological station [m]. Needed to calculate the fraction of solid precipitation and optionally for the extrapolation of the meteorological inputs.

  • altitudes: (optionally) List of the median elevation of each elevation layer.

Class documentation

class rrmpg.models.CemaneigeGR4J(params=None)[source]

Interface to the Cemaneige + GR4J coupled hydrological model.

This class builds an interface to the coupled model, consisting of the Cemaneige snow routine [1] and the GR4J model [2]. This model should only be used with daily data.

If no model parameters are passed upon initialization, generates random parameter set.

[1] Valéry, A. “Modélisation précipitations – débit sous influence nivale. Élaboration d’un module neige et évaluation sur 380 bassins versants”. PhD thesis, Cemagref (Antony), AgroParisTech (Paris), 405 pp. (2010)

[2] Perrin, Charles, Claude Michel, and Vazken Andréassian. “Improvement of a parsimonious model for streamflow simulation.” Journal of hydrology 279.1 (2003): 275-289.

Parameters

params – (optional) Dictionary containing all model parameters as a separate key/value pairs.

Raises

ValueError – If a dictionary of model parameters is passed but one of the parameters is missing.

fit(obs, prec, mean_temp, min_temp, max_temp, etp, met_station_height, snow_pack_init=0, thermal_state_init=0, s_init=0, r_init=0, altitudes=[])[source]

Fit the Cemaneige + GR4J coupled model to a observed timeseries

This functions uses scipy’s global optimizer (differential evolution) to find a good set of parameters for the model, so that the observed timeseries is simulated as good as possible.

Parameters
  • obs – Array of the observed timeseries [mm]

  • prec – Array of daily precipitation sum [mm]

  • mean_temp – Array of the mean temperature [C]

  • min_temp – Array of the minimum temperature [C]

  • max_temp – Array of the maximum temperature [C]

  • etp – Array of mean potential evapotranspiration [mm]

  • met_station_height – Height of the meteorological station [m]. Needed to calculate the fraction of solid precipitation and optionally for the extrapolation of the meteorological inputs.

  • snow_pack_init – (optional) Initial value of the snow pack storage

  • thermal_state_init – (optional) Initial value of the thermal state of the snow pack

  • s_init – (optional) Initial value of the production storage as fraction of x1.

  • r_init – (optional) Initial value of the routing storage as fraction of x3.

  • altitudes – (optional) List of median altitudes of each elevation layer [m]

Returns

A scipy OptimizeResult class object.

Return type

res

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

  • RuntimeErrror – If there is a size mismatch between the precipitation and the pot. evapotranspiration input.

get_default_bounds()

Return the dictionary containing the default parameter bounds.

get_dtype()

Return the custom model datatype.

get_parameter_names()

Return the list of parameter names.

get_params()

Return a dict with all model parameters and their current value.

get_random_params(num=1)

Generate random sets of model parameters in the default bounds.

Samples num values for each model parameter from a uniform distribution between the default bounds.

Parameters

num – (optional) Integer, specifying the number of parameter sets, that will be generated. Default is 1.

Returns

A numpy array of the models custom data type, containing the at random generated parameters.

set_params(params)

Set model parameters to values passed in params.

Parameters

params – Either a dictonary containing model parameters as key/value pairs or a numpy array of the models own custom dtype. For the case of dictionaries, they can contain only one model parameter or many/all. The naming of the parameters must be identical to the names specified in the _param_list. All parameter values must be numerical.

Raises
  • ValueError – If any parameter is not a numerical value.

  • AttributeError – If the parameter dictonary contains a key, that doesn’t match any of the parameter names.

  • TypeError – If the numpy array of the parameter does not fit the custom data type of the model or it’s neither a dict nor a numpy ndarray.

simulate(prec, mean_temp, min_temp, max_temp, etp, met_station_height, snow_pack_init=0, thermal_state_init=0, s_init=0, r_init=0, altitudes=[], return_storages=False, params=None)[source]

Simulate the Cemaneige + GR4J coupled hydrological model.

This function checks the input data and prepares the data for the actual simulation function, which is kept outside of the model class (due to restrictions of Numba). Meteorological input arrays can be either lists, numpy arrays or pandas Series.

In the original Cemaneige model, the catchment is divided into 5 subareas of different elevations with the each of them having the same area. For each elevation layer, the snow routine is calculated separately. Therefore, the meteorological input is extrapolated from the height of the measurement station to the median height of each sub-area. This feature is optional (also the number of elevation layer) in this implementation an can be activated if the corresponding heights of each elevation layer is passed as input. In this case, also the height of the measurement station must be passed.

Parameters
  • prec – Array of daily precipitation sum [mm]

  • mean_temp – Array of the mean temperature [C]

  • min_temp – Array of the minimum temperature [C]

  • max_temp – Array of the maximum temperature [C]

  • etp – Array of mean potential evapotranspiration [mm]

  • met_station_height – Height of the meteorological station [m]. Needed to calculate the fraction of solid precipitation and optionally for the extrapolation of the meteorological inputs.

  • snow_pack_init – (optional) Initial value of the snow pack storage

  • thermal_state_init – (optional) Initial value of the thermal state of the snow pack

  • s_init – (optional) Initial value of the production storage as fraction of x1.

  • r_init – (optional) Initial value of the routing storage as fraction of x3.

  • altitudes – (optional) List of median altitudes of each elevation layer [m]

  • return_storages – (optional) Boolean, indicating if the model storages should also be returned.

  • params – (optional) Numpy array of parameter sets, that will be evaluated a once in parallel. Must be of the models own custom data type. If nothing is passed, the parameters, stored in the model object, will be used.

Returns

An array with the simulated stream flow and optional one array for each of the two storages.

Raises
  • ValueError – If one of the inputs contains invalid values.

  • TypeError – If one of the inputs has an incorrect datatype.

  • RuntimeError – If there is a size mismatch between meteorological input arrays.