Skip to content

Predict from spread-link rows "powerLawSmooth" and "richards" - #39

Merged
eliotmcintire merged 2 commits into
developmentfrom
feat/smooth-spread-links
Nov 13, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
feat/smooth-spread-links

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

Spread probability had no minimum after the switch to the power-law link, so escaped fires stopped early in low-spread years. Two new smooth links with a set minimum fix that; this lets the spread prediction read a fit made with either of them. Fits made with the existing link predict exactly as before.

Affects: predictions from ledger rows of the two new links; every other row predicts as it did.

Depends-on: PredictiveEcology/fireSenseUtils#229
Depends-on: PredictiveEcology/SpaDES.tools#157

Technical details

Defect: prediction knew one linear-predictor link. spreadProbOneELF() called spreadProbFromCovs(link = if (!is.null(powerLawGamma)) "powerLaw") (fireSense_spreadPredict.R:429 on development) and ledgerPowerLawGamma() (:521) accepted only "powerLaw"; powerLawParsOf() (:469) returned pc, gamma, floor, shape only.

Fix:

  • ledgerLinkArgs() reads the row's link and, for the links that have them, powerLawGamma_spread, powerLawShape_spread, lowerAsymptote_spread, richardsNu_spread (a missing or invalid value stops). "richards" has no gamma. Both the one-ELF and the several-ELF paths use it, and spreadProbOneELF() passes the link on to fireSenseUtils::spreadProbFromCovs().
  • New output fireSense_SpreadLink. fireSense_SpreadPowerLaw and fireSense_SpreadLinear are given for all three links; the parameter names are fireSenseUtils::spreadLinkParNames of the link (powerLaw: pc, gamma, floor, shape; powerLawSmooth adds lower; richards: pc, lower, nu, B). Several fitted ELFs with different linear-predictor links cannot be blended, an error.
  • Does not change reqdPkgs floors.

Tests (tests/testthat/test-smoothLinks.R, new): a row of each link predicts the hand-computed link values for L = 0, 0.05, 0.13 and nu = 0, 0.5, 2; "richards" row without a gamma column works (no calibration anywhere in this module); L = 0.13 keeps a very low-x pixel at 0.13; invalid or missing columns stop; the multi-ELF blend and the different-link error; test-metadata.R lists the new output.

Full suite (module converted with convertToPackage(buildDocuments = TRUE), test_local()): branch 302 pass, 0 fail, 0 skipped; development 251 pass, 0 fail, 0 skipped. Needs the two package PRs installed (scratch library). Not run on the fireSenseUtils/SpaDES.tools development alone, where the new links do not exist.

Reuses: fireSenseUtils::spreadProbFromCovs(), linearLinkPars(), spreadLinkParNames, spreadAsymptoteLinks, the existing ledgerPowerLawGamma() / ledgerPowerLawShape() pattern, and powerLawParsOf() (generalized in place); new: ledgerSpreadLink(), ledgerLinkNumber(), ledgerLowerAsymptote(), ledgerRichardsNu(), ledgerLinkArgs() (no reader of these ledger columns exists; ledgerLinkNumber() is the one validator for the two numbers).

🤖 Generated with Claude Code

https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6

The row's link, lowerAsymptote_spread and richardsNu_spread are read and applied with
fireSenseUtils::spreadProbFromCovs(). New output fireSense_SpreadLink names the link;
fireSense_SpreadPowerLaw and fireSense_SpreadLinear are given for all three
linear-predictor links, with the link's own parameter names.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
…ils::checkLinkParams()

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
@eliotmcintire
eliotmcintire merged commit 30501be into development Nov 13, 2026
9 checks passed
@eliotmcintire
eliotmcintire deleted the feat/smooth-spread-links branch November 13, 2026 23:20
eliotmcintire added a commit that referenced this pull request Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards compatible Existing code and results keep working unchanged enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant