Skip to main content

supply

supply

Labelling Ribasim-basins as “aanvoer”-basins, i.e., water can (and should) be supplied to these basins during shortages.

Labelling is executed based on Ribasim-model (basin nodes) and geo-files with “aanvoergebieden.” If necessary, labels can be modified manually.

Author: Gijs G. Hendrickx

Classes

Name Description
SupplyBasin Labelling of Ribasim’s basin nodes as ‘aanvoergebieden’ based on geometry data.
SupplyOutlet Labelling of Ribasim’s outlet nodes as ‘aanvoer’ or ‘afvoer’ based on basin labels.
SupplyWork Labelling of Ribasim’s pump/outlet nodes as ‘aanvoer’ or ‘afvoer’ based on basin labels.

SupplyBasin

supply.SupplyBasin(model, geometry, **kwargs)

Labelling of Ribasim’s basin nodes as ‘aanvoergebieden’ based on geometry data.

Attributes

Name Description
basin_areas Ribasim basin areas.
basin_nodes Ribasim basin nodes.
geometry Geometry data.
model Ribasim model.

Methods

Name Description
exec Execute labelling basins as ‘aanvoergebied’.
set_aanvoer_off Set basin as ‘afvoergebieden’ only based on its node-ID.
set_aanvoer_on Set basin as ‘aanvoergebieden’ based on its node-ID.
exec
supply.SupplyBasin.exec()

Execute labelling basins as ‘aanvoergebied’.

Returns
Name Type Description
pandas.DataFrame basin-data including meta-label ‘aanvoer’ (bool)
set_aanvoer_off
supply.SupplyBasin.set_aanvoer_off(*node_id)

Set basin as ‘afvoergebieden’ only based on its node-ID.

Parameters
Name Type Description Default
node_id int basin node-ID ()
Returns
Name Type Description
pandas.DataFrame basin-data with modified meta-label ‘aanvoer’
set_aanvoer_on
supply.SupplyBasin.set_aanvoer_on(*node_id)

Set basin as ‘aanvoergebieden’ based on its node-ID.

Parameters
Name Type Description Default
node_id int basin node-ID ()
Returns
Name Type Description
pandas.DataFrame basin-data with modified meta-label ‘aanvoer’

SupplyOutlet

supply.SupplyOutlet(model)

Labelling of Ribasim’s outlet nodes as ‘aanvoer’ or ‘afvoer’ based on basin labels.

Methods

Name Description
set_statics Set Ribasim outlets’ Static-data.
set_statics
supply.SupplyOutlet.set_statics(df)

Set Ribasim outlets’ Static-data.

Parameters
Name Type Description Default
df pd.DataFrame data with outlet statics required

SupplyWork

supply.SupplyWork(model)

Labelling of Ribasim’s pump/outlet nodes as ‘aanvoer’ or ‘afvoer’ based on basin labels.

Attributes

Name Description
basin_areas Ribasim basin areas.
basin_states Ribasim basin states.
level_boundaries Ribasim level boundary nodes.
model Ribasim model.

Methods

Name Description
exec Set ‘meta_aanvoer’ of ‘kunstwerk’ based on connected nodes.
get_statics Get Ribasim Static-data.
set_aanvoer_off Set ‘kunstwerk’ as ‘afvoer’-only based on its node-ID.
set_aanvoer_on Set ‘kunstwerk’ as ‘aanvoer’ based on its node-ID.
set_statics Set Ribasim Static-data.
exec
supply.SupplyWork.exec(**kwargs)

Set ‘meta_aanvoer’ of ‘kunstwerk’ based on connected nodes.

Parameters
Name Type Description Default
overruling_enabled (bool, optional) in case a basin can be supplied directly from the ‘hoofdwatersysteem’, other supply- routes are “overruled”, i.e., removed, defaults to True required
Returns
Name Type Description
pandas.DataFrame ‘kunstwerk’-statics
get_statics
supply.SupplyWork.get_statics()

Get Ribasim Static-data.

set_aanvoer_off
supply.SupplyWork.set_aanvoer_off(*node_id)

Set ‘kunstwerk’ as ‘afvoer’-only based on its node-ID.

Parameters
Name Type Description Default
node_id int ‘kunstwerk’ node-ID ()
Returns
Name Type Description
pandas.DataFrame ‘kunstwerk’-data with modified meta-label ‘aanvoer’
set_aanvoer_on
supply.SupplyWork.set_aanvoer_on(*node_id)

Set ‘kunstwerk’ as ‘aanvoer’ based on its node-ID.

Parameters
Name Type Description Default
node_id int ‘kunstwerk’ node-ID ()
Returns
Name Type Description
pandas.DataFrame ‘kunstwerk’-data with modified meta-label ‘aanvoer’
set_statics
supply.SupplyWork.set_statics(df)

Set Ribasim Static-data.

Functions

Name Description
special_load_geometry Loading geometry data in a non-straightforward way.

special_load_geometry

supply.special_load_geometry(f_geometry, method, **kwargs)

Loading geometry data in a non-straightforward way.

Included special methods are: - ‘extract’: Extract ‘aanvoer’-geometries from within a single geometry-file/-layer. This reflects the occurrence of labelling geometries as ‘aanvoer’ within a single geopandas.GeoDataFrame, where one column provides the information on this labelling. This method requires the optional argument key, which gives the key/column-name of the geopandas.GeoDataFrame-column in which the ‘aanvoer’-flag is stored (optionally provided by a specific value using the optional argument value).

  • ‘inverse’: Subtract ‘afvoer’-only geometries from total set of geometries to retrieve the ‘aanvoer’-only geometries. The ‘inverse’-method requires the definition of at least one additional layer or file, and the total set of geometries (i.e., both ‘aanvoer’ and ‘afvoer’) is provided in the f_geometry-argument. In case of a .gpkg-/ .gdb-file, the main/total geometry is given by the first layer in the layers-argument [optional]. Otherwise, additional files must be provided using the extra_files-argument [optional]. These additional files (or non- first layers) are subtracted from the main/total geometry.

  • ‘merge’: Merge multiple geometries to create the overall ‘aanvoer’-geometry. Note that the f_geometry still requires a geometry file and additional files are provided using the extra_files argument [optional], or by providing multiple layers using the layers-argument [optional].

Parameters

Name Type Description Default
f_geometry str | Path geometry file required
method str loading method options: {‘extract’, ‘inverse’, ‘merge’} required
export (bool, optional) export ‘aanvoer’-geometry after modifications, defaults to False required
export_directory (str, optional) directory to export the ‘aanvoer’-geometry to, defaults to f_geometry’s directory required
export_filename (str, optional) filename of the ‘aanvoer’-geometry, defaults to ‘aanvoer_mod.shp’ required
extra_files (sequence[str], optional) additional geometry files, defaults to None [relevant for method={‘inverse’, ‘merge’} with f_geometry={’*.shp’}] required
key (str, optional) key/column-label marking ‘aanvoer’-geometries, defaults to None [required for method={‘extract’}] required
layer (str, optional) geometry layer from a .gpkg-/.gdb-file, defaults to None [relevant for method={‘extract’} with f_geometry={‘.gpkg’, ’.gdb’}] required
layers (sequence[str], optional) geometry layers from a .gpkg-/.gdb-file, defaults to None [relevant for method={‘inverse’, ‘merge’} with f_geometry={‘.gpkg’, ’.gdb’}] required
value (any, optional) value of ‘aanvoer’-geometries, defaults to True [relevant for method={‘extract’}] required

Returns

Name Type Description
geopandas.GeoDataFrame ‘aanvoer’-geometries

Raises

Name Type Description
NotImplementedError if method is not implemented
NotImplementedError if file-extension is not implemented
ValueError if additional *.shp-files are required but not provided
ValueError if the provided number of files exceeds the maximum allowed for the method
ValueError if no layers of the .gpkg-/.gdb-file are provided
ValueError if not enough layers of the .gpkg-/.gdb-file are provided