result_network.ResultCatchments
result_network.ResultCatchments(self, res1d)
Class for wrapping ResultData catchments.
By itself it is also a dict, which contains mapping between catchment ID and IRes1DCatchment object.
Parameters
Name | Type | Description | Default |
---|---|---|---|
res1d |
Res1D | Res1D object the catchments belong to. | required |
Attributes
Name | Type | Description |
---|---|---|
catchment_label | str | A label, which is appended if the catchment name starts with a number. The value used is catchment_label = ‘c_’ |
Methods
Name | Description |
---|---|
add_derived_quantity | Add a derived quantity to the result network. |
read | Read the time series data for all quantities at these locations into a DataFrame. |
remove_derived_quantity | Remove a derived quantity from the result network. |
set_catchments | Set attributes to the current ResultCatchments object based on the catchment ID. |
set_quantity_collections | Set all quantity collection attributes. |
set_quantity_derived | Set a single derived quantity attribute on the obj. |
set_res1d_catchment_to_dict | Create a dict entry from catchment ID to ResultCatchment object. |
set_res1d_object_to_dict | Create a dict entry from a key name to an object or a list of objects. |
to_geopandas | Convert catchments to a geopandas.GeoDataFrame object. |
add_derived_quantity
result_network.ResultCatchments.add_derived_quantity(derived_quantity)
Add a derived quantity to the result network.
Parameters
Name | Type | Description | Default |
---|---|---|---|
derived_quantity |
DerivedQuantity | Derived quantity to be added to the result network. | required |
read
result_network.ResultCatchments.read(column_mode=None, include_derived=False)
Read the time series data for all quantities at these locations into a DataFrame.
Parameters
Name | Type | Description | Default |
---|---|---|---|
column_mode |
str | ColumnMode(optional) | Specifies the type of column index of returned DataFrame. ‘all’ - column MultiIndex with levels matching TimeSeriesId objects. ‘compact’ - same as ‘all’, but removes levels with default values. ‘timeseries’ - column index of TimeSeriesId objects | None |
include_derived |
bool | Include derived quantities. | False |
remove_derived_quantity
result_network.ResultCatchments.remove_derived_quantity(derived_quantity)
Remove a derived quantity from the result network.
Parameters
Name | Type | Description | Default |
---|---|---|---|
derived_quantity |
DerivedQuantity or str | Derived quantity to be removed from the result network. Either a DerivedQuantity object or its name. | required |
set_catchments
result_network.ResultCatchments.set_catchments()
Set attributes to the current ResultCatchments object based on the catchment ID.
set_quantity_collections
result_network.ResultCatchments.set_quantity_collections()
Set all quantity collection attributes.
set_quantity_derived
result_network.ResultCatchments.set_quantity_derived(derived_quantity)
Set a single derived quantity attribute on the obj.
set_res1d_catchment_to_dict
result_network.ResultCatchments.set_res1d_catchment_to_dict(catchment)
Create a dict entry from catchment ID to ResultCatchment object.
set_res1d_object_to_dict
result_network.ResultCatchments.set_res1d_object_to_dict(dict_key, obj)
Create a dict entry from a key name to an object or a list of objects.
to_geopandas
result_network.ResultCatchments.to_geopandas(agg=None, agg_kwargs={})
Convert catchments to a geopandas.GeoDataFrame object.
By default, quantities are not included. To include quantities, use the agg
and agg_kwargs
parameters.
Parameters
Name | Type | Description | Default |
---|---|---|---|
agg |
str or callable | Defines how to aggregate the quantities in time and space. Accepts any str or callable that is accepted by pandas.DataFrame.agg. | None |
Examples
- 'mean' : mean value of all quantities
- 'max' : maximum value of all quantities
- np.max : maximum value of all quantities
agg_kwargs : dict, default {} Aggregation function for specific column levels (e.g. {time=‘min’, chainage=‘first’}).
Returns
Type | Description |
---|---|
geopandas.GeoDataFrame | A GeoDataFrame object with catchments as Polygon geometries. |