Skip to content

Commit 9f756bf

Browse files
committed
return same object type that was input
1 parent f3041c2 commit 9f756bf

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

pvlib/pvsystem.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,18 +2963,27 @@ def pvwatts_dc(effective_irradiance, temp_cell, pdc0, gamma_pdc, temp_ref=25.,
29632963

29642964
# apply Marion's correction if k is anything but zero
29652965
if k is not None:
2966+
pdc_marion = pdc
29662967
err_1 = k * (1 - (1 - effective_irradiance / 200)**4)
29672968
err_2 = k * (1000 - effective_irradiance) / (1000 - 200)
29682969

2969-
pdc_marion = np.where(effective_irradiance <= 200,
2970-
pdc - (pdc0 * err_1),
2971-
pdc - (pdc0 * err_2))
2970+
if hasattr(effective_irradiance, '__len__'):
2971+
pdc_marion[effective_irradiance <= 200] = pdc - (pdc0 * err_1)
2972+
pdc_marion[effective_irradiance > 200] = pdc - (pdc0 * err_2)
2973+
else:
2974+
if effective_irradiance <= 200:
2975+
pdc_marion = pdc - (pdc0 * err_1)
2976+
elif effective_irradiance > 200:
2977+
pdc_marion = pdc - (pdc0 * err_2)
2978+
29722979

29732980
# "cap" Marion's correction at 1000 W/m^2
29742981
if cap_adjustment:
2975-
pdc_marion = np.where(effective_irradiance >= 1000,
2976-
pdc,
2977-
pdc_marion)
2982+
if hasattr(effective_irradiance, '__len__'):
2983+
pdc_marion[effective_irradiance >= 1000] = pdc
2984+
else:
2985+
if effective_irradiance >= 1000:
2986+
pdc_marion = pdc
29782987

29792988
# large k values can result in negative power at low irradiance, so
29802989
# set negative power to zero

0 commit comments

Comments
 (0)