Skip to content
48 changes: 48 additions & 0 deletions docs/sphinx/source/whatsnew/v0.16.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.. _whatsnew_0_16_0:


v0.16.0
-----------------------

Breaking Changes
~~~~~~~~~~~~~~~~
* Remove empty ``poa_horizon`` key from the ``diffuse_components`` output of
:py:func:`pvlib.irradiance.haydavies`.
(:pull:`2788`)


Deprecations
~~~~~~~~~~~~


Bug fixes
~~~~~~~~~


Enhancements
~~~~~~~~~~~~


Documentation
~~~~~~~~~~~~~


Testing
~~~~~~~


Benchmarking
~~~~~~~~~~~~


Requirements
~~~~~~~~~~~~


Maintenance
~~~~~~~~~~~


Contributors
~~~~~~~~~~~~

19 changes: 7 additions & 12 deletions pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ def haydavies(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 `False`, ``sky_diffuse`` is returned.
If `True`, ``diffuse_components`` is returned.
Expand All @@ -792,13 +792,11 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
The sky diffuse component of the solar radiation on a tilted
surface. [Wm⁻²]

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
* poa_circumsolar
* poa_horizon (always zero, not accounted for by the
Hay-Davies model)

Notes
------
Expand Down Expand Up @@ -856,14 +854,11 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
sky_diffuse = poa_isotropic + poa_circumsolar

if return_components:
diffuse_components = OrderedDict()
diffuse_components['poa_sky_diffuse'] = sky_diffuse

# Calculate the individual components
diffuse_components['poa_isotropic'] = poa_isotropic
diffuse_components['poa_circumsolar'] = poa_circumsolar
diffuse_components['poa_horizon'] = np.where(
np.isnan(diffuse_components['poa_isotropic']), np.nan, 0.)
diffuse_components = {
'poa_sky_diffuse': sky_diffuse,
'poa_isotropic': poa_isotropic,
'poa_circumsolar': poa_circumsolar
}

if isinstance(sky_diffuse, pd.Series):
diffuse_components = pd.DataFrame(diffuse_components)
Expand Down
6 changes: 2 additions & 4 deletions tests/test_irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,11 @@ def test_haydavies(irrad_data, ephem_data, dni_et):


def test_haydavies_components(irrad_data, ephem_data, dni_et):
keys = ['poa_sky_diffuse', 'poa_isotropic', 'poa_circumsolar',
'poa_horizon']
keys = ['poa_sky_diffuse', 'poa_isotropic', 'poa_circumsolar']
expected = pd.DataFrame(np.array(
[[0, 27.1775, 102.9949, 33.1909],
[0, 27.1775, 30.1818, 27.9837],
[0, 0, 72.8130, 5.2071],
[0, 0, 0, 0]]).T,
[0, 0, 72.8130, 5.2071]]).T,
columns=keys,
index=irrad_data.index
)
Expand Down
Loading