Skip to content

Commit 7613f6d

Browse files
cbcrespoAdamRJensenechedey-ls
authored
Change OrderedDict to dict in perez and perez_driesse (#2789)
* Change OrderedDict to Dict in perez and perez_driesse * Add what's new entry * Update docs/sphinx/source/whatsnew/v0.16.0.rst Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> * Update docs/sphinx/source/whatsnew/v0.16.0.rst Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com> * Change Dict to dict --------- Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com>
1 parent b4cc5f3 commit 7613f6d

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

docs/sphinx/source/whatsnew/v0.16.0.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33

44
v0.16.0
5-
-----------------------
6-
75
Breaking Changes
86
~~~~~~~~~~~~~~~~
7+
* Change output type of :py:func:`pvlib.irradiance.perez` and
8+
:py:func:`pvlib.irradiance.perez_driesse` from ``OrderedDict`` to ``dict`` when
9+
``return_components=True`` to be consistent with other models.
10+
(:pull:`2789`)
911
* Remove empty ``poa_horizon`` key from the ``diffuse_components`` output of
1012
:py:func:`pvlib.irradiance.haydavies`.
1113
(:pull:`2788`)
@@ -45,4 +47,4 @@ Maintenance
4547

4648
Contributors
4749
~~~~~~~~~~~~
48-
50+
* Carolina Crespo (:ghuser:`cbcrespo`)

pvlib/irradiance.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
11041104
11051105
Returns
11061106
--------
1107-
numeric, OrderedDict, or DataFrame
1107+
numeric, dict, or DataFrame
11081108
Return type controlled by `return_components` argument.
11091109
If ``return_components=False``, `sky_diffuse` is returned.
11101110
If ``return_components=True``, `diffuse_components` is returned.
@@ -1113,7 +1113,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
11131113
The sky diffuse component of the solar radiation on a tilted
11141114
surface.
11151115
1116-
diffuse_components : OrderedDict (array input) or DataFrame (Series input)
1116+
diffuse_components : dict (array input) or DataFrame (Series input)
11171117
Keys/columns are:
11181118
* poa_sky_diffuse: Total sky diffuse
11191119
* poa_isotropic
@@ -1200,13 +1200,12 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
12001200
sky_diffuse = np.where(np.isnan(airmass), 0, sky_diffuse)
12011201

12021202
if return_components:
1203-
diffuse_components = OrderedDict()
1204-
diffuse_components['poa_sky_diffuse'] = sky_diffuse
1205-
1206-
# Calculate the different components
1207-
diffuse_components['poa_isotropic'] = dhi * term1
1208-
diffuse_components['poa_circumsolar'] = dhi * term2
1209-
diffuse_components['poa_horizon'] = dhi * term3
1203+
diffuse_components = {
1204+
'poa_sky_diffuse': sky_diffuse,
1205+
'poa_isotropic': dhi * term1,
1206+
'poa_circumsolar': dhi * term2,
1207+
'poa_horizon': dhi * term3
1208+
}
12101209

12111210
# Set values of components to 0 when sky_diffuse is 0
12121211
mask = sky_diffuse == 0
@@ -1346,7 +1345,7 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
13461345
13471346
Returns
13481347
--------
1349-
numeric, OrderedDict, or DataFrame
1348+
numeric, dict, or DataFrame
13501349
Return type controlled by `return_components` argument.
13511350
If ``return_components=False``, `sky_diffuse` is returned.
13521351
If ``return_components=True``, `diffuse_components` is returned.
@@ -1355,7 +1354,7 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
13551354
The sky diffuse component of the solar radiation on a tilted
13561355
surface.
13571356
1358-
diffuse_components : OrderedDict (array input) or DataFrame (Series input)
1357+
diffuse_components : dict (array input) or DataFrame (Series input)
13591358
Keys/columns are:
13601359
* poa_sky_diffuse: Total sky diffuse
13611360
* poa_isotropic
@@ -1420,13 +1419,12 @@ def perez_driesse(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
14201419
sky_diffuse = np.maximum(dhi * (term1 + term2 + term3), 0)
14211420

14221421
if return_components:
1423-
diffuse_components = OrderedDict()
1424-
diffuse_components['poa_sky_diffuse'] = sky_diffuse
1425-
1426-
# Calculate the different components
1427-
diffuse_components['poa_isotropic'] = dhi * term1
1428-
diffuse_components['poa_circumsolar'] = dhi * term2
1429-
diffuse_components['poa_horizon'] = dhi * term3
1422+
diffuse_components = {
1423+
'poa_sky_diffuse': sky_diffuse,
1424+
'poa_isotropic': dhi * term1,
1425+
'poa_circumsolar': dhi * term2,
1426+
'poa_horizon': dhi * term3
1427+
}
14301428

14311429
if isinstance(sky_diffuse, pd.Series):
14321430
diffuse_components = pd.DataFrame(diffuse_components)

0 commit comments

Comments
 (0)