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 | Description |
|---|---|
| derived_quantities | A list of available derived quantities. |
| group | The TimeSeriesIdGroup associated with these locations. |
| locations | A list of location objects (e.g. |
| names | A list of location names (e.g. MUIDs). |
| quantities | A list of available quantities. |
| res1d | The Res1D instance that these locations belong to. |
Methods
| Name | Description |
|---|---|
| read | Read the time series data for all quantities at these locations into a DataFrame. |
| to_dataframe | Read the time series data for all quantities at these locations into a DataFrame. |
| to_geopandas | Convert catchments to a geopandas.GeoDataFrame object. |
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 |
to_dataframe
result_network.ResultCatchments.to_dataframe(
column_mode=None,
include_derived=False,
)Read the time series data for all quantities at these locations into a DataFrame.
Alias for read() method.
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 |
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
| Name | Type | Description |
|---|---|---|
| gdf | geopandas.GeoDataFrame | A GeoDataFrame object with catchments as Polygon geometries. |