Skip to content

Commit 4a9b1b0

Browse files
Issue pvlib#1064: use (clipped) Perez enhancement factor by default in clearsky.ineichen, allowing explicit enable/disable of original correction
1 parent 04a523f commit 4a9b1b0

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

pvlib/clearsky.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
def ineichen(apparent_zenith, airmass_absolute, linke_turbidity,
17-
altitude=0, dni_extra=1364., perez_enhancement=False):
17+
altitude=0, dni_extra=1364., perez_enhancement=None):
1818
'''
1919
Determine clear sky GHI, DNI, and DHI from Ineichen/Perez model.
2020
@@ -104,11 +104,18 @@ def ineichen(apparent_zenith, airmass_absolute, linke_turbidity,
104104
cg1 = 5.09e-05 * altitude + 0.868
105105
cg2 = 3.92e-05 * altitude + 0.0387
106106

107-
ghi = np.exp(-cg2*airmass_absolute*(fh1 + fh2*(tl - 1)))
108-
109107
# https://github.com/pvlib/pvlib-python/issues/435
110-
if perez_enhancement:
111-
ghi *= np.exp(0.01*airmass_absolute**1.8)
108+
# https://github.com/pvlib/pvlib-python/issues/1064
109+
if perez_enhancement == True or perez_enhancement == 1:
110+
ghi = np.exp(-cg2*airmass_absolute*(fh1 + fh2*(tl - 1)) +
111+
0.01*airmass_absolute**1.8)
112+
elif perez_enhancement == False or perez_enhancement == 0:
113+
ghi = np.exp(-cg2*airmass_absolute*(fh1 + fh2*(tl - 1)))
114+
else:
115+
airmass_critical = (cg2*(fh1+fh2*(tl-1))/0.018)**1.25
116+
airmass_clipped = np.fmin(airmass_absolute, airmass_critical)
117+
ghi = np.exp(-cg2*airmass_clipped*(fh1 + fh2*(tl - 1)) +
118+
0.01*airmass_clipped**1.8)
112119

113120
# use fmax to map airmass nans to 0s. multiply and divide by tl to
114121
# reinsert tl nans

0 commit comments

Comments
 (0)