result_network.ResultNodes

result_network.ResultNodes(self, res1d)

Class for wrapping ResultData nodes.

By itself it is also a dict, which contains mapping between node ID and IRes1DNode object.

Parameters

Name Type Description Default
res1d Res1D Res1D object the nodes 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_geopandas Convert nodes to a geopandas.GeoDataFrame, optionally with quantities.

read

result_network.ResultNodes.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_geopandas

result_network.ResultNodes.to_geopandas(
    agg=None,
    agg_kwargs={},
    include_derived=False,
)

Convert nodes to a geopandas.GeoDataFrame, optionally with quantities.

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’}). include_derived: bool, default False Include derived quantities.

Returns

Name Type Description
gdf geopandas.GeoDataFrame A GeoDataFrame object with nodes as Point geometries.

Examples

Convert nodes to a GeoDataFrame (without quantities)

>>> gdf = res1d.nodes.to_geopandas()

Convert nodes to a GeoDataFrame (with quantities)

>>> gdf = res1d.nodes.to_geopandas(agg='mean')