Creates the priors and the scores for each grid cell. For convenience, the function will always create data tables with priors and scores even though only one might required.

prepare_priors_and_scores(param)

Arguments

param

Object of type mapspamc_par that bundles all mapspamc parameters, including core model folders, alpha-3 country code, year, spatial resolution, most detailed level at which subnational statistics are available, administrative unit level at which the model is solved and type of model.

Details

Note that the function might take some time to run as it implements three consecutive processes. First, the biophysical suitability and potential yield maps for all production system and crop combinations are loaded and only grid cells that overlap with the cropland extent from the previous step are selected, after which all data is merged into one table and saved. This process also checks if the maps do not only contain zero values and, where needed, replaces the map by a substitute crop. This is important because it occasionally happens that the biophysical suitability and potential yield maps indicate zero suitability for a specific crop although the statistics suggest the crop is produced in the country. Not correction for this, would result in an ‘uninformed’ allocation of the crop, meaning it can be placed anywhere as long as the the constraints are satisfied and the objective function (minimization of cross-entropy or maximization of fitness score) is optimized. In case all the substitute crops have zero values, a warning is issued. The list of substitute crop is stored in the mappings/replace_gaez.sv file and can be adjusted by the user. The second and third process create data files with the priors and scores using the biophysical suitability and potential yield, among others, as input data.

Examples

if (FALSE) {
prepare_priors_and_scores(param)
}