There were two main errors:
1) The code always returned CF_csp. I could not fully understand why.
Instead of writing...
aux = np.zeros(len(reg_ind[0]))
aux[filter] = CF_pv
CF_pv = aux
aux[filter] = CF_csp
CF_csp = aux
I added a new line that seemed redundant to me and it worked (= returned CF_pv).
aux = np.zeros(len(reg_ind[0]))
aux[filter] = CF_pv
CF_pv = aux
aux = np.zeros(len(reg_ind[0]))
aux[filter] = CF_csp
CF_csp = aux
I suspect that before, all the names CF_pv, aux and CF_csp used to point to the same thing in the memory.
The filter is incorrect. I turned it off and it works now. I think I filtered the afternoon hours out, which I should not do. This needs to be fixed. Without filtering, the code works but is slow.
There were two main errors: 1) The code always returned CF_csp. I could not fully understand why. Instead of writing...
I added a new line that seemed redundant to me and it worked (= returned CF_pv).
I suspect that before, all the names CF_pv, aux and CF_csp used to point to the same thing in the memory.