Closed
Description
Describe the bug
0.9.4
introduced the following changes in the _golden_sect_DataFrame
: We are checking upper
and lower
parameters and raise an error if lower > upper
.
Lines 344 to 345 in 81598e4
_golden_sect_DataFrame
is used by _lambertw
:
pvlib-python/pvlib/singlediode.py
Lines 644 to 649 in 81598e4
I often have slightly negative v_oc
values (really close to 0) when running simulations (second number in the array below):
array([ 9.46949758e-16, -8.43546518e-15, 2.61042547e-15, 3.82769773e-15,
1.01292315e-15, 4.81308106e+01, 5.12484772e+01, 5.22675087e+01,
5.20708941e+01, 5.16481028e+01, 5.12364071e+01, 5.09209060e+01,
5.09076598e+01, 5.10187680e+01, 5.11328118e+01, 5.13997628e+01,
5.15121386e+01, 5.05621451e+01, 4.80488068e+01, 7.18224446e-15,
1.21386700e-14, 6.40136698e-16, 4.36081007e-16, 6.51236255e-15])
If we have one negative number in a large timeseries, the simulation will crash which seems too strict.
Expected behavior
That would be great to either:
- Have this data check be less strict and allow for slightly negative numbers, which are not going to affect the quality of the results.
- On
_lambertw
: Do not allow negativev_oc
and set negative values tonp.nan
, so that the error is not triggered. It will be up to the upstream code (user) to manage thosenp.nan
.
Versions:
pvlib.__version__
: >= 0.9.4pandas.__version__
: 1.5.3- python: 3.10.11