Repository navigation
Clip kt_prime in DIRINT coefficient lookup so gti_dirint no longer returns NaN for kt_prime > 1 - #2936
Open
DresdenGman wants to merge 2 commits into
Open
Clip kt_prime in DIRINT coefficient lookup so gti_dirint no longer returns NaN for kt_prime > 1#2936DresdenGman wants to merge 2 commits into
DresdenGman wants to merge 2 commits into
Conversation
The DIRINT coefficient table only covers kt_prime up to 1, so gti_dirint returned NaN DNI/DHI whenever the iteration produced kt_prime above 1, including at AOI >= 90 timestamps. Clip the value at the entrance of _dirint_coeffs, as agreed in the issue discussion, so out-of-range values use the boundary coefficients instead. The kt_prime series itself is left unchanged everywhere else, and dirint is unaffected because it already limits kt_prime to 1.
- whats-new: only claim the NaN cause this fix removes (kt_prime exceeding the DIRINT coefficient table) - test_dirint_coeffs_kt_prime_gt_one: compare against a manually capped reference lookup, and cover non-sentinel w/delta_kt_prime - test_gti_dirint_kt_prime_gt_one: spy on _dirint_coeffs to prove kt_prime > 1 is exercised, and assert the full expected frame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1815.
As agreed in #1815, this clips the kt′ value used for the DIRINT coefficient lookup to the coefficient table boundary (1.0), inside
_dirint_coeffsso that all callers are covered. Previously, kt′ > 1 found no bin in the coefficient table and produced NaN coefficients, and therefore NaN irradiances fromgti_dirint, cascading into the AOI ≥ 90 estimates as well — in the reported configuration, 4 NaN values at 2× poa_global and 7 at 4×, including an entire AOI ≥ 90 row. Only the lookup value is clipped: kt′ itself and delta_kt_prime remain unchanged everywhere else, and results for kt′ ≤ 1 are identical to before.Tests: two regression tests in
tests/test_irradiance.py(module result: 131 passed / 10 skipped). The coefficients for kt′ = 1.2 and 2.0 now equal the kt′ = 1.0 boundary coefficients exactly, and the end-to-endgti_dirintcase that previously returned NaNs now returns finite values throughout — the test also asserts that the coefficient lookup received kt′ up to ≈1.54, so the case cannot silently stop exercising this path.docs/sphinx/source/referencefor API changes.docs/sphinx/source/whatsnewfor 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`).remote-data) and Milestone are assigned to the Pull Request and linked Issue.