Skip to content

Commit 2ca40aa

Browse files
jason-rpktcwhanse
andauthored
Issue #2245 Infinite sheds beam fraction on ground zenith guardrail syntax bug (#2359)
* Issue #2245 Infinite sheds beam fraction on ground zenith guardrail syntax bug Set unshaded ground fraction to zero for solar_zenith> max_zenith * Issue #2245 - Linting/ PEP8 * Revert "Issue #2245 utils.py" This reverts commit 8b67a41. * Update from solar_zenith to ghi Update docs\sphinx\source\whatsnew\v0.11.3.rst * series input for ghi in test_infinite_sheds.py * Update docs/sphinx/source/whatsnew/v0.11.3.rst --------- Co-authored-by: Cliff Hansen <[email protected]>
1 parent 6440ada commit 2ca40aa

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Deprecations
1010

1111
Enhancements
1212
~~~~~~~~~~~~
13-
13+
* Fix a bug in :py:func:`pvlib.bifacial.get_irradiance_poa` which may have yielded non-zero
14+
ground irradiance when the sun was below the horizon. (:issue:`2245`, :pull:`2359`)
1415

1516
Documentation
1617
~~~~~~~~~~~~~
@@ -37,4 +38,5 @@ Contributors
3738
~~~~~~~~~~~~
3839
* Rajiv Daxini (:ghuser:`RDaxini`)
3940
* Mark Campanelli (:ghuser:`markcampanelli`)
41+
* Jason Lun Leung (:ghuser:`jason-rpkt`)
4042
* Manoj K S (:ghuser:`manojks1999`)

pvlib/bifacial/infinite_sheds.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,9 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
260260
Returns
261261
-------
262262
output : dict or DataFrame
263-
Output is a DataFrame when input ghi is a Series. See Notes for
264-
descriptions of content.
263+
Output is a ``pandas.DataFrame`` when ``ghi`` is a Series.
264+
Otherwise it is a dict of ``numpy.ndarray``
265+
See Notes for descriptions of content.
265266
266267
Notes
267268
-----
@@ -372,7 +373,7 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
372373
'poa_global': poa_global, 'poa_direct': poa_direct,
373374
'poa_diffuse': poa_diffuse, 'poa_ground_diffuse': poa_gnd_pv,
374375
'poa_sky_diffuse': poa_sky_pv, 'shaded_fraction': f_x}
375-
if isinstance(poa_global, pd.Series):
376+
if isinstance(ghi, pd.Series):
376377
output = pd.DataFrame(output)
377378
return output
378379

pvlib/bifacial/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def _unshaded_ground_fraction(surface_tilt, surface_azimuth, solar_zenith,
8787
surface_azimuth)
8888
f_gnd_beam = 1.0 - np.minimum(
8989
1.0, gcr * np.abs(cosd(surface_tilt) + sind(surface_tilt) * tan_phi))
90-
np.where(solar_zenith > max_zenith, 0., f_gnd_beam) # [1], Eq. 4
90+
# [1], Eq. 4
91+
f_gnd_beam = np.where(solar_zenith > max_zenith, 0., f_gnd_beam)
9192
return f_gnd_beam # 1 - min(1, abs()) < 1 always
9293

9394

pvlib/tests/bifacial/test_infinite_sheds.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def test_get_irradiance_poa():
130130
# series inputs
131131
surface_tilt = pd.Series(surface_tilt)
132132
surface_azimuth = pd.Series(data=surface_azimuth, index=surface_tilt.index)
133+
ghi = pd.Series(data=ghi, index=surface_tilt.index)
133134
solar_zenith = pd.Series(solar_zenith, index=surface_tilt.index)
134135
solar_azimuth = pd.Series(data=solar_azimuth, index=surface_tilt.index)
135136
expected_diffuse = pd.Series(

0 commit comments

Comments
 (0)