Commit 442329b
committed
Fix delta_kt_prime calculation for series with internal NaN values
The previous implementation of _delta_kt_prime_dirint only handled NaN
at the very first and last positions of the series. For multi-day data
with nighttime NaN gaps, the edge positions adjacent to internal NaN
boundaries had their delta values incorrectly halved (the 0.5 factor
was applied even when only one neighbor was valid).
Replace the manual NaN-filling approach with pd.DataFrame.mean(axis=1),
which naturally skips NaN values. This correctly implements both Perez
eqn 2 (average of both deltas when two neighbors exist) and eqn 3
(single delta when only one neighbor exists).
Fixes #18471 parent 010cff7 commit 442329b
File tree
3 files changed
+45
-8
lines changed- docs/sphinx/source/whatsnew
- pvlib
- tests
3 files changed
+45
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2026 | 2026 | | |
2027 | 2027 | | |
2028 | 2028 | | |
2029 | | - | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
2030 | 2032 | | |
2031 | 2033 | | |
2032 | | - | |
2033 | | - | |
2034 | | - | |
2035 | | - | |
2036 | | - | |
2037 | | - | |
2038 | | - | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
2039 | 2038 | | |
2040 | 2039 | | |
2041 | 2040 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
746 | 778 | | |
747 | 779 | | |
748 | 780 | | |
| |||
0 commit comments