Skip to content

Commit b4cc5f3

Browse files
cbcrespoAdamRJensencwhanse
authored
Remove empty horizon component from irradiance.haydavies (#2788)
* Remove empty horizon brightening component from haydavies * Change OrderedDict to Dict * Apply suggestion from @AdamRJensen * 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> * Change Dict to dict * Update docs/sphinx/source/whatsnew/v0.16.0.rst Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * Apply suggestion from @cwhanse Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> * Apply suggestion from @cwhanse Co-authored-by: Cliff Hansen <cwhanse@sandia.gov> --------- Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com> Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
1 parent df60945 commit b4cc5f3

3 files changed

Lines changed: 57 additions & 16 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.. _whatsnew_0_16_0:
2+
3+
4+
v0.16.0
5+
-----------------------
6+
7+
Breaking Changes
8+
~~~~~~~~~~~~~~~~
9+
* Remove empty ``poa_horizon`` key from the ``diffuse_components`` output of
10+
:py:func:`pvlib.irradiance.haydavies`.
11+
(:pull:`2788`)
12+
13+
14+
Deprecations
15+
~~~~~~~~~~~~
16+
17+
18+
Bug fixes
19+
~~~~~~~~~
20+
21+
22+
Enhancements
23+
~~~~~~~~~~~~
24+
25+
26+
Documentation
27+
~~~~~~~~~~~~~
28+
29+
30+
Testing
31+
~~~~~~~
32+
33+
34+
Benchmarking
35+
~~~~~~~~~~~~
36+
37+
38+
Requirements
39+
~~~~~~~~~~~~
40+
41+
42+
Maintenance
43+
~~~~~~~~~~~
44+
45+
46+
Contributors
47+
~~~~~~~~~~~~
48+

pvlib/irradiance.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
787787
788788
Returns
789789
--------
790-
numeric, OrderedDict, or DataFrame
790+
numeric, dict, or DataFrame
791791
Return type controlled by ``return_components`` argument.
792792
If `False`, ``sky_diffuse`` is returned.
793793
If `True`, ``diffuse_components`` is returned.
@@ -796,13 +796,11 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
796796
The sky diffuse component of the solar radiation on a tilted
797797
surface. [Wm⁻²]
798798
799-
diffuse_components : OrderedDict (array input) or DataFrame (Series input)
799+
diffuse_components : dict (array input) or DataFrame (Series input)
800800
Keys/columns are:
801801
* poa_sky_diffuse: Total sky diffuse
802802
* poa_isotropic
803803
* poa_circumsolar
804-
* poa_horizon (always zero, not accounted for by the
805-
Hay-Davies model)
806804
807805
Notes
808806
------
@@ -860,14 +858,11 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
860858
sky_diffuse = poa_isotropic + poa_circumsolar
861859

862860
if return_components:
863-
diffuse_components = OrderedDict()
864-
diffuse_components['poa_sky_diffuse'] = sky_diffuse
865-
866-
# Calculate the individual components
867-
diffuse_components['poa_isotropic'] = poa_isotropic
868-
diffuse_components['poa_circumsolar'] = poa_circumsolar
869-
diffuse_components['poa_horizon'] = np.where(
870-
np.isnan(diffuse_components['poa_isotropic']), np.nan, 0.)
861+
diffuse_components = {
862+
'poa_sky_diffuse': sky_diffuse,
863+
'poa_isotropic': poa_isotropic,
864+
'poa_circumsolar': poa_circumsolar
865+
}
871866

872867
if isinstance(sky_diffuse, pd.Series):
873868
diffuse_components = pd.DataFrame(diffuse_components)

tests/test_irradiance.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,11 @@ def test_haydavies(irrad_data, ephem_data, dni_et):
209209

210210

211211
def test_haydavies_components(irrad_data, ephem_data, dni_et):
212-
keys = ['poa_sky_diffuse', 'poa_isotropic', 'poa_circumsolar',
213-
'poa_horizon']
212+
keys = ['poa_sky_diffuse', 'poa_isotropic', 'poa_circumsolar']
214213
expected = pd.DataFrame(np.array(
215214
[[0, 27.1775, 102.9949, 33.1909],
216215
[0, 27.1775, 30.1818, 27.9837],
217-
[0, 0, 72.8130, 5.2071],
218-
[0, 0, 0, 0]]).T,
216+
[0, 0, 72.8130, 5.2071]]).T,
219217
columns=keys,
220218
index=irrad_data.index
221219
)

0 commit comments

Comments
 (0)