Skip to contents

Sums 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.

Usage

aggregate_grass_to_polity(grass, cell_polity)

Arguments

grass

Gridded grass availability from build_grass_availability(), with lon, lat, year and grass_avail_dm_t.

cell_polity

Cell-to-polity mapping with lon, lat, area_code and polity_frac (the cell's land-area fraction in the polity; pass 1 for a majority assignment, e.g. from country_grid).

Value

A tibble with area_code, year and grass_avail_dm_t.

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