DC model unexpectedly fills NaNs with 0
I would like to report a behaviour in the dc models of pvlib, which was very unintuitive to me. Since it has been coded very explicitly though, I assume the behaviour has been considered.
I am on version 0.6.1 of pvlib, but the issue occurs on the current version, too. Using, for example the desoto dc model, NaNs are filled with 0 after calling scale_voltage_to_current_power. (v0.6.1 and current master). In my specific case, this means, that after having passed NaNs to the model chain in my weather dataframe, I receive valid numbers in the model chain result. I would have either expected the afflicted time steps to be NaN, a warning or an error.
Is this behaviour by the dc model - and as a result by the entire model chain - intended?
You raise a fair point. That has been the behavior since the original ModelChain.singlediode method in v0.4.0. I can't say exactly why; my guess is so that ModelChain.result.dc.sum() returns a valid value.
I agree that behavior is very bad and inconsistent with the general pvlib policy of "nan in, nan out". I don't remember, but if I had to guess, I may have added it as a very lazy way of handling missing nighttime values.
A pull request would be welcome.