Repository navigation
Done
Description
These come from a review of development at 1109f11, made for PredictiveEcology/LandR#302 and LandWeb.
R CMD check --as-cran is clean: 0 errors, 0 warnings, and 2 NOTEs (CRAN's new-submission note, and the prepInputsFireYear() example's NFDB download). The tests pass: 43 tests, with one interactive-only test skipped. Each moved function was compared with LandR c537fb3, and results are the same for the documented uses. The problems found:
prepInputsFireYear(): a non-numericfireFieldgives a map that is entirely NA. standAge.R#L382-L385 coerces it withas.numeric(as.factor(yr)), which gives factor codes 1 to k, not years. TheearliestYearfilter at L390 then sets every cell to NA, and the only sign is the warning. The LandR version stopped with an error.as.numeric(as.character(yr))would do what the warning says. No test covers this.replaceAgeInFires()ignored astartTimeafter 2023. Fixed in replaceAgeInFires(): use a startTime after 2023 #3.scanfiUrlRemap()was copied, not moved. At Stand age and disturbance-year functions move to forestInputs (re-exported, identical results) LandR#302, LandR keeps and exports its own copy, with its own manifest and its own option,LandR.scanfiMirror. This package readsforestInputs.scanfiMirrorand falls back to the LandR option. That leaves two manifests to keep in sync until LandR's other SCANFI readers move here.- The
prepInputsFireYear()example needs withr, which is only in Suggests. standAge.R#L335-L361: the@examplesIfcondition only tests for CI, so the example fails where withr is not installed. AddingrequireNamespace("withr", quietly = TRUE)to the condition fixes that. The example also downloads all of NFDB, which took 81 s inR CMD check. replaceAgeInFires()documentsfirePerimetersas "the earliest fire date to allow" (standAge.R#L507). That text was copied from another parameter; the argument is the fire-year raster.- Suggests:
googledriveis used by a test (test-prepInputsStandAgeMap.R#L6) but not listed.httr2is listed, but nothing uses it.
- Leftover SCANFI v3 code. scanfi-access.R#L121-L133 holds a section header, an unused
.scanfiV3FTPURL, and a comment for a function that isn't there. - The
inputsTable()docs describe a fallback that doesn't exist. They say themirrorcolumn is "used whenurlcannot be reached" (inputs.R#L7), but nothing reads that column. The SCANFI mirror goes throughscanfiUrlRemap()'s own manifest.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
No labels
Activity
achubaty commentedon Dec 3, 2026
More from the same review. These are smaller than the points above, and none changes results for the documented uses.
options(forestInputs.scanfiMirror = FALSE)turns the SCANFI mirror off for stand age only.LandR.scanfiMirror(LandR scanfiMirror.R#L44), and keep using the mirror.options(LandR.scanfiMirror = FALSE)turns it off for both, because forestInputs falls back to that option (scanfiMirror.R#L67-L69).scanfiUrlRemap()instead of keeping its own copy.prepInputsFireYear()changes have no test:rasterToMatch, now converted to a SpatRaster, which is also what the function returns;rasterToMatch, now reprojected whenterra::same.crs()is false (standAge.R#L366-L380).The LandR version stopped with an error on a RasterLayer grid whenever there were fires, so that path has not run in a release before.
prepInputsDisturbanceYear(polygon = ...)now stops with an error. The newpolygonsBeforeargument shares thepolygonprefix withpolygonAgreement, whichpolygon =used to match. Partial matching is fragile anyway, but a NEWS line would tell anyone who relied on it.Cache()key includes the function's code.prepInputsFireYear()'s code changed in the move, so a cached call, including the one insideprepInputsStandAgeMap(), runs again the first time after upgrading. A NEWS line would tell users with caching on to expect it.inputsTable()metadata contradicts itself. The SCANFI age rows giveaccess = public, but their notes say "Google Drive folder shared with collaborators" (inputs.csv#L12-L21). The public copies are themirrorURLs, which only the v2 rows have.🤖 Generated with Claude Code