Avoid kc becomes zero when NDVI == 1.1 * NDVI_min - #324
Open
LINAMARIAOSORIO wants to merge 8 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix_319 #324 +/- ##
===========================================
- Coverage 92.47% 92.47% -0.01%
===========================================
Files 60 60
Lines 3908 3906 -2
Branches 487 487
===========================================
- Hits 3614 3612 -2
Misses 238 238
Partials 56 56 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4 tasks
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.
Checklist
Description
In
dynamic()the crop coefficient used two strict masks (NDVI < 1.1 * NDVI_minandNDVI > 1.1 * NDVI_min), so a cell whose NDVI equals1.1 * NDVI_mingotkc = 0and no vegetated-area evapotranspiration. The branch follows the documented rule withpcr.ifthenelse(current_ndvi <= 1.1 * self.ndvi_min, min_crop_coef, partial_crop_coef):kc = kc_minwheneverNDVI <= 1.1 * NDVI_min.Follow-up commits on top of the fix:
tests/unit/core/test_dynamic_model.py: three synthetic runs with the first-step NDVI exactly on the threshold, atNDVI_minand above it; the first-stepetaof the threshold run must equal theNDVI_minrun and differ from the interpolated run (fails onmain, where the threshold run haseta = 0).fix_319and a changelog entry under Unreleased › Fixed.Stacked on #323 (base branch
fix_319): the diff of this pull request isrubem/_dynamic_model.py, the test and the changelog line.Related Issue
kcbecomes zero whenNDVI == 1.1 * NDVI_min#320Motivation and context
doc/source/overview.rst(equationkc) and the supplementary document (equation SE11) statekc = kc_minifNDVI <= 1.1 * NDVI_min; the equality case was left without a branch. The regression dataset does not contain the equality (theexactjob reports byte-identical outputs with and without this change), so the behaviour is covered by the new test.How has this been tested
pytest --ignore=tests/integration/doc): 998 passed, 1 skipped.test_ndvi_at_the_crop_coefficient_threshold_takes_the_minimum_branchfails withrubem/_dynamic_model.pyfrommainand passes here. The threshold value is PCRaster's own float32 product of1.1and thendvi_minraster, so the model's comparison sees exact equality.ci-successgreen.Screenshots