result_network.ResultStructure
result_network.ResultStructure(self , structure_id, reach, data_items, res1d)
Class for wrapping a list of ResultData structure data items belonging to the same structure.
Parameters
structure_id
str
Structure ID.
required
reach
IRes1DReach
Reach where the structure belongs to.
required
data_items
list of IDataItem objects.
A list of MIKE 1D IDataItem objects corresponding to a given structure.
required
res1d
Res1D
Res1D object the reach belongs to.
required
Attributes
data_items_dict
dict
A dictionary from quantity id to a data item.
chainage
float
Chainage where the structure is located on the reach.
Methods
add
Add quantities at this location to ResultNetwork.queue for reading later.
add_query
Add a query to ResultNetwork.queries list.
get_m1d_dataset
Get IRes1DDataSet object associated with ResultStructure.
get_query
Get a QueryDataStructure for given data item.
plot
Plot the time series data for quantities at this location.
read
Read the time series data for quantities at this location into a DataFrame.
to_csv
Extract time series data for quantities at this location into a csv file.
to_dataframe
Read the time series data for quantities at this location into a DataFrame.
to_dfs0
Extract time series data for quantities at this location into a dfs0 file.
to_txt
Extract time series data for quantities at this location into a txt file.
add
result_network.ResultStructure.add(quantities= None )
Add quantities at this location to ResultNetwork.queue for reading later.
Parameters
quantities
str | list[str] | None
Quantity id or list of quantity ids to add. If None, all quantities are added.
None
add_query
result_network.ResultStructure.add_query(data_item)
Add a query to ResultNetwork.queries list.
get_m1d_dataset
result_network.ResultStructure.get_m1d_dataset(m1d_dataitem= None )
Get IRes1DDataSet object associated with ResultStructure.
This is the reach IRes1DDataSet object because ResultStructure objects do not have a corresonding IRes1DDataSet object.
Parameters
m1d_dataitem
IDataItem
Ignored for ResultStructure.
None
Returns
IRes1DDataSet
IRes1DDataSet object associated with ResultStructure.
get_query
result_network.ResultStructure.get_query(data_item)
Get a QueryDataStructure for given data item.
Returns
QueryDataStructure
Query for the data item on this structure.
plot
result_network.ResultStructure.plot(ax= None , * , quantities= None , ** kwargs)
Plot the time series data for quantities at this location.
Parameters
ax
matplotlib.axes.Axes
Axes object to plot on.
None
quantities
str | list[str] | None
Quantity id or list of quantity ids to plot. If None, all quantities are plotted.
None
**kwargs
Additional keyword arguments passed to pandas.DataFrame.plot.
{}
Returns
matplotlib.axes.Axes
Axes object with the plot.
read
result_network.ResultStructure.read(column_mode= None , * , quantities= None )
Read the time series data for quantities at this location into a DataFrame.
Parameters
column_mode
str(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
quantities
str | list[str] | None
Quantity id or list of quantity ids to read. If None, all quantities are read.
None
Returns
pd.DataFrame
Time series data with one column per time series.
Raises
ValueError
If a quantity is not available at this location.
Returns
pd.DataFrame
Time series data for all quantities at this location.
to_csv
result_network.ResultStructure.to_csv(
file_path,
time_step_skipping_number= 1 ,
* ,
quantities= None ,
)
Extract time series data for quantities at this location into a csv file.
Parameters
file_path
str | Path
Output file path.
required
time_step_skipping_number
int
Number specifying the time step frequency to output.
1
quantities
str | list[str] | None
Quantity id or list of quantity ids to extract. If None, all quantities are extracted.
None
to_dataframe
result_network.ResultStructure.to_dataframe(
column_mode= None ,
* ,
quantities= None ,
)
Read the time series data for quantities at this location into a DataFrame.
Alias for read() method.
Parameters
column_mode
str(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
quantities
str | list[str] | None
Quantity id or list of quantity ids to read. If None, all quantities are read.
None
Returns
pd.DataFrame
Time series data with one column per time series.
to_dfs0
result_network.ResultStructure.to_dfs0(
file_path,
time_step_skipping_number= 1 ,
* ,
quantities= None ,
)
Extract time series data for quantities at this location into a dfs0 file.
Parameters
file_path
str | Path
Output file path.
required
time_step_skipping_number
int
Number specifying the time step frequency to output.
1
quantities
str | list[str] | None
Quantity id or list of quantity ids to extract. If None, all quantities are extracted.
None
to_txt
result_network.ResultStructure.to_txt(
file_path,
time_step_skipping_number= 1 ,
* ,
quantities= None ,
)
Extract time series data for quantities at this location into a txt file.
Parameters
file_path
str | Path
Output file path.
required
time_step_skipping_number
int
Number specifying the time step frequency to output.
1
quantities
str | list[str] | None
Quantity id or list of quantity ids to extract. If None, all quantities are extracted.
None