You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
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.
I think the previous modification works perfectly for a single day but doesn't take into account a vector with several days.
The original publication dissociates moments with values before (Kt'i-1) and after (Kt'i+1) the current value (Kt'i) equ 2 and values with only one of the 2 (e.g., beginning or end of day) eqn 3.
See error
I think in line 8 we have the expected result from the publication, line 7 is the result of the Python code: the error concerns the division by 2 of the 2 values in red (eqn 3).
I think I agree that this is an error in pvlib's implementation.
For fixing the error, instead of verbose logic to keep track of missing values, I think we can use pandas to determine whether there are zero, one, or two valid values and perform the appropriate calculation:
Hi,
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.
I think the previous modification works perfectly for a single day but doesn't take into account a vector with several days.
The original publication dissociates moments with values before (Kt'i-1) and after (Kt'i+1) the current value (Kt'i) equ 2 and values with only one of the 2 (e.g., beginning or end of day) eqn 3.
To Reproduce
See error
I think in line 8 we have the expected result from the publication, line 7 is the result of the Python code: the error concerns the division by 2 of the 2 values in red (eqn 3).
Proposition of modification :
kt_next = np.roll(kt_prime,-1) delta_kt_next = abs(kt_prime - kt_next)* np.logical_and(np.logical_not(np.isnan(kt_prime)), np.logical_not(np.isnan(kt_next))) delta_kt_previous = np.roll(delta_kt_next,1) delta_kt_prime = (delta_kt_next.add(delta_kt_previous, fill_value=0)*np.logical_xor(np.logical_not(np.isnan(delta_kt_next)), np.logical_not(np.isnan(delta_kt_previous)))).add(0.5*(delta_kt_next+delta_kt_previous)*np.logical_and(np.logical_not(np.isnan(delta_kt_next)), np.logical_not(np.isnan(delta_kt_previous))),fill_value=0)
Versions:
pvlib.__version__
: '0.10.1'The text was updated successfully, but these errors were encountered: