
Aggregate gridded grass availability to polity totals.
Source:R/feed_lpjml.R
aggregate_grass_to_polity.RdSums gridded grass availability to polity (country, or subnational where available) totals, splitting each cell's grass by the cell's land-area share in each polity so border cells are attributed proportionally. The polity grass supply ceiling for feed allocation.
Arguments
- grass
Gridded grass availability from
build_grass_availability(), withlon,lat,yearandgrass_avail_dm_t.- cell_polity
Cell-to-polity mapping with
lon,lat,area_codeandpolity_frac(the cell's land-area fraction in the polity; pass 1 for a majority assignment, e.g. fromcountry_grid).
Examples
grass <- build_grass_availability(method = "lpjml", example = TRUE)
cp <- tibble::tibble(
lon = grass$lon,
lat = grass$lat,
area_code = 1L,
polity_frac = 1
)
aggregate_grass_to_polity(grass, cp)
#> # A tibble: 1 × 3
#> area_code year grass_avail_dm_t
#> <int> <int> <dbl>
#> 1 1 2000 45730