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@chriswmackey verified. Calculating Kt' is handled differently in PVLib Matlab
@chriswmackey thanks very much for bringing this to our attention!
This bug affects the first and last values in a time series of DNI calculated by irradiance.dirint. The error is not "small", e.g., with GHI = 1038 W/m2 and zenith = 10.6 degrees, the incorrect value of DNI was 888, after correction DHI is 868.
thanks @chriswmackey for the report and @cwhanse for the fix.
Thank you @cwhanse for the fix! It's a great library that you have built here.
Most helpful comment
This bug affects the first and last values in a time series of DNI calculated by
irradiance.dirint. The error is not "small", e.g., with GHI = 1038 W/m2 and zenith = 10.6 degrees, the incorrect value of DNI was 888, after correction DHI is 868.