Skip to content

Commit c7b4589

Browse files
committed
clip AOI to max of 90 degrees as discussed in review
1 parent 3015b3a commit c7b4589

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

pvlib/spectrum/mismatch.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,16 @@ def spectral_factor_polo(precipitable_water, airmass_absolute, aod500, aoi,
748748
effective irradiance, i.e., the irradiance that is converted to
749749
electrical current.
750750
751+
Notes
752+
-----
753+
The Polo model was developed using only SMM values computed for scenarios
754+
when the sun is visible from the module's surface (i.e., for ``aoi<90``),
755+
and no provision was made in [1]_ for the case of ``aoi>90``. This would
756+
create issues in the air mass calculation internal to the model.
757+
Following discussion with the model's author, the pvlib implementation
758+
handles ``aoi>90`` by truncating the input ``aoi`` to a maximum of
759+
90 degrees.
760+
751761
References
752762
----------
753763
.. [1] J. Polo and C. Sanz-Saiz, 'Development of spectral mismatch models
@@ -759,9 +769,8 @@ def spectral_factor_polo(precipitable_water, airmass_absolute, aod500, aoi,
759769
if module_type is not None and coefficients is not None:
760770
raise ValueError('Only one of `module_type` and `coefficients` should '
761771
'be provided')
762-
# prevent nan for aoi greater than 90
763-
if aoi > 90:
764-
aoi = 90
772+
# prevent nan for aoi greater than 90; see docstring Notes
773+
aoi = np.clip(aoi, a_min=None, a_max=90)
765774
f_aoi_rel = pvlib.atmosphere.get_relative_airmass(aoi,
766775
model='kastenyoung1989')
767776
f_aoi = pvlib.atmosphere.get_absolute_airmass(f_aoi_rel, pressure)

tests/spectrum/test_mismatch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,5 +371,7 @@ def test_spectral_factor_polo_NaN(polo_inputs):
371371

372372
def test_spectral_factor_polo_aoi_gt_90(polo_inputs):
373373
polo_inputs['aoi'] = 95
374-
out = spectrum.spectral_factor_polo(**polo_inputs, module_type='monosi')
375-
assert np.isnan(out)
374+
out95 = spectrum.spectral_factor_polo(**polo_inputs, module_type='monosi')
375+
polo_inputs['aoi'] = 90
376+
out90 = spectrum.spectral_factor_polo(**polo_inputs, module_type='monosi')
377+
assert out95 == out90

0 commit comments

Comments
 (0)