R/current-conditions.R
lcc2020_remap_table.RdBuilds the remapTable that LandR::overlayLCCs() uses to decide, for every combination of a
simulation land-cover code (LCC, SCANFI-derived) and a current-condition LCC 2020 code (CC),
which code the pixel ends up with. Promoted verbatim from LandWeb_preamble, which mirrors
LandWeb v2's rule ordering with LCC 2020 codes substituted for v2's CC 0-5, except that the
non-flammable rule now comes last (see Details).
lcc2020_remap_table(
lccClasses,
ccClasses,
treeClassesToReplace,
classes = lcc2020_classes()
)integer vector of the simulation land-cover codes present (NA is added).
integer vector of the LCC 2020 codes present; NAs are dropped, then NA is
added back as its own row.
integer vector of LCC codes that must be reclassified (set to 99).
class groups, as returned by lcc2020_classes().
A data.table with integer columns LCC, CC and newLCC, one row per combination.
Rule order matters: later rules overwrite earlier ones. In order:
LCC 0, 20, 30 -> NA;
CC missing or cropland -> keep LCC;
CC forest, shrub/grass/moss or wetland -> keep LCC;
LCC missing but CC forest -> 99;
CC urban -> 99;
LCC in treeClassesToReplace -> 99;
CC non-flammable (barren/water/snow-ice) -> NA.
Rule 7 was rule 3 until 1.0.3.9049. It only interacts with rule 6: forest land without trees
(treeClassesToReplace, e.g. 240) on what LCC 2020 calls barren, water or snow/ice was
reclassified to a neighbouring forest class, and is now non-vegetated.
CC does not override the simulation's forest determination: every CC class except
barren/water/snow-ice defers to LCC, so LCC 2020 calling a treed wetland "wetland" does not
strip forest from the simulation.
Note that rule 1 is overwritten by rules 2, 3, 5 and 7 for every code in the LCC 2020 legend,
so it only takes effect for a CC value outside that legend. It is kept for fidelity with v2
rather than removed, and the behaviour is pinned by a test.
lcc2020_remap_table(
lccClasses = c(20L, 30L, 210L, 220L),
ccClasses = c(1L, 14L, 17L, 18L),
treeClassesToReplace = 240L
)
#> Indices: <LCC>, <CC>
#> LCC CC newLCC
#> <int> <int> <int>
#> 1: NA NA NA
#> 2: 20 NA 20
#> 3: 30 NA 30
#> 4: 210 NA 210
#> 5: 220 NA 220
#> 6: NA 1 99
#> 7: 20 1 20
#> 8: 30 1 30
#> 9: 210 1 210
#> 10: 220 1 220
#> 11: NA 14 NA
#> 12: 20 14 20
#> 13: 30 14 30
#> 14: 210 14 210
#> 15: 220 14 220
#> 16: NA 17 99
#> 17: 20 17 99
#> 18: 30 17 99
#> 19: 210 17 99
#> 20: 220 17 99
#> 21: NA 18 NA
#> 22: 20 18 NA
#> 23: 30 18 NA
#> 24: 210 18 NA
#> 25: 220 18 NA
#> LCC CC newLCC
#> <int> <int> <int>