result_network.ResultReach
result_network.ResultReach(self , reaches, res1d)
Class for wrapping a list of ResultData reaches having the same reach name.
Parameters
reaches
list[IRes1DReach]
A list of MIKE 1D IRes1DReach objects having the same reach name.
required
res1d
Res1D
Res1D object the reach belongs to.
required
Attributes
chainages
List of chainages for the reach.
derived_quantities
A list of available derived quantities.
end_chainage
End chainage of the reach or a DELETE_VALUE=-1e-30 in case it is not available.
end_node
End node of the reach.
full_flow_discharge
Full flow discharge of the reach.
geometry
A geometric representation of the reach. Requires shapely.
gridpoints
List of gridpoints for the reach.
group
The TimeSeriesIdGroup assosciated with this location.
height
Height of the reach.
length
Length of the reach. If no length is available, returns zero.
n_gridpoints
Number of gridpoints in the reach.
name
Name of the reach.
quantities
A list of available quantities.
res1d
The Res1D instance that this location belongs to.
res1d_reaches
List of DHI.Mike1D.ResultDataAccess.IRes1DReach corresponding to this result location.
start_chainage
Start chainage of the reach or a DELETE_VALUE=-1e-30 in case it is not available.
start_node
Start node of 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 ResultReach.
get_query
Get a query for a data item.
interpolate_reach_critical_level
Interpolate the critical level at a given chainage by linear interpolation from the bounding node critical levels.
interpolate_reach_ground_level
Interpolate the ground level at a given chainage by linear interpolation from the bounding node ground levels.
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.ResultReach.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.ResultReach.add_query(data_item)
Add a query to ResultNetwork.queries list.
get_m1d_dataset
result_network.ResultReach.get_m1d_dataset(m1d_dataitem= None )
Get IRes1DDataSet object associated with ResultReach.
A ResultReach may consist of several IRes1DDataSet objects. Therefore, a IRes1DDataItem must be provided to identify the correct IRes1DDataSet.
Parameters
m1d_dataitem
IDataItem
The IRes1DDataItem associated with the returned IRes1DDataSet.
None
Returns
IRes1DDataSet
IRes1DDataSet object associated with ResultReach.
Raises
ValueError
If m1d_dataitem is not provided, or no reach of this ResultReach contains it.
get_query
result_network.ResultReach.get_query(data_item)
Get a query for a data item.
interpolate_reach_critical_level
result_network.ResultReach.interpolate_reach_critical_level(chainage)
Interpolate the critical level at a given chainage by linear interpolation from the bounding node critical levels.
Parameters
chainage
float
Chainage for which to interpolate the critical level.
required
Returns
float
Interpolated critical level.
interpolate_reach_ground_level
result_network.ResultReach.interpolate_reach_ground_level(chainage)
Interpolate the ground level at a given chainage by linear interpolation from the bounding node ground levels.
Parameters
chainage
float
Chainage for which to interpolate the ground level.
required
Returns
float
Interpolated ground level.
plot
result_network.ResultReach.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.ResultReach.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.ResultReach.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.ResultReach.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.ResultReach.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.ResultReach.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