Skip to content

fix(dvmdostem): fix misplaced paren in enforce.runmask.cmt.vegmap.harmony - #4296

Draft
madhavzanwar wants to merge 1 commit into
PecanProject:developfrom
madhavzanwar:GH-4294-dvmdostem-single-pixel-runmask
Draft

madhavzanwar wants to merge 1 commit into
PecanProject:developfrom
madhavzanwar:GH-4294-dvmdostem-single-pixel-runmask

Conversation

@madhavzanwar

Copy link
Copy Markdown
Contributor

Description

In models/dvmdostem/R/write.config.dvmdostem.R, enforce.runmask.cmt.vegmap.harmony() checked if (length(enabled_px != 2)), placing != 2 inside length(). When exactly one pixel was enabled in the run mask (the expected single-pixel run mask case, where enabled_px has length 2: row and column coordinates), length(enabled_px != 2) evaluated to 2 (truthy in R), unconditionally erroring with "THERE MUST BE A SINGLE PIXEL ENABLED IN THE RUN MASK FILE!" and calling stop().

Changed to length(enabled_px) != 2, added comprehensive test coverage in models/dvmdostem/tests/testthat/test-enforce_runmask_harmony.R, and updated models/dvmdostem/NEWS.md and CHANGELOG.md.

Fixes #4294

Verification

  • Before fix (develop): devtools::test("/work/models/dvmdostem", filter = "enforce_runmask_harmony") failed on a valid single-pixel run mask with THERE MUST BE A SINGLE PIXEL ENABLED IN THE RUN MASK FILE! Instead found 2 pixels....
  • After fix (pecan/base:develop Docker): all models/dvmdostem tests passed ([ FAIL 0 | WARN 0 | SKIP 2 | PASS 2 ]).

…mony

Check length(enabled_px) != 2 instead of length(enabled_px != 2) so single-pixel run masks are accepted rather than triggering a false error.

Fixes PecanProject#4294
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enforce.runmask.cmt.vegmap.harmony() fails on valid single-pixel run mask due to misplaced parenthesis

1 participant