From 916fedda1cf7220368927959c2cc108ad1c12b5a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 00:51:31 +0000 Subject: [PATCH 01/15] Bump notebook from 7.2.1 to 7.2.2 in /docs Bumps [notebook](https://github.com/jupyter/notebook) from 7.2.1 to 7.2.2. - [Release notes](https://github.com/jupyter/notebook/releases) - [Changelog](https://github.com/jupyter/notebook/blob/@jupyter-notebook/tree@7.2.2/CHANGELOG.md) - [Commits](https://github.com/jupyter/notebook/compare/@jupyter-notebook/tree@7.2.1...@jupyter-notebook/tree@7.2.2) --- updated-dependencies: - dependency-name: notebook dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- docs/notebook_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/notebook_requirements.txt b/docs/notebook_requirements.txt index f3c5dc95..4398ec1f 100644 --- a/docs/notebook_requirements.txt +++ b/docs/notebook_requirements.txt @@ -29,7 +29,7 @@ nbclient==0.10.0 nbconvert==7.16.4 nbformat==5.10.4 nest-asyncio==1.6.0 -notebook==7.2.1 +notebook==7.2.2 numexpr==2.10.1 pandocfilters==1.5.1 parso==0.8.4 From 3e4be1997d8a1017590bbfc9dbedec46bfca7178 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 May 2025 19:34:16 +0000 Subject: [PATCH 02/15] Bump tornado from 6.4.2 to 6.5.1 in /docs Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.4.2 to 6.5.1. - [Changelog](https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst) - [Commits](https://github.com/tornadoweb/tornado/compare/v6.4.2...v6.5.1) --- updated-dependencies: - dependency-name: tornado dependency-version: 6.5.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- docs/notebook_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/notebook_requirements.txt b/docs/notebook_requirements.txt index 4398ec1f..81c4b6e2 100644 --- a/docs/notebook_requirements.txt +++ b/docs/notebook_requirements.txt @@ -48,7 +48,7 @@ soupsieve==2.6 terminado==0.18.1 testpath==0.6.0 tinycss2==1.3.0 -tornado==6.4.2 +tornado==6.5.1 traitlets==5.14.3 wcwidth==0.2.13 webencodings==0.5.1 From 7c312ad86a9702e098e0e7c5da67eab415eb0eb3 Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 28 May 2025 14:31:32 -0600 Subject: [PATCH 03/15] add keyword 'label' to degradation_timeseries_plot, enabling 'left' and 'center' labeling options. --- rdtools/plotting.py | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/rdtools/plotting.py b/rdtools/plotting.py index 93a07bac..108e704b 100644 --- a/rdtools/plotting.py +++ b/rdtools/plotting.py @@ -431,7 +431,7 @@ def availability_summary_plots(power_system, power_subsystem, loss_total, return fig -def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, +def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, label= 'right', fig=None, plot_color=None, ci_color=None, **kwargs): ''' Plot resampled time series of degradation trend with time @@ -447,6 +447,11 @@ def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, at least 50% of datapoints to be included in rolling plot. include_ci : bool, default True calculate and plot 2-sigma confidence intervals along with rolling median + label : {'right', 'left', 'center'}, default 'right' + A combination of 1) which Year-on-Year slope edge to label, and 2) which rolling median edge to label. + 'right' : label right edge of YoY slope and right edge of rolling median interval. + 'center': label center of YoY slope interval and center of rolling median interval. + 'left' : label left edge of YoY slope and center of rolling median interval. fig : matplotlib, optional fig object to add new plot to (first set of axes only) plot_color : str, optional @@ -465,7 +470,7 @@ def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, ------- matplotlib.figure.Figure ''' - + import datetime def _bootstrap(x, percentile, reps): # stolen from degradation_year_on_year n1 = len(x) @@ -475,7 +480,6 @@ def _bootstrap(x, percentile, reps): try: results_values = yoy_info['YoY_values'] - except KeyError: raise KeyError("yoy_info input dictionary does not contain key `YoY_values`.") @@ -483,8 +487,23 @@ def _bootstrap(x, percentile, reps): plot_color = 'tab:orange' if ci_color is None: ci_color = 'C0' - - roller = results_values.rolling(f'{rolling_days}d', min_periods=rolling_days//2) + + if label not in {None, "left", "right", "center"}: + raise ValueError(f"Unsupported value {label} for `label`") + if label is None: + label = "right" + + if label == "right": + center = False + offset_days = 0 + elif label == "center": + center = True + offset_days = 182 + elif label == "left": + center = True + offset_days = 365 + + roller = results_values.rolling(f'{rolling_days}d', min_periods=rolling_days//2, center=center) # unfortunately it seems that you can't return multiple values in the rolling.apply() kernel. # TODO: figure out some workaround to return both percentiles in a single pass if include_ci: @@ -495,8 +514,10 @@ def _bootstrap(x, percentile, reps): else: ax = fig.axes[0] if include_ci: - ax.fill_between(ci_lower.index, ci_lower, ci_upper, color=ci_color) - ax.plot(roller.median(), color=plot_color, **kwargs) + ax.fill_between(ci_lower.index - datetime.timedelta(days=offset_days), + ci_lower, ci_upper, color=ci_color) + ax.plot(roller.median().index - datetime.timedelta(days=offset_days), + roller.median(), color=plot_color, **kwargs) ax.axhline(results_values.median(), c='k', ls='--') plt.ylabel('Degradation trend (%/yr)') fig.autofmt_xdate() From d6a898e3d0424feb6a2c3ab2346e14aeddd2bd1d Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 28 May 2025 15:29:53 -0600 Subject: [PATCH 04/15] Update changelog, add pytests, update sphinx documentation --- docs/sphinx/source/changelog.rst | 1 + docs/sphinx/source/changelog/pending.rst | 16 ++++++++++++++++ rdtools/plotting.py | 9 +++++---- rdtools/test/plotting_test.py | 13 +++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 docs/sphinx/source/changelog/pending.rst diff --git a/docs/sphinx/source/changelog.rst b/docs/sphinx/source/changelog.rst index fc3d805a..341cb307 100644 --- a/docs/sphinx/source/changelog.rst +++ b/docs/sphinx/source/changelog.rst @@ -1,5 +1,6 @@ RdTools Change Log ================== +.. include:: changelog/pending.rst .. include:: changelog/v3.0.0.rst .. include:: changelog/v2.1.8.rst .. include:: changelog/v2.1.7.rst diff --git a/docs/sphinx/source/changelog/pending.rst b/docs/sphinx/source/changelog/pending.rst new file mode 100644 index 00000000..59ee736a --- /dev/null +++ b/docs/sphinx/source/changelog/pending.rst @@ -0,0 +1,16 @@ +************************* +v3.0.x (X, X, 2025) +************************* + +Enhancements +------------ +* :py:func:`~rdtools.plotting.degradation_timeseries_plot` has new parameter ``label=`` + to allow the timeseries plot to have right labeling (default), center or left labeling. + (:issue:`455`) + + + +Contributors +------------ +* Chris Deline (:ghuser:`cdeline`) + diff --git a/rdtools/plotting.py b/rdtools/plotting.py index 108e704b..f9f814e8 100644 --- a/rdtools/plotting.py +++ b/rdtools/plotting.py @@ -448,10 +448,11 @@ def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, lab include_ci : bool, default True calculate and plot 2-sigma confidence intervals along with rolling median label : {'right', 'left', 'center'}, default 'right' - A combination of 1) which Year-on-Year slope edge to label, and 2) which rolling median edge to label. - 'right' : label right edge of YoY slope and right edge of rolling median interval. - 'center': label center of YoY slope interval and center of rolling median interval. - 'left' : label left edge of YoY slope and center of rolling median interval. + A combination of 1) which Year-on-Year slope edge to label, and 2) which rolling median edge to label. + + * ``right`` : label right edge of YoY slope and right edge of rolling median interval. + * ``center``: label center of YoY slope interval and center of rolling median interval. + * ``left`` : label left edge of YoY slope and center of rolling median interval. fig : matplotlib, optional fig object to add new plot to (first set of axes only) plot_color : str, optional diff --git a/rdtools/test/plotting_test.py b/rdtools/test/plotting_test.py index cb4639cb..20ff372e 100644 --- a/rdtools/test/plotting_test.py +++ b/rdtools/test/plotting_test.py @@ -255,4 +255,17 @@ def test_degradation_timeseries_plot(degradation_info): # test defaults result = degradation_timeseries_plot(yoy_info) assert_isinstance(result, plt.Figure) + # test other label options + result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='center', fig=result) + assert_isinstance(result, plt.Figure) + result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='left') + assert_isinstance(result, plt.Figure) + result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label=None) + assert_isinstance(result, plt.Figure) + + with pytest.raises(KeyError): + degradation_timeseries_plot({'a':1}, include_ci=False) + with pytest.raises(ValueError): + degradation_timeseries_plot(yoy_info, include_ci=False, label='CENTER') + plt.close('all') From df2effcf405b1871915b79e07e45f7c432c2f56d Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 28 May 2025 15:39:50 -0600 Subject: [PATCH 05/15] fix flake8 grumbles --- rdtools/plotting.py | 13 ++++++++----- rdtools/test/plotting_test.py | 5 +++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/rdtools/plotting.py b/rdtools/plotting.py index f9f814e8..11ecde8c 100644 --- a/rdtools/plotting.py +++ b/rdtools/plotting.py @@ -431,7 +431,7 @@ def availability_summary_plots(power_system, power_subsystem, loss_total, return fig -def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, label= 'right', +def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, label='right', fig=None, plot_color=None, ci_color=None, **kwargs): ''' Plot resampled time series of degradation trend with time @@ -448,8 +448,9 @@ def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, lab include_ci : bool, default True calculate and plot 2-sigma confidence intervals along with rolling median label : {'right', 'left', 'center'}, default 'right' - A combination of 1) which Year-on-Year slope edge to label, and 2) which rolling median edge to label. - + A combination of 1) which Year-on-Year slope edge to label, + and 2) which rolling median edge to label. + * ``right`` : label right edge of YoY slope and right edge of rolling median interval. * ``center``: label center of YoY slope interval and center of rolling median interval. * ``left`` : label left edge of YoY slope and center of rolling median interval. @@ -471,7 +472,9 @@ def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, lab ------- matplotlib.figure.Figure ''' + import datetime + def _bootstrap(x, percentile, reps): # stolen from degradation_year_on_year n1 = len(x) @@ -488,7 +491,7 @@ def _bootstrap(x, percentile, reps): plot_color = 'tab:orange' if ci_color is None: ci_color = 'C0' - + if label not in {None, "left", "right", "center"}: raise ValueError(f"Unsupported value {label} for `label`") if label is None: @@ -515,7 +518,7 @@ def _bootstrap(x, percentile, reps): else: ax = fig.axes[0] if include_ci: - ax.fill_between(ci_lower.index - datetime.timedelta(days=offset_days), + ax.fill_between(ci_lower.index - datetime.timedelta(days=offset_days), ci_lower, ci_upper, color=ci_color) ax.plot(roller.median().index - datetime.timedelta(days=offset_days), roller.median(), color=plot_color, **kwargs) diff --git a/rdtools/test/plotting_test.py b/rdtools/test/plotting_test.py index 20ff372e..f1ebb0ae 100644 --- a/rdtools/test/plotting_test.py +++ b/rdtools/test/plotting_test.py @@ -256,7 +256,8 @@ def test_degradation_timeseries_plot(degradation_info): result = degradation_timeseries_plot(yoy_info) assert_isinstance(result, plt.Figure) # test other label options - result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='center', fig=result) + result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, + label='center', fig=result) assert_isinstance(result, plt.Figure) result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='left') assert_isinstance(result, plt.Figure) @@ -264,7 +265,7 @@ def test_degradation_timeseries_plot(degradation_info): assert_isinstance(result, plt.Figure) with pytest.raises(KeyError): - degradation_timeseries_plot({'a':1}, include_ci=False) + degradation_timeseries_plot({'a': 1}, include_ci=False) with pytest.raises(ValueError): degradation_timeseries_plot(yoy_info, include_ci=False, label='CENTER') From 3099497aaf1d1f6b494a971170ff5fdd05846c4c Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 18 Jun 2025 14:06:48 -0600 Subject: [PATCH 06/15] update pytests to include axes limits --- rdtools/test/plotting_test.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rdtools/test/plotting_test.py b/rdtools/test/plotting_test.py index f1ebb0ae..453423a0 100644 --- a/rdtools/test/plotting_test.py +++ b/rdtools/test/plotting_test.py @@ -255,12 +255,15 @@ def test_degradation_timeseries_plot(degradation_info): # test defaults result = degradation_timeseries_plot(yoy_info) assert_isinstance(result, plt.Figure) + assert(result.get_axes()[0].get_xlim()[0] == 17685.55) # test other label options result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='center', fig=result) assert_isinstance(result, plt.Figure) + assert(result.get_axes()[0].get_xlim()[0] == 17304.4) result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='left') assert_isinstance(result, plt.Figure) + assert(result.get_axes()[0].get_xlim()[0] == 17130.5) result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label=None) assert_isinstance(result, plt.Figure) From 1d140e6ed1feca9691c20aaa5a728569a953e85a Mon Sep 17 00:00:00 2001 From: cdeline Date: Wed, 18 Jun 2025 14:27:06 -0600 Subject: [PATCH 07/15] fix flake8 grumbles --- rdtools/test/plotting_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rdtools/test/plotting_test.py b/rdtools/test/plotting_test.py index 453423a0..029514ef 100644 --- a/rdtools/test/plotting_test.py +++ b/rdtools/test/plotting_test.py @@ -255,15 +255,15 @@ def test_degradation_timeseries_plot(degradation_info): # test defaults result = degradation_timeseries_plot(yoy_info) assert_isinstance(result, plt.Figure) - assert(result.get_axes()[0].get_xlim()[0] == 17685.55) + assert (result.get_axes()[0].get_xlim()[0] == 17685.55) # test other label options result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='center', fig=result) assert_isinstance(result, plt.Figure) - assert(result.get_axes()[0].get_xlim()[0] == 17304.4) + assert (result.get_axes()[0].get_xlim()[0] == 17304.4) result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='left') assert_isinstance(result, plt.Figure) - assert(result.get_axes()[0].get_xlim()[0] == 17130.5) + assert (result.get_axes()[0].get_xlim()[0] == 17130.5) result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label=None) assert_isinstance(result, plt.Figure) From 424fc7d991d4239dba202c812c1d26700ba1f8f4 Mon Sep 17 00:00:00 2001 From: cdeline Date: Mon, 23 Jun 2025 15:47:31 -0600 Subject: [PATCH 08/15] statsmodels 0.14.4 is not able to handle the latest scipy. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 441b16c0..ed56d3cc 100755 --- a/setup.py +++ b/setup.py @@ -47,7 +47,8 @@ "numpy >= 1.22.4", "pandas >= 1.4.4", "statsmodels >= 0.13.5", - "scipy >= 1.8.1", + # statsmodels 0.14.4 is not able to handle the latest scipy + "scipy >= 1.8.1, <1.16.0", "h5py >= 3.7.0", "plotly>=4.0.0", "xgboost >= 1.6.0", From ea8854e3c0ae33160c9307cb9e128825d52d58f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 20:48:39 +0000 Subject: [PATCH 09/15] Bump jinja2 from 3.1.5 to 3.1.6 in /docs Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.5 to 3.1.6. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst) - [Commits](https://github.com/pallets/jinja/compare/3.1.5...3.1.6) --- updated-dependencies: - dependency-name: jinja2 dependency-version: 3.1.6 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- docs/notebook_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/notebook_requirements.txt b/docs/notebook_requirements.txt index 4398ec1f..0cee77e6 100644 --- a/docs/notebook_requirements.txt +++ b/docs/notebook_requirements.txt @@ -15,7 +15,7 @@ ipython==8.26.0 ipython-genutils==0.2.0 ipywidgets==8.1.3 jedi==0.19.1 -Jinja2==3.1.5 +Jinja2==3.1.6 jsonschema==4.23.0 jupyter==1.0.0 jupyter-client==8.6.2 From f4b77bb04a1444f530c9d920e122430b7b377b32 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 20:50:34 +0000 Subject: [PATCH 10/15] Bump requests from 2.32.3 to 2.32.4 Bumps [requests](https://github.com/psf/requests) from 2.32.3 to 2.32.4. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.32.3...v2.32.4) --- updated-dependencies: - dependency-name: requests dependency-version: 2.32.4 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 387589a4..d6f4a47b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ python-dateutil==2.9.0 pytz==2024.1 arch==7.0.0 filterpy==1.4.5 -requests==2.32.3 +requests==2.32.4 retrying==1.3.4 scikit-learn==1.5.1 scipy==1.13.1 From e2c387a95891c2f2d0058422024aad5f3c190a7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 20:51:19 +0000 Subject: [PATCH 11/15] Bump urllib3 from 2.2.2 to 2.5.0 Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.2 to 2.5.0. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.2.2...2.5.0) --- updated-dependencies: - dependency-name: urllib3 dependency-version: 2.5.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 387589a4..9a0ddd05 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,6 +30,6 @@ statsmodels==0.14.2 threadpoolctl==3.5.0 tomli==2.0.1 typing_extensions==4.12.2 -urllib3==2.2.2 +urllib3==2.5.0 xgboost==2.1.1 From 03e094e020bceb4f87aa1e26f5201f63ca59ef34 Mon Sep 17 00:00:00 2001 From: cdeline Date: Mon, 7 Jul 2025 13:01:19 -0600 Subject: [PATCH 12/15] try setup.py now that statsmodels has a new release. --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index ed56d3cc..441b16c0 100755 --- a/setup.py +++ b/setup.py @@ -47,8 +47,7 @@ "numpy >= 1.22.4", "pandas >= 1.4.4", "statsmodels >= 0.13.5", - # statsmodels 0.14.4 is not able to handle the latest scipy - "scipy >= 1.8.1, <1.16.0", + "scipy >= 1.8.1", "h5py >= 3.7.0", "plotly>=4.0.0", "xgboost >= 1.6.0", From 3c43bdb7cbd6c3a5f7150bf4e91909dbf29496ef Mon Sep 17 00:00:00 2001 From: Michael Deceglie Date: Wed, 20 Aug 2025 19:28:16 -0600 Subject: [PATCH 13/15] Update changelog --- docs/sphinx/source/changelog.rst | 1 + docs/sphinx/source/changelog/v3.0.1.rst | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 docs/sphinx/source/changelog/v3.0.1.rst diff --git a/docs/sphinx/source/changelog.rst b/docs/sphinx/source/changelog.rst index fc3d805a..371f6e00 100644 --- a/docs/sphinx/source/changelog.rst +++ b/docs/sphinx/source/changelog.rst @@ -1,5 +1,6 @@ RdTools Change Log ================== +.. include:: changelog/v3.0.1.rst .. include:: changelog/v3.0.0.rst .. include:: changelog/v2.1.8.rst .. include:: changelog/v2.1.7.rst diff --git a/docs/sphinx/source/changelog/v3.0.1.rst b/docs/sphinx/source/changelog/v3.0.1.rst new file mode 100644 index 00000000..cc941121 --- /dev/null +++ b/docs/sphinx/source/changelog/v3.0.1.rst @@ -0,0 +1,11 @@ +************************* +v3.0.1 (August 20, 2025) +************************* + +Requirements +------------ +* Updated Jinja2==3.1.6 in ``notebook_requirements.txt`` (:pull:`465`) +* Updated tornado==6.5.1 in ``notebook_requirements.txt`` (:pull:`465`) +* Updated requests==2.32.4 in ``requirements.txt`` (:pull:`465`) +* Updated urllib3==2.5.0 in ``requirements.txt`` (:pull:`465`) +* Removed constraint that scipy<1.16.0 (:pull:`465`) \ No newline at end of file From 8060f317773c9a7cc86c59a3ab1a14889064f112 Mon Sep 17 00:00:00 2001 From: Michael Deceglie Date: Wed, 20 Aug 2025 20:12:08 -0600 Subject: [PATCH 14/15] Update release date --- docs/sphinx/source/changelog/v3.0.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/changelog/v3.0.1.rst b/docs/sphinx/source/changelog/v3.0.1.rst index cc941121..9bfaaaa3 100644 --- a/docs/sphinx/source/changelog/v3.0.1.rst +++ b/docs/sphinx/source/changelog/v3.0.1.rst @@ -1,5 +1,5 @@ ************************* -v3.0.1 (August 20, 2025) +v3.0.1 (August 21, 2025) ************************* Requirements From 8451499c5fd68748b357ff24f190a23a19245151 Mon Sep 17 00:00:00 2001 From: cdeline Date: Fri, 19 Sep 2025 14:01:15 -0600 Subject: [PATCH 15/15] update plotting tests to be relative value, update ordering of module import in plotting.py, per Copilot review. --- rdtools/plotting.py | 3 +- rdtools/test/plotting_test.py | 53 ++++++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/rdtools/plotting.py b/rdtools/plotting.py index 11ecde8c..b59e2b8c 100644 --- a/rdtools/plotting.py +++ b/rdtools/plotting.py @@ -5,6 +5,7 @@ import plotly.express as px import numpy as np import warnings +import datetime def degradation_summary_plots(yoy_rd, yoy_ci, yoy_info, normalized_yield, @@ -473,8 +474,6 @@ def degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, lab matplotlib.figure.Figure ''' - import datetime - def _bootstrap(x, percentile, reps): # stolen from degradation_year_on_year n1 = len(x) diff --git a/rdtools/test/plotting_test.py b/rdtools/test/plotting_test.py index 029514ef..f4eb83f6 100644 --- a/rdtools/test/plotting_test.py +++ b/rdtools/test/plotting_test.py @@ -252,20 +252,45 @@ def test_availability_summary_plots_empty(availability_analysis_object): def test_degradation_timeseries_plot(degradation_info): power, yoy_rd, yoy_ci, yoy_info = degradation_info - # test defaults - result = degradation_timeseries_plot(yoy_info) - assert_isinstance(result, plt.Figure) - assert (result.get_axes()[0].get_xlim()[0] == 17685.55) - # test other label options - result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, - label='center', fig=result) - assert_isinstance(result, plt.Figure) - assert (result.get_axes()[0].get_xlim()[0] == 17304.4) - result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='left') - assert_isinstance(result, plt.Figure) - assert (result.get_axes()[0].get_xlim()[0] == 17130.5) - result = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label=None) - assert_isinstance(result, plt.Figure) + # test defaults (label='right') + result_right = degradation_timeseries_plot(yoy_info) + assert_isinstance(result_right, plt.Figure) + xlim_right = result_right.get_axes()[0].get_xlim()[0] + + # test label='center' + result_center = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, + label='center', fig=result_right) + assert_isinstance(result_center, plt.Figure) + xlim_center = result_center.get_axes()[0].get_xlim()[0] + + # test label='left' + result_left = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label='left') + assert_isinstance(result_left, plt.Figure) + xlim_left = result_left.get_axes()[0].get_xlim()[0] + + # test label=None (should default to 'right') + result_none = degradation_timeseries_plot(yoy_info=yoy_info, include_ci=False, label=None) + assert_isinstance(result_none, plt.Figure) + xlim_none = result_none.get_axes()[0].get_xlim()[0] + + # Check that the xlim values are offset as expected + # right > center > left (since offset_days increases) + assert xlim_right > xlim_center > xlim_left + assert xlim_right == xlim_none # label=None defaults to 'right' + + # The expected difference from right to left is 548 days (1.5 yrs), allow 5% tolerance + expected_diff = 548 + actual_diff = (xlim_right - xlim_left) + tolerance = expected_diff * 0.05 + assert abs(actual_diff - expected_diff) <= tolerance, \ + f"difference of right-left xlim {actual_diff} not within 5% of 1.5 yrs." + + # The expected difference from right to center is 365 days, allow 5% tolerance + expected_diff2 = 365 + actual_diff2 = (xlim_right - xlim_center) + tolerance2 = expected_diff2 * 0.05 + assert abs(actual_diff2 - expected_diff2) <= tolerance2, \ + f"difference of right-center xlim {actual_diff2} not within 5% of 1 yr." with pytest.raises(KeyError): degradation_timeseries_plot({'a': 1}, include_ci=False)