Description
Hello,
I believe that I have found a bug or at least a misalignment between a formula that was written in a publication and the result of a pvlib method.
The bug appears specifically on these lines of the _delta_kt_prime_dirint() method in irradiance.py:
https://github.com/pvlib/pvlib-python/blob/master/pvlib/irradiance.py#L1566-L1568
... and I realize that this formula references Perez's equation 2 as follows:
Here is the full publication where the image above came from from:
https://www.researchgate.net/publication/279868352_Dynamic_global-to-direct_irradiance_conversion_models
The bug seems to be the result of how pandas deals with the add()
method and the fill_value
.
To re-create the bug, I recommend running the following code:
kt_prime = pd.Series([0.79, 0.77])
times = pd.DatetimeIndex(['2014-06-24T12-0700', '2014-06-24T18-0700'])
delta_kt_prime = pvlib.irradiance._delta_kt_prime_dirint(kt_prime, True, times)
At the moment, this returns a delta_kt_prime value that is equal to 0.01. However, this should clearly be equal to 0.02 according to Perez's equation 2.
Versions:
pvlib.__version__
: 0.6.0pandas.__version__
: 0.23.4- python: 3.7