Skip to content

Bug fix: calcZonalRegimePars(): treat NULL targetBurnRate / targetMaxFireSize … - #17

Open
AllenLarocque wants to merge 2 commits into
PredictiveEcology:developmentfrom
AllenLarocque:fix/calcZonalRegimePars-null-targets
Open

AllenLarocque wants to merge 2 commits into
PredictiveEcology:developmentfrom
AllenLarocque:fix/calcZonalRegimePars-null-targets

Conversation

@AllenLarocque

@AllenLarocque AllenLarocque commented Oct 24, 2026 •

Copy link
Copy Markdown

…as not set

Minor edge case bug fix.

Claude:
The bug. The line that checks "did the user set a target?" gets the empty case backwards. When the setting is left empty, it answers "yes, a target was set" and tries to use a target that doesn't exist:

  • Burn rate: the function stops with an error ("argument is of length zero").
  • Maximum fire size: worse, because it fails silently. The function finishes normally, but two columns are quietly missing from its results: the maximum fire size and the estimated maximum fire size.

--

The guards !is.na(x) || is.null(x) are TRUE for NULL, so with the argument defaults (NULL):

  • targetBurnRate = NULL gave "argument is of length zero";
  • targetMaxFireSize = NULL set emfs_ha and xMax to NULL, silently dropping them from the output.

NULL is now converted to NA. Results for NA or numeric targets (what the scfm modules pass) are unchanged; tests compare them with 2.0.9.9011.

Bump version to 2.0.9.9011.

@achubaty

Copy link
Copy Markdown
Contributor

Looks good to me, but I haven't tested yet.

Housekeeping:

  • The title says "Big fix" (Bug fix), and the description says version 2.0.9.9006 where the diff has 2.0.9.9011.
  • The NEWS entry could name 94d70c6, where the guards changed from | to ||. With ||, a NULL target counted as set, which turned an error into silently dropping xMax and emfs_ha.

@AllenLarocque AllenLarocque changed the title Big fix: calcZonalRegimePars(): treat NULL targetBurnRate / targetMaxFireSize … Bug fix: calcZonalRegimePars(): treat NULL targetBurnRate / targetMaxFireSize … Nov 2, 2026
@AllenLarocque

Copy link
Copy Markdown
Author

Thanks, Alex. Both housekeeping points are done:

  • Title fixed ("Bug fix"), and the description gives 2.0.9.9011, matching the diff.
  • NEWS now names 94d70c6 (91818ab): the guards' change from | to || turned a NULL target from an error into the silent drop of xMax and emfs_ha. Checked in R 4.5.3: if (!is.na(NULL) | is.null(NULL)) errors with "argument is of length zero", while if (!is.na(NULL) || is.null(NULL)) takes the branch.

No code changes since your review.


agent-allen-larocque and others added 2 commits November 5, 2026 13:57
…as not set

The guards `!is.na(x) || is.null(x)` are TRUE for NULL, so with the
argument defaults (NULL):
- targetBurnRate = NULL gave "argument is of length zero";
- targetMaxFireSize = NULL set emfs_ha and xMax to NULL, silently
  dropping them from the output.

NULL is now converted to NA. Results for NA or numeric targets (what the
scfm modules pass) are unchanged; tests compare them with 2.0.9.9005.

Bump version to 2.0.9.9006.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ze drop

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants