Model setup

create_adm_map_pdf()

Creates a pdf file with maps of administrative unit locations

create_adm_list()

Creates a file with information on how administrative units are nested

create_grid()

Creates country grid

create_folders()

Creates mapspamc folder structure

create_model_template()

Creates mapspamc model template

mapspamc_par()

Sets mapspamc parameters

rasterize_adm_map()

Rasterizes the map with the location of the subnational administrative units

Pre-processing

align_raster()

Both clips a raster to polygon and aligns it to reference grid

check_statistics()

Checks the consistency of the subnational statistics

create_statistics_template()

Creates template for subnational crop statistics

reaggregate_statistics()

Reaggregates subnational statistics from the bottom up so they are consistent

Model preparation

combine_inputs()

Combines all inputs into one GAMS gdx file

harmonize_inputs()

Harmonizes crop statistics, cropland and irrigated area extent

prepare_cropland()

Prepares synergy cropland extent

prepare_irrigated_area()

Prepares synergy irrigated area extent

prepare_physical_area()

Calculates physical crop area at the subnational level

prepare_priors_and_scores()

Prepares grid cell priors and scores for all crops and production system combinations

Running the model

combine_results()

Combines GAMS output into one R rds file

run_mapspamc()

Runs crop allocation algorithm at the set administrative unit level

view_results()

Compares crop distribution maps using a panel for each production system

Post-processing

create_all_tif()

Creates tif files for all crop distribution maps produced by the model

Model validation

aggregate_to_adm()

Aggregates gridded results of alternative model to the administrative unit level of the target model

General

load_data()

Load model input data for further processing