
Derive the lake-and-river fraction of each 0.5-degree cell from GLWD
Source:R/polycell_layers.R
glwd_water_fraction.RdAggregates the Global Lakes and Wetlands Database rasters to the 0.5-degree
grid as a fraction of the whole cell. This is the one implementation of that
derivation in WHEP: read_glwd_water() calls it for
build_polycell_support(), and inst/scripts/prepare_spatialize_all.R
calls it to write LPJmL's lakes_rivers input. It used to live only in that
script, so the polycell producer read a hand-made .clm artefact of an
LPJmL run instead and the two answers were free to diverge.
Which classes count as inland water
GLWD v2 is a 33-class wetland map, not a water fraction, so a subset has
to be chosen and the choice is a judgement rather than a lookup. Taken here:
lakes as classes 1-3 (freshwater lake, saline lake, reservoir) and rivers as
class 7 (small streams). Everything else – palustrine and riverine wetland,
peatland, mangrove, saltmarsh, rice paddies – is excluded: those are
land that is wet, not surface water, and build_polycell_support() books
them under land_area_ha.
Under GLWD v1 the equivalent classes are 1 (lakes) and 3 (rivers). The two
vintages are not interchangeable and give totals about 20% apart; see
read_glwd_water().
Class membership is multiplied by the companion area_pct raster where one
is present, so a partially covered source pixel contributes its own fraction
rather than counting whole.
Examples
# Requires the GLWD download; not run without it.
if (nzchar(Sys.getenv("WHEP_LPJML_INPUT_DIR"))) {
glwd_water_fraction(
file.path(Sys.getenv("WHEP_LPJML_INPUT_DIR"), "GLWD")
)
}