result_network.ResultQuantity
result_network.ResultQuantity(
self,
result_location,
data_item,
res1d,
m1d_dataset=None,
element_index=0,
)Class for wrapping a single ResultData data item quantity.
ResultQuantity objects are the last attributes assigned to a network. They have the ability to add a query.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| result_location | ResultLocation | ResultLocation object, which could be node, catchment, grid point, or global data item. | required |
| data_item | MIKE 1D IDataItem object. | required | |
| res1d | Res1D | Res1D object the quantity belongs to. | required |
| m1d_dataset | IRes1DDataSet object the quantity is associated with. | None |
Attributes
| Name | Type | Description |
|---|---|---|
| element_index | int | An integer giving an element index into the data item which gives the concrete time series for given location. |
| timeseries_id | TimeSeriesId | A unique TimeSeriesId object corresponding to the data item. This is unmutable and set when the ResultQuantity is added to a network. A value of None indicates that the ResultQuantity has not been added to a network. |
Methods
| Name | Description |
|---|---|
| add | Add a ResultQuantity to ResultNetwork.read_queue based on the data item. |
| get_data_entry | Get DataEntry corresponding to ResultQuantity. |
| get_data_entry_net | Get DataEntryNet corresponding to ResultQuantity. |
| get_query | Get query corresponding to ResultQuantity. |
| 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.ResultQuantity.add()Add a ResultQuantity to ResultNetwork.read_queue based on the data item.
get_data_entry
result_network.ResultQuantity.get_data_entry()Get DataEntry corresponding to ResultQuantity.
get_data_entry_net
result_network.ResultQuantity.get_data_entry_net()Get DataEntryNet corresponding to ResultQuantity.
get_query
result_network.ResultQuantity.get_query()Get query corresponding to ResultQuantity.
plot
result_network.ResultQuantity.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
| Name | Type | Description |
|---|---|---|
| matplotlib.axes.Axes | Axes object with the plot. |
prettify_quantity
result_network.ResultQuantity.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
| Name | Type | Description |
|---|---|---|
| str | A string representation of the quantity type and unit. |
read
result_network.ResultQuantity.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.ResultQuantity.to_csv(file_path, time_step_skipping_number=1)Extract time series data into a csv file.
to_dataframe
result_network.ResultQuantity.to_dataframe()Get a time series as a data frame.
to_dfs0
result_network.ResultQuantity.to_dfs0(file_path, time_step_skipping_number=1)Extract time series data into a dfs0 file.
to_txt
result_network.ResultQuantity.to_txt(file_path, time_step_skipping_number=1)Extract time series data into a txt file.