Skip to content
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

Add extreme QCRAD QC limits #190

Merged
merged 16 commits into from
Oct 29, 2024
Merged

Conversation

AdamRJensen
Copy link
Member

@AdamRJensen AdamRJensen commented May 30, 2023

  • [ ] Closes #xxx
  • [ ] Added tests to cover all new or modified code.
  • Clearly documented all new API functions with PEP257 and numpydoc compliant docstrings.
  • [ ] Added new API functions to docs/api.rst.
  • [ ] Non-API functions clearly documented with docstrings or comments as necessary.
  • Adds description and name entries in the appropriate "what's new" file
    in docs/whatsnew
    for all changes. Includes link to the GitHub Issue with :issue:`num`
    or this Pull Request with :pull:`num`. Includes contributor name
    and/or GitHub username (link with :ghuser:`user`).
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels and Milestone are assigned to the Pull Request and linked Issue.

The QCRad software relies on the BSRN irradiance limits. Specifically, QCRad uses the "physical possible" BSRN limits for the upper limit but both the "physical possible" and the "extremely rare" BSRN limits for the lower limits. Currently, pvanalytics only support the "physical possible" limits.

However, the "extremely rare" limits are widely used, e.g., by Espinar et al. (2011), Geuder et al. (2015), Lorenz et al. (2022), and Forstinger et al. (2021).

In this PR I propose adding the "extremely rare" BSRN limits to the QCRad functions. Ideally, I think the functions should be named "_bsrn and not "*_qcrad" as QCRad states that it relies on the BSRN limits. At the current stage, the PR isn't breaking anything, but changing the function names would of course be a braking change.

@cwhanse
Copy link
Member

cwhanse commented May 30, 2023

I propose adding the "extremely rare" BSRN limits to the QCRad functions.

+1 to this. What do you think about extending the output to a tuple (boolean series, integer series) as is being done in #167?

Ideally, I think the functions should be named "_bsrn and not "*_qcrad" as QCRad states that it relies on the BSRN limits.

On reading that paper again, I agree. We can deprecate the existing functions and use _bsrn for functions that introduce the option to evaluate extremely rare value limits. We can address #191 in the new functions also.

@AdamRJensen
Copy link
Member Author

+1 to this. What do you think about extending the output to a tuple (boolean series, integer series) as is being done in #167?

I'm not sure I see the advantage of having two outputs?

On reading that paper again, I agree. We can deprecate the existing functions and use _bsrn for functions that introduce the option to evaluate extremely rare value limits. We can address #191 in the new functions also.

Yay! 😄

@AdamRJensen AdamRJensen changed the title Add extreme BSRN QC limits Add extreme QCRAD QC limits Oct 22, 2024
@AdamRJensen
Copy link
Member Author

AdamRJensen commented Oct 24, 2024

@cwhanse this year and a half old PR is ready for review

Copy link
Member

@cwhanse cwhanse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick look, can you resolve the conflicts?

pvanalytics/quality/irradiance.py Show resolved Hide resolved
pvanalytics/quality/irradiance.py Show resolved Hide resolved
docs/whatsnew/0.2.2.rst Show resolved Hide resolved
pvanalytics/quality/irradiance.py Show resolved Hide resolved
@@ -289,7 +314,7 @@ def check_irradiance_consistency_qcrad(solar_zenith, ghi, dhi, dni,
param=None, outside_domain=False):
r"""Check consistency of GHI, DHI and DNI using QCRad criteria.

Uses criteria given in [1]_ to validate the ratio of irradiance
Uses criteria given in [1]_, [2]_ to validate the ratio of irradiance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the consistency criteria the same in both papers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[1] only gives one set, but [2] gives both sets. So one might be inclined to only reference [2]. However, [2] is merely a two-page document whereas [1] is a journal article. I have been in correspondence with Christian Gueymard, who recommended referring to both sets of coefficients as QCRad tests as they were developed in this framework.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the consistency function, I don't see any point in referencing [2]. Seems like it doesn't offer anything extra over the journal article.

@cwhanse cwhanse added the enhancement New feature or request label Oct 28, 2024
@cwhanse cwhanse added this to the v0.2.2 milestone Oct 28, 2024
pvanalytics/quality/irradiance.py Outdated Show resolved Hide resolved
Co-authored-by: Cliff Hansen <[email protected]>
@AdamRJensen
Copy link
Member Author

@kandersolar ready for review!

pvanalytics/quality/irradiance.py Outdated Show resolved Hide resolved
pvanalytics/quality/irradiance.py Outdated Show resolved Hide resolved
pvanalytics/quality/irradiance.py Outdated Show resolved Hide resolved
pvanalytics/quality/irradiance.py Outdated Show resolved Hide resolved
@@ -289,7 +314,7 @@ def check_irradiance_consistency_qcrad(solar_zenith, ghi, dhi, dni,
param=None, outside_domain=False):
r"""Check consistency of GHI, DHI and DNI using QCRad criteria.

Uses criteria given in [1]_ to validate the ratio of irradiance
Uses criteria given in [1]_, [2]_ to validate the ratio of irradiance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the consistency function, I don't see any point in referencing [2]. Seems like it doesn't offer anything extra over the journal article.

pvanalytics/tests/quality/test_irradiance.py Show resolved Hide resolved
@kandersolar kandersolar merged commit 12f16d6 into pvlib:main Oct 29, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants