Code
library(terra)
library(sf)library(terra)
library(sf)The forest carbon map from Harris et al. (2021) is a global, high-resolution (≈30 m) spatial dataset showing annual forest carbon fluxes—that is, where forests are absorbing (sinks) or releasing (sources) carbon by balancing removals into biomass against emissions from deforestation and disturbance from 2001–2019. Here we only used the initial carbon map estimated for the year 2000.
if (!dir.exists("data/biomass")) dir.create("data/biomass")
paste0(
"https://data-api.globalforestwatch.org/dataset/",
"whrc_aboveground_woody_biomass_stock_2000/v1.4/download/",
"geotiff?grid=10/40000&tile_id=20N_120E&pixel_meaning=Mg_ha-1&",
"x-api-key=2d60cd88-8348-4c0f-a6d5-bd9adb585a8c"
) |>
download.file("data/biomass/harris_carbon_2000.tif", "curl")area <- list.files("data/umrbpl/", full.names = TRUE, pattern = "shp$") |>
read_sf() |>
st_transform(crs = "EPSG:4326")
"data/biomass/harris_carbon_2000.tif" |>
rast() |>
crop(area) |>
plot()