Skip to content

prepInputs_SCANFI_LCC_FAO(): read forest-land land cover under the SCANFI remap - #277

Merged
achubaty merged 1 commit into
developmentfrom
fix/forestland-scanfi-remap
Oct 19, 2026
Merged

achubaty merged 1 commit into
developmentfrom
fix/forestland-scanfi-remap

Conversation

@achubaty

Copy link
Copy Markdown
Contributor

prepInputs_SCANFI_LCC_FAO() now reads the land cover of the forest-land years under LandR's SCANFI remap, like year's own land cover.

Defect. Since #274 the remap is applied per download, inside .withSCANFIAccess() and prepInputs_SCANFI_structure(), instead of globally when LandR loads. In prepInputs_SCANFI_LCC_FAO() only the read of year's land cover (R/maps.R:488-495) is wrapped. The forest-land years are read afterwards, by the lccFor() closure passed to .forestLandFor() (R/maps.R:531-539, called from R/forestLand.R:191-196 when forestLandFrom is "both", the default, or "lccYears"). Those reads ask Google Drive for the restricted SCANFI files directly. Before #274 the global remap covered them. For a 2020 year this means the land cover of 1985, 1995, 2005, 2015 and 2025:

  • a user without access to SCANFI's Drive folder fails;
  • a user with access downloads each national raster in full (2.4-3 GB each) instead of reading the study-area window from the mirror.

Biomass_borealDataPrep reaches this whenever it builds rstLCC itself, i.e. when rstLCC is not supplied, because it calls prepInputs_SCANFI_LCC_FAO() with the default forestLandFrom.

Fix. The lccFor() read goes through .withSCANFIAccess(), with the same remap and access-error handling as year's land cover. V3, which does not use the remap, is unchanged (enabled = dataVersion != "V3").

Test. In test-scanfiMirror.R, a mocked prepInputs() records the URLs it receives while the remap is set. The test checks that each forest-land year's URL is among them and that the global option is still NULL afterwards. It fails for all five years without the fix and passes with it.

Checks: devtools::test() on R 4.6.1 gives 225 tests, 0 failed, 12 skipped (slow, network or interactive). No version bump here, following the recent PRs.

🤖 Generated with Claude Code

prepInputs_SCANFI_LCC_FAO() read only `year`'s own land cover inside
.withSCANFIAccess(); the forest-land years went to Google Drive directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@achubaty
achubaty merged commit 2a63c82 into development Oct 19, 2026
14 checks passed
@achubaty
achubaty deleted the fix/forestland-scanfi-remap branch October 19, 2026 18:29
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.

1 participant