|
2 | 2 | import plotly.graph_objects as go
|
3 | 3 |
|
4 | 4 | from .format_tools import plotly_figure_to_html_plot
|
| 5 | +from .plotly_bias_corrected import ( |
| 6 | + corrected_retrospective as plotly_corrected_retrospective, |
| 7 | + corrected_month_average as plotly_corrected_month_average, |
| 8 | + corrected_day_average as plotly_corrected_day_average, |
| 9 | + corrected_scatterplots as plotly_corrected_scatterplots, |
| 10 | +) |
5 | 11 | from .plotly_forecasts import (
|
6 | 12 | forecast as plotly_forecast,
|
7 | 13 | forecast_stats as plotly_forecast_stats,
|
8 |
| - forecast_ensembles as plotly_forecast_ensembles |
| 14 | + forecast_ensembles as plotly_forecast_ensembles, |
| 15 | + forecast_records as plotly_forecast_records, |
9 | 16 | )
|
10 | 17 | from .plotly_retrospective import (
|
11 | 18 | retrospective as plotly_retrospective,
|
|
14 | 21 | annual_averages as plotly_annual_averages,
|
15 | 22 | flow_duration_curve as plotly_flow_duration_curve,
|
16 | 23 | )
|
17 |
| -from .plotly_bias_corrected import ( |
18 |
| - corrected_retrospective as plotly_corrected_retrospective, |
19 |
| - corrected_month_average as plotly_corrected_month_average, |
20 |
| - corrected_day_average as plotly_corrected_day_average, |
21 |
| - corrected_scatterplots as plotly_corrected_scatterplots, |
22 |
| -) |
23 | 24 |
|
24 | 25 | __all__ = [
|
25 | 26 | 'forecast',
|
26 | 27 | 'forecast_stats',
|
27 | 28 | 'forecast_ensembles',
|
| 29 | + 'forecast_records', |
28 | 30 |
|
29 | 31 | 'retrospective',
|
30 | 32 | 'daily_averages',
|
@@ -105,6 +107,29 @@ def forecast_ensembles(df: pd.DataFrame, *,
|
105 | 107 | raise NotImplementedError(f'Plot type "{plot_type}" is not supported.')
|
106 | 108 |
|
107 | 109 |
|
| 110 | +def forecast_records(df: pd.DataFrame, *, |
| 111 | + plot_type: str = 'plotly', |
| 112 | + rp_df: pd.DataFrame = None, |
| 113 | + plot_titles: list = None, ) -> go.Figure: |
| 114 | + """ |
| 115 | + Plots forecasted streamflow and optional return periods |
| 116 | + Args: |
| 117 | + df: |
| 118 | + plot_type: |
| 119 | + rp_df: |
| 120 | + plot_titles: |
| 121 | +
|
| 122 | + Returns: |
| 123 | + go.Figure |
| 124 | + """ |
| 125 | + if plot_type in ('plotly', 'html'): |
| 126 | + figure = plotly_forecast_records(df, rp_df=rp_df, plot_titles=plot_titles) |
| 127 | + if plot_type == 'html': |
| 128 | + return plotly_figure_to_html_plot(figure) |
| 129 | + return figure |
| 130 | + raise NotImplementedError(f'Plot type "{plot_type}" is not supported.') |
| 131 | + |
| 132 | + |
108 | 133 | def retrospective(df: pd.DataFrame, *,
|
109 | 134 | plot_type: str = 'plotly',
|
110 | 135 | rp_df: pd.DataFrame = None,
|
|
0 commit comments