result_network.ResultQuantityCollection

result_network.ResultQuantityCollection(self, result_quantities, res1d)

Class for dealing with a collection ResultQuantity objects.

ResultQuantityCollection objects are the attributes assigned to a network type like nodes, catchments, etc. For example, res1d.nodes.WaterLevel They have the ability to add queries.

Parameters

Name Type Description Default
result_quantities A list of ResultQuantity objects having the same quantity id. required
res1d Res1D Res1D object the quantity belongs to. required

Attributes

Name Description
name Name of the quantity id assosciated with collection.
timeseries_id TimeSeriesId corresponding to ResultQuantity.

Methods

Name Description
add Add queries to ResultNetwork.queries from a list of result quantities.
get_data_entry Get DataEntry corresponding to ResultQuantity.
get_data_entry_net Get DataEntryNet corresponding to ResultQuantity.
get_query Get queries corresponding to ResultQuantityCollection.
get_timeseries_ids Get TimeSeriesId objects corresponding to ResultQuantityCollection.
plot Plot the time series data.
prettify_quantity Get a pretty string representation of a ResultQuantity’s type and unit.
read Read the time series data into a data frame.
to_csv Extract time series data into a csv file.
to_dataframe Get a time series as a data frame.
to_dfs0 Extract time series data into a dfs0 file.
to_txt Extract time series data into a txt file.

add

result_network.ResultQuantityCollection.add()

Add queries to ResultNetwork.queries from a list of result quantities.

get_data_entry

result_network.ResultQuantityCollection.get_data_entry()

Get DataEntry corresponding to ResultQuantity.

get_data_entry_net

result_network.ResultQuantityCollection.get_data_entry_net()

Get DataEntryNet corresponding to ResultQuantity.

get_query

result_network.ResultQuantityCollection.get_query()

Get queries corresponding to ResultQuantityCollection.

get_timeseries_ids

result_network.ResultQuantityCollection.get_timeseries_ids()

Get TimeSeriesId objects corresponding to ResultQuantityCollection.

plot

result_network.ResultQuantityCollection.plot(ax=None, **kwargs)

Plot the time series data.

Parameters

Name Type Description Default
ax matplotlib.axes.Axes Axes object to plot on. None
**kwargs Additional keyword arguments passed to pandas.DataFrame.plot. {}

Returns

Type Description
matplotlib.axes.Axes Axes object with the plot.

prettify_quantity

result_network.ResultQuantityCollection.prettify_quantity(quantity, latex_format=False)

Get a pretty string representation of a ResultQuantity’s type and unit.

Parameters

Name Type Description Default
quantity ResultQuantity | IQuantity ResultQuantity object or DHI.Mike1D.Generic.IQuantity object. required
latex_format If True, the unit abbreviation will use LaTeX-formatted text. False

Returns

Type Description
str A string representation of the quantity type and unit.

read

result_network.ResultQuantityCollection.read(column_mode=None)

Read the time series data into a data frame.

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 ‘str’ - column index of str representations of QueryData objects None

to_csv

result_network.ResultQuantityCollection.to_csv(file_path, time_step_skipping_number=1)

Extract time series data into a csv file.

to_dataframe

result_network.ResultQuantityCollection.to_dataframe()

Get a time series as a data frame.

to_dfs0

result_network.ResultQuantityCollection.to_dfs0(file_path, time_step_skipping_number=1)

Extract time series data into a dfs0 file.

to_txt

result_network.ResultQuantityCollection.to_txt(file_path, time_step_skipping_number=1)

Extract time series data into a txt file.