-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Artefact in Ineichen clearsky model for sun close to horizon #435
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
Comments
There is actually another version of the paper of Ineichen, which doesn't contain the typo nor the factor causing the artefact: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.535.4248&rep=rep1&type=pdf. |
Hi Karel! I saw this effect too but simply didn't have the time to investigate and report--so thank you for this! One hypothesis I had was that this might have worked ok for hourly averages. |
Thanks for the detailed report. This artifact and the discrepancies among the papers and code is part of what motivated me to add the simplified solis model to the library. |
And is an example of the original motivation for PVLib. We intended the open source libraries to expose and hopefully resolve this kind of ambiguity in models. @kdebrab do you see a resolution among the various papers? When I can find time I'll pull the Solar Energy papers and see what we can determine on our end. One of us should write Pierre and see if he can enlighten us. |
Pierre will retire in May, so don't wait too long to ask! |
Gasp! |
I checked with Pierre Ineichen, and he explained that Richard Perez added the exponential term in the later paper based on further analysis of measurements at 10 continental US sites. I guess no one checked the effect on locations outside this geographic area. I would suggest that function be modified to accept a flag to indicate whether the Perez enhancement is to be used or not, with a default value of False. |
Thanks for checking. I support your proposed solution. I'm not going to get to it anytime soon, though, and would welcome a pull request. |
I concur with @adriesse proposal. I would add a comment to the function signature warning that the Perez enhancement may produce biased results at high latitude, and link the False/True condition for the flag to the appropriate reference. |
One way to remove the artifacts while introducing less bias is to clip the
This threshold starts at AM = 2.6 (for turbidity = 1 and altitude = 0), equivalent to ~22.5° solar elevation, and goes up to O(10) for higher turbidities and altitudes. For most cases, it corresponds to solar elevation angles below the 4° cutting threshold of the CIE 1994 quality control guidelines that Ineichen & Perez seem to have used, i.e. they probably didn't see beyond it. Clipping at the minimum makes the adjustment smooth (C1), and leaves the results of the model untouched for most operating conditions. |
@martinherrerias your proposal makes a lot of sense to me, now that I better understand the the role that correction plays. Rather than continuing in this old issue, would you like to open a new issue? If you are also inclined a pull request is welcome. |
I would suggest controlling this new feature by the same flag or a new one. It should be possible to run the model as published. This reminds me of some discussions about using models outside of the range of inputs for which they were developed and/or validated. |
Are there any references for this new feature? @martinherrerias any plans to present or publish this idea? I think that would be useful. Thanks! |
Consider following example:
which results in following figure:

The (default) 'ineichen' clearsky model seems erratic at sunrise and sunset. The effect is especially visible for high latitudes during Winter when the sun slowly approaches the horizon.
Upon closer look in the code, I found the following comment:
pvlib-python/pvlib/clearsky.py
Lines 98 to 103 in 04bd753
which refers to the formula:
pvlib-python/pvlib/clearsky.py
Lines 122 to 126 in 04bd753
However, apart from the typo mentioned, there is another important difference between both formula of Solar Energy 73, and that's the
np.exp(0.01*airmass_absolute**1.8)
factor, which is only present in the formula of pg 311, but not in the formula of pg 156!It seems like the artefact is exactly a result of that
np.exp(0.01*airmass_absolute**1.8)
factor. This factor slowly increases from 1.01 at solar zenith to 1.95 at a zenith angle of 85°, but then shoots to 1000 when the sun reaches the horizon.So, maybe there was an error also in the formula of Solar Energy 73, pg 311, and that factor wasn't supposed to be there?
Nevertheless, in reference [3] (Reno et al., 2012), this model was found to excel for US sites with the same formula as used by pvlib. The US sites were all below the 49th parallel. I wonder whether this model is still recommendable for higher latitudes?
The text was updated successfully, but these errors were encountered: