Skip to content

Commit

Permalink
Issue #2245 Infinite sheds beam fraction on ground zenith guardrail s…
Browse files Browse the repository at this point in the history
…yntax 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]>
  • Loading branch information
jason-rpkt and cwhanse authored Feb 4, 2025
1 parent 6440ada commit 2ca40aa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion docs/sphinx/source/whatsnew/v0.11.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Deprecations

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

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

Documentation
~~~~~~~~~~~~~
Expand All @@ -37,4 +38,5 @@ Contributors
~~~~~~~~~~~~
* Rajiv Daxini (:ghuser:`RDaxini`)
* Mark Campanelli (:ghuser:`markcampanelli`)
* Jason Lun Leung (:ghuser:`jason-rpkt`)
* Manoj K S (:ghuser:`manojks1999`)
7 changes: 4 additions & 3 deletions pvlib/bifacial/infinite_sheds.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,9 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
Returns
-------
output : dict or DataFrame
Output is a DataFrame when input ghi is a Series. See Notes for
descriptions of content.
Output is a ``pandas.DataFrame`` when ``ghi`` is a Series.
Otherwise it is a dict of ``numpy.ndarray``
See Notes for descriptions of content.
Notes
-----
Expand Down Expand Up @@ -372,7 +373,7 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
'poa_global': poa_global, 'poa_direct': poa_direct,
'poa_diffuse': poa_diffuse, 'poa_ground_diffuse': poa_gnd_pv,
'poa_sky_diffuse': poa_sky_pv, 'shaded_fraction': f_x}
if isinstance(poa_global, pd.Series):
if isinstance(ghi, pd.Series):
output = pd.DataFrame(output)
return output

Expand Down
3 changes: 2 additions & 1 deletion pvlib/bifacial/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def _unshaded_ground_fraction(surface_tilt, surface_azimuth, solar_zenith,
surface_azimuth)
f_gnd_beam = 1.0 - np.minimum(
1.0, gcr * np.abs(cosd(surface_tilt) + sind(surface_tilt) * tan_phi))
np.where(solar_zenith > max_zenith, 0., f_gnd_beam) # [1], Eq. 4
# [1], Eq. 4
f_gnd_beam = np.where(solar_zenith > max_zenith, 0., f_gnd_beam)
return f_gnd_beam # 1 - min(1, abs()) < 1 always


Expand Down
1 change: 1 addition & 0 deletions pvlib/tests/bifacial/test_infinite_sheds.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def test_get_irradiance_poa():
# series inputs
surface_tilt = pd.Series(surface_tilt)
surface_azimuth = pd.Series(data=surface_azimuth, index=surface_tilt.index)
ghi = pd.Series(data=ghi, index=surface_tilt.index)
solar_zenith = pd.Series(solar_zenith, index=surface_tilt.index)
solar_azimuth = pd.Series(data=solar_azimuth, index=surface_tilt.index)
expected_diffuse = pd.Series(
Expand Down

0 comments on commit 2ca40aa

Please sign in to comment.