Skip to content

Commit dd30069

Browse files
committed
polite handling of nan in irradiance.perez
1 parent 7057afc commit dd30069

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pvlib/irradiance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,17 +1147,17 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
11471147
F2c = np.vstack((F2c, nans))
11481148

11491149
F1 = (F1c[ebin, 0] + F1c[ebin, 1] * delta + F1c[ebin, 2] * z)
1150-
F1 = np.maximum(F1, 0)
1150+
F1 = np.where(np.isnan(F1), np.nan, np.maximum(F1, 0))
11511151

11521152
F2 = (F2c[ebin, 0] + F2c[ebin, 1] * delta + F2c[ebin, 2] * z)
1153-
F2 = np.maximum(F2, 0)
1153+
F2 = np.where(np.isnan(F2), np.nan, np.maximum(F2, 0))
11541154

11551155
A = aoi_projection(surface_tilt, surface_azimuth,
11561156
solar_zenith, solar_azimuth)
11571157
A = np.maximum(A, 0)
11581158

11591159
B = tools.cosd(solar_zenith)
1160-
B = np.maximum(B, tools.cosd(85))
1160+
B = np.where(np.isnan(B), np.nan, np.maximum(B, tools.cosd(85)))
11611161

11621162
# Calculate Diffuse POA from sky dome
11631163
term1 = 0.5 * (1 - F1) * (1 + tools.cosd(surface_tilt))

0 commit comments

Comments
 (0)