-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should spectrum.average_photon_energy
document and test how nan
is handled?
#2423
Comments
pvlib.spectrum.average_photon_energy
document and/or test how np.nan
is handled?spectrum.average_photon_energy
document and test how nan
is handled?
spectrum.average_photon_energy
document and test how nan
is handled?spectrum.average_photon_energy
document and test how nan
is handled?
I very much agree with your assessment! Document and test! |
I agree with document behavior and confirm with testing, but in this case the |
@cwhanse are you suggesting adding a Past discussion/context: I'm reminded of #2300, it was concluded the user could/should easily handle the question of wavelength range outside of the function. |
@RDaxini I was thinking of something like But I'm also OK if the function expects the user to handle NaNs upstream in their code. |
I was wondering about the same thing... I'll open a PR soon with updated docs and tests, and the expectation that the user handles |
+1 for simplicity There would be many things to take into account otherwise: interpolation kind, check that certain conditions met some criteria for the exceptions... As someone recently said in his own issue, shit in -> shit out. |
Is your feature request related to a problem? Please describe.
pvlib.spectrum.average_photon_energy
docs indicatenp.nan
is returned for all-zero inputHow
nan
values are handled when supplied as an input is neither documented nor tested.Three examples:
In the case >= 1
nan
value, ape=nan.I was just handling a large spectral irradiance dataset and it took me a minute to realise that the reason for the resultant APE values being far fewer than the input spectral distributions was that there were occasional
nan
values dotted around for individual wavelengths at certain times throughout the year.Describe the solution you'd like
Should the docs explain this behaviour and should the tests cover this? Is the current behaviour correct?
All-nan irradiance implies non-existence (different from zero) so it seems to make sense to return a
nan
value. In the case ofnan
at a single or even a few wavelengths seems more like a data quality issue. I lean towards leaving the behaviour as is, but documenting it. If documented, the user can then decide how to handle the nan-value cases, e.g. using a filling method. Seems out of scope for the function to offer this functionality. If documented, I think tests are required(?)The text was updated successfully, but these errors were encountered: