C++ binding

This reference only describes the C++ Python binding. For a full documentation of the C++ code, please refer to the C++ reference.

hydrobricks Python interface

ModelHydro class

class _hydrobricks.ModelHydro

Bases: pybind11_object

add_behaviour(self: _hydrobricks.ModelHydro, behaviour: Behaviour) bool

Adding a behaviour to the model.

add_time_series(self: _hydrobricks.ModelHydro, time_series: _hydrobricks.TimeSeries) bool

Adding a time series to the model.

attach_time_series_to_hydro_units(self: _hydrobricks.ModelHydro) bool

Attach the time series.

clear_time_series(self: _hydrobricks.ModelHydro) None

Clear time series. Use only if the time series were created with ModelHydro::ClearTimeSeries.

create_time_series(self: _hydrobricks.ModelHydro, data_name: str, time: numpy.ndarray[numpy.float64[m, 1]], ids: numpy.ndarray[numpy.int32[m, 1]], data: numpy.ndarray[numpy.float64[m, n]]) bool

Create a time series and add it to the model.

dump_outputs(self: _hydrobricks.ModelHydro, path: str) bool

Dump the model outputs to file.

forcing_loaded(self: _hydrobricks.ModelHydro) bool

Check if the forcing data were loaded.

get_behaviour_items_nb(self: _hydrobricks.ModelHydro) int

Get the number of behaviour items.

get_behaviours_nb(self: _hydrobricks.ModelHydro) int

Get the number of behaviours.

get_outlet_discharge(self: _hydrobricks.ModelHydro) numpy.ndarray[numpy.float64[m, 1]]

Get the outlet discharge.

get_total_et(self: _hydrobricks.ModelHydro) float

Get the total amount of water lost by evapotranspiration.

get_total_outlet_discharge(self: _hydrobricks.ModelHydro) float

Get the outlet discharge total.

get_total_snow_storage_changes(self: _hydrobricks.ModelHydro) float

Get the total change in snow storage.

get_total_water_storage_changes(self: _hydrobricks.ModelHydro) float

Get the total change in water storage.

init_with_basin(self: _hydrobricks.ModelHydro, model_settings: _hydrobricks.SettingsModel, basin_settings: _hydrobricks.SettingsBasin) bool

Initialize the model and create the sub basin.

is_ok(self: _hydrobricks.ModelHydro) bool

Check if the model is correctly set up.

reset(self: _hydrobricks.ModelHydro) None

Reset the model before another run.

run(self: _hydrobricks.ModelHydro) bool

Run the model.

save_as_initial_state(self: _hydrobricks.ModelHydro) None

Save the model state as initial conditions.

update_parameters(self: _hydrobricks.ModelHydro, model_settings: _hydrobricks.SettingsModel) None

Update the parameters with the provided values.

SettingsModel class

class _hydrobricks.SettingsModel

Bases: pybind11_object

generate_socont_structure(self: _hydrobricks.SettingsModel, land_cover_types: List[str], land_cover_names: List[str], soil_storage_nb: int = 1, surface_runoff: str = 'socont_runoff') bool

Generate the GSM-SOCONT structure.

log_all(self: _hydrobricks.SettingsModel, log_all: bool = True) None

Logging all components.

set_parameter(self: _hydrobricks.SettingsModel, component: str, name: str, value: float) bool

Setting one of the model parameter.

set_solver(self: _hydrobricks.SettingsModel, name: str) None

Set the solver.

set_timer(self: _hydrobricks.SettingsModel, start_date: str, end_date: str, time_step: int, time_step_unit: str) None

Set the modelling time properties.

SettingsBasin class

class _hydrobricks.SettingsBasin

Bases: pybind11_object

add_hydro_unit(self: _hydrobricks.SettingsBasin, id: int, area: float, elevation: float) None

Add a hydro unit to the spatial structure.

add_land_cover(self: _hydrobricks.SettingsBasin, name: str, type: str, fraction: float) None

Add a land cover element.

SubBasin class

class _hydrobricks.SubBasin

Bases: pybind11_object

init(self: _hydrobricks.SubBasin, spatial_structure: _hydrobricks.SettingsBasin) bool

Initialize the basin.

Parameter class

class _hydrobricks.Parameter

Bases: pybind11_object

get_name(self: _hydrobricks.Parameter) str

Get the parameter name.

get_value(self: _hydrobricks.Parameter) float

Get the parameter value.

property name
set_name(self: _hydrobricks.Parameter, arg0: str) None

Set the parameter name.

set_value(self: _hydrobricks.Parameter, arg0: float) None

Set the parameter value.

property value
class _hydrobricks.ParameterVariableYearly

Bases: Parameter

set_values(self: _hydrobricks.ParameterVariableYearly, year_start: int, year_end: int, values: List[float]) bool

Set the parameter values.

TimeSeries class

class _hydrobricks.TimeSeries

Bases: pybind11_object

static create(data_name: str, time: numpy.ndarray[numpy.float64[m, 1]], ids: numpy.ndarray[numpy.int32[m, 1]], data: numpy.ndarray[numpy.float64[m, n]]) _hydrobricks.TimeSeries