From 5ce36014bcd0c0747c32df478f5a38aef7443b9d Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Wed, 17 Jun 2026 14:05:49 +0100 Subject: [PATCH 1/3] Change OrderedDict to Dict in perez and perez_driesse --- pvlib/irradiance.py | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index b38db534fe..956aa17949 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -1106,7 +1106,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra, Returns -------- - numeric, OrderedDict, or DataFrame + numeric, Dict, or DataFrame Return type controlled by `return_components` argument. If ``return_components=False``, `sky_diffuse` is returned. If ``return_components=True``, `diffuse_components` is returned. @@ -1115,7 +1115,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra, The sky diffuse component of the solar radiation on a tilted surface. - diffuse_components : OrderedDict (array input) or DataFrame (Series input) + diffuse_components : Dict (array input) or DataFrame (Series input) Keys/columns are: * poa_sky_diffuse: Total sky diffuse * poa_isotropic @@ -1202,13 +1202,12 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra, sky_diffuse = np.where(np.isnan(airmass), 0, sky_diffuse) if return_components: - diffuse_components = OrderedDict() - diffuse_components['poa_sky_diffuse'] = sky_diffuse - - # Calculate the different components - diffuse_components['poa_isotropic'] = dhi * term1 - diffuse_components['poa_circumsolar'] = dhi * term2 - diffuse_components['poa_horizon'] = dhi * term3 + diffuse_components = { + 'poa_sky_diffuse': sky_diffuse, + 'poa_isotropic': dhi * term1, + 'poa_circumsolar': dhi * term2, + 'poa_horizon': dhi * term3 + } # Set values of components to 0 when sky_diffuse is 0 mask = sky_diffuse == 0 @@ -1348,7 +1347,7 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra, Returns -------- - numeric, OrderedDict, or DataFrame + numeric, Dict, or DataFrame Return type controlled by `return_components` argument. If ``return_components=False``, `sky_diffuse` is returned. If ``return_components=True``, `diffuse_components` is returned. @@ -1357,7 +1356,7 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra, The sky diffuse component of the solar radiation on a tilted surface. - diffuse_components : OrderedDict (array input) or DataFrame (Series input) + diffuse_components : Dict (array input) or DataFrame (Series input) Keys/columns are: * poa_sky_diffuse: Total sky diffuse * poa_isotropic @@ -1422,13 +1421,12 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra, sky_diffuse = np.maximum(dhi * (term1 + term2 + term3), 0) if return_components: - diffuse_components = OrderedDict() - diffuse_components['poa_sky_diffuse'] = sky_diffuse - - # Calculate the different components - diffuse_components['poa_isotropic'] = dhi * term1 - diffuse_components['poa_circumsolar'] = dhi * term2 - diffuse_components['poa_horizon'] = dhi * term3 + diffuse_components = { + 'poa_sky_diffuse': sky_diffuse, + 'poa_isotropic': dhi * term1, + 'poa_circumsolar': dhi * term2, + 'poa_horizon': dhi * term3 + } if isinstance(sky_diffuse, pd.Series): diffuse_components = pd.DataFrame(diffuse_components) From ca99e7b61a87061bdefc1d7056f3343834ff5e32 Mon Sep 17 00:00:00 2001 From: cbcrespo Date: Wed, 1 Jul 2026 10:43:58 +0100 Subject: [PATCH 2/3] Add what's new entry --- docs/sphinx/source/whatsnew/v0.16.0.rst | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 docs/sphinx/source/whatsnew/v0.16.0.rst diff --git a/docs/sphinx/source/whatsnew/v0.16.0.rst b/docs/sphinx/source/whatsnew/v0.16.0.rst new file mode 100644 index 0000000000..eaa4e61a6d --- /dev/null +++ b/docs/sphinx/source/whatsnew/v0.16.0.rst @@ -0,0 +1,47 @@ +.. _whatsnew_0_16_0: + + +v0.16.0 +------------------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ +* Change output type of :py:func:`pvlib.irradiance.perez` and +:py:func:`pvlib.irradiance.perez_driesse` from OrderedDict to dict when +``return_components=True`` to be consistent with other models. (:pull:`2789`) + +Deprecations +~~~~~~~~~~~~ + + +Bug fixes +~~~~~~~~~ + + +Enhancements +~~~~~~~~~~~~ + + +Documentation +~~~~~~~~~~~~~ + + +Testing +~~~~~~~ + + +Benchmarking +~~~~~~~~~~~~ + + +Requirements +~~~~~~~~~~~~ + + +Maintenance +~~~~~~~~~~~ + + +Contributors +~~~~~~~~~~~~ +* Carolina Crespo (:ghuser:`cbcrespo`) \ No newline at end of file From c06995139609c77a02630134b3fc71f6070dd5c9 Mon Sep 17 00:00:00 2001 From: cbcrespo <97249533+cbcrespo@users.noreply.github.com> Date: Thu, 2 Jul 2026 10:18:37 +0100 Subject: [PATCH 3/3] Update docs/sphinx/source/whatsnew/v0.16.0.rst Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> --- docs/sphinx/source/whatsnew/v0.16.0.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.16.0.rst b/docs/sphinx/source/whatsnew/v0.16.0.rst index eaa4e61a6d..90523eaa84 100644 --- a/docs/sphinx/source/whatsnew/v0.16.0.rst +++ b/docs/sphinx/source/whatsnew/v0.16.0.rst @@ -7,8 +7,9 @@ v0.16.0 Breaking Changes ~~~~~~~~~~~~~~~~ * Change output type of :py:func:`pvlib.irradiance.perez` and -:py:func:`pvlib.irradiance.perez_driesse` from OrderedDict to dict when -``return_components=True`` to be consistent with other models. (:pull:`2789`) + :py:func:`pvlib.irradiance.perez_driesse` from OrderedDict to dict when + ``return_components=True`` to be consistent with other models. + (:pull:`2789`) Deprecations ~~~~~~~~~~~~