Title: | MAgPIE outputs R package for MAgPIE version 4.x to create outputs for FSDP project |
---|---|
Description: | Output routines for extracting results from the MAgPIE framework (versions 4.x) for the FSDP project. |
Authors: | Benjamin Leon Bodirsky [aut, cre], David Chen [aut], Michael Crawford [aut], Debbora Leip [aut], Patrick von Jeetze [aut], Felicitas Beier [aut], Edna Molina Bacca [aut], Jan Philipp Dietrich [aut], Florian Humpenoeder [aut] |
Maintainer: | Benjamin Leon Bodirsky <[email protected]> |
License: | LGPL-3 | file LICENSE |
Version: | 0.58.1 |
Built: | 2024-11-20 21:21:31 UTC |
Source: | https://github.com/pik-piam/m4fsdp |
Output routines for extracting results from the MAgPIE framework (versions 4.x) for the FSDP project.
Maintainer: Benjamin Leon Bodirsky [email protected]
Authors:
David Chen [email protected]
Michael Crawford [email protected]
Debbora Leip [email protected]
Patrick von Jeetze [email protected]
Felicitas Beier [email protected]
Edna Molina Bacca [email protected]
Jan Philipp Dietrich [email protected]
Florian Humpenoeder [email protected]
Useful links:
Report bugs at https://github.com/pik-piam/m4fsdp/issues
Reads in the results from Marco Springmann's health impacts model, filters them down to the FSEC-relevant variables, and saves them to the selected scenarios' report.mif.
appendReportHealthImpacts(healthImpacts_gdx, scenario, dir = ".")
appendReportHealthImpacts(healthImpacts_gdx, scenario, dir = ".")
healthImpacts_gdx |
full pathname of the health impacts dataset |
scenario |
name of the scenario |
dir |
scenario output directory |
Michael Crawford
Reads in the results from the MAGICC7 AR6 probabilistic scenarios
appendReportMAGICC7(resultsPath, scenario, dir = ".")
appendReportMAGICC7(resultsPath, scenario, dir = ".")
resultsPath |
full file path of the excel with the for MAGICC7 results |
scenario |
name of the scenario |
dir |
scenario output directory |
Michael Crawford
Validation for FSDP MAgPIE runs written by openAI chatbot. The command was: "Please write a function in R. It should receive a vector of scenario_names. In the function, there is a mapping that assigns each element of potential_names to an individual color. The function checks which elements of scenario_names are in potential_names and returns the respective colors as a vector of colors.
assignScenarioColors(scenario_names)
assignScenarioColors(scenario_names)
scenario_names |
scenario names to be checked for their colorcode. |
openAI, Benjamin Bodirsky
Line Type for FSDP MAgPIE runs
assignScenarioLinetype(scenario_names)
assignScenarioLinetype(scenario_names)
scenario_names |
scenario names to be checked for their colorcode. |
Florian Humpenoeder
FDSP plot with single measure and bundles
bundlesFSDP(repReg, regionSel = "GLO", file = NULL)
bundlesFSDP(repReg, regionSel = "GLO", file = NULL)
repReg |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. |
regionSel |
Region that should be plotted |
file |
file name (e.g. BundleFSDP.pdf or BundleFSDP.jpg) or NULL |
plot with single measure and bundles
depends on file argument. If file==NULL, the default, the plot is returned. If a filename is provided the plot is saved as file
Florian Humpenoeder
reads in FSDP reporting file
convertReportFSDP(rep, scengroup = NULL, subset = FALSE, varlist = NULL)
convertReportFSDP(rep, scengroup = NULL, subset = FALSE, varlist = NULL)
rep |
reporting .rds file (produced by FDSP_collect.R output script) |
scengroup |
options: FSECa, FSECb, FSECc, FSECd |
subset |
TRUE returns "BAU 2020","BAU 2050","FSDP 2050". FALSE returns all scenarios. "FSTssp2_minus_BASEssp2" or "FSTsdp_minus_BASEssp2" returns the allFSM or FSDP scenario minus the BAU scenario in 2050. |
varlist |
file name for plain text variable list (e.g. "var_names.csv") |
blub
if file is NULL a ggplot2 object will be return
Florian Humpenoeder
FDSP dashboard
dashboardFSDP( repReg, repIso, repGrid, regionSel = "GLO", outputDir = "", file = "dashboardFSDP.html" )
dashboardFSDP( repReg, repIso, repGrid, regionSel = "GLO", outputDir = "", file = "dashboardFSDP.html" )
repReg |
rds file or data.frame with regional data from all MAgPIE runs, produced with FSDP_collect.R output script. |
repIso |
rds file or data.frame with country-level data from all MAgPIE runs, produced with FSDP_collect.R output script. |
repGrid |
rds file or data.frame with gridded data from all MAgPIE runs, produced with FSDP_collect.R output script. |
regionSel |
Region that should be plotted |
outputDir |
output directory |
file |
file name |
FDSP dashboard
html file
Florian Humpenoeder
Scenarios for FSDP plotting
getScenarios(tableType = NULL, oldformat = FALSE)
getScenarios(tableType = NULL, oldformat = FALSE)
tableType |
select the scenarios based on csv file figureTableType.csv in inst/extdata folder. NULL (default) returns scenario names. |
oldformat |
return in format modelrun::bundle|scenarioname |
includes scenarios and their grouping into bundles
named vector
Benjamin Bodirsky
Variables for FSDP plotting
getVariables(reportVariables = NULL)
getVariables(reportVariables = NULL)
reportVariables |
Variables in report file |
includes information about unit, variable group, rounding etc
named vector
Florian Humpenoeder
creates a heatmap for FSDP MAgPIE runs
heatmapFSDP( repReg, regionSel = "GLO", tableType = 1, file = NULL, width = 10.5, height = 9 )
heatmapFSDP( repReg, regionSel = "GLO", tableType = 1, file = NULL, width = 10.5, height = 9 )
repReg |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. |
regionSel |
Region that should be plotted. select "IND" for India plots |
tableType |
options: 1, 2, 3 |
file |
file name (e.g. FSDP_heatmap.pdf or FSDP_heatmap.jpg) or NULL |
width |
width |
height |
height |
blub
if file is NULL a ggplot2 object will be return
Florian Humpenoeder, Vartika Singh
Line plots FSDP
lineplotFSDP(repReg, val, regionSel = "GLO", file = NULL, scens = "bundles")
lineplotFSDP(repReg, val, regionSel = "GLO", file = NULL, scens = "bundles")
repReg |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. |
val |
rds file or data.frame with validation data |
regionSel |
Region that should be plotted (e.g. c("IND","EUR","GLO")). Aggregate will return LIR, MIR and HIR. |
file |
file name |
scens |
if "BAU_FSEC", BAU and FSEC scenarios are plotted, with "central" plots the core scenarios, "extended" plot the core scenarios and all ssps. |
creates validation for FSDP MAgPIE runs
Florian Humpenoeder
Line plots FSDP
lineplotFSDPIndia( repReg, val, regionSel = "IND", file = NULL, scens = "bundles" )
lineplotFSDPIndia( repReg, val, regionSel = "IND", file = NULL, scens = "bundles" )
repReg |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. |
val |
rds file or data.frame with validation data |
regionSel |
Region that should be plotted (e.g. c("IND","EUR","GLO")). Aggregate will return LIR, MIR and HIR. |
file |
file name |
scens |
if "BAU_FSEC", BAU and FSEC scenarios are plotted, with "central" plots the core scenarios, "extended" plot the core scenarios and all ssps. |
creates validation for FSDP MAgPIE runs
Florian Humpenoeder
Creates csv with values for SI table on milestones
milestoneTable(scenarioFolder, outFolder = NULL, file = NULL)
milestoneTable(scenarioFolder, outFolder = NULL, file = NULL)
scenarioFolder |
outputfolder of a specific MAgPIE run (should be an FSECe_FSDP run for SI table) |
outFolder |
main outputfolder, where output csv will be saved |
file |
name to save table as csv |
Creates all FSDP plots
plotFSDP( outputfolder = "output", reg = NULL, iso = NULL, grid = NULL, val = NULL, reg2iso = NULL, rev = NULL, dirFsdp = NULL )
plotFSDP( outputfolder = "output", reg = NULL, iso = NULL, grid = NULL, val = NULL, reg2iso = NULL, rev = NULL, dirFsdp = NULL )
outputfolder |
output folder |
reg |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. NULL will automatically detect the most recent version. |
iso |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. NULL will automatically detect the most recent version. |
grid |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. NULL will automatically detect the most recent version.#' @details uses the most recent vXX_reg/grid/iso.rds files in the "output" folder by default |
val |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. NULL will automatically detect the most recent version.#' @return plots in "output" folder |
reg2iso |
rds file or data.frame with Mapping, produced with FSDP_collect.R output script. NULL will automatically detect the most recent version.#' @author Florian Humpenoeder |
rev |
revision (e.g. "v28"). NULL will automatically detect the most recent version. |
dirFsdp |
path to outputfolder of the FSDP run (to create the milestones table). NULL will automatically detect the most recent version |
creates a spatial diffmap between allFSM scneario and reference
spatialMapsAllFSMDiffmap( repReg, repIso, repGrid, reg2iso, file = NULL, subset = c("FSTsdp_minus_BASEssp2") )
spatialMapsAllFSMDiffmap( repReg, repIso, repGrid, reg2iso, file = NULL, subset = c("FSTsdp_minus_BASEssp2") )
repReg |
reporting .rds file or data.frame with regional results (produced by FDSP_collect.R output script) |
repIso |
reporting .rds file or data.frame with country level results (produced by FDSP_collect.R output script) |
repGrid |
reporting .rds file or data.frame with grid level results (produced by FDSP_collect.R output script) |
reg2iso |
mapping file or data.frame with regions and countries (produced by FDSP_collect.R output script) |
file |
file name (e.g. FSDP_spatialmaps.pdf or FSDP_spatialmaps.pdf) or NULL |
subset |
"FSTssp2_minus_BASEssp2" or "FSTsdp_minus_BASEssp2" returns diffmaps for allFSM or FSDP scenario minus the BAU scenario in 2050. |
blub
if file is NULL a ggplot2 object will be return
Florian Humpenoeder
creates a spatial mapsfor FSDP MAgPIE runs
spatialMapsFSDP( repReg, repIso, repGrid, reg2iso, file = NULL, recalcPolygons = FALSE )
spatialMapsFSDP( repReg, repIso, repGrid, reg2iso, file = NULL, recalcPolygons = FALSE )
repReg |
reporting .rds file or data.frame with regional results (produced by FDSP_collect.R output script) |
repIso |
reporting .rds file or data.frame with country level results (produced by FDSP_collect.R output script) |
repGrid |
reporting .rds file or data.frame with grid level results (produced by FDSP_collect.R output script) |
reg2iso |
mapping file or data.frame with regions and countries (produced by FDSP_collect.R output script) |
file |
file name (e.g. FSDP_spatialmaps.pdf or FSDP_spatialmaps.pdf) or NULL |
recalcPolygons |
recalculate polygons for cartogram projections (FALSE / TRUE) |
blub
if file is NULL a ggplot2 object will be return
Florian Humpenoeder
Creates crop share plot
SupplPlotsCropShr( outFolder, file = NULL, scenarios = c("BAU", "FSDP"), plotyears = c("2020", "2050"), panel = "row", combined = TRUE, HR = TRUE )
SupplPlotsCropShr( outFolder, file = NULL, scenarios = c("BAU", "FSDP"), plotyears = c("2020", "2050"), panel = "row", combined = TRUE, HR = TRUE )
outFolder |
output folder |
file |
Name of file output |
scenarios |
scenarios used for plotting |
plotyears |
years for the plot |
panel |
plot regions as "row" or as "matrix" |
combined |
whether regional and global plots should be combined |
HR |
using high resolution data or low resolution data |
blub
Crop share on the y-axis and cropland area in each cluster on the x-axis.
Patrick v. Jeetze, Benjamin Bodirsky
creates supplementary plots for FSDP MAgPIE runs
SupplPlotsFSDP( repReg, scenarioType = "manuscript", outFolder, calorieSupply = TRUE, caseRegion = NULL )
SupplPlotsFSDP( repReg, scenarioType = "manuscript", outFolder, calorieSupply = TRUE, caseRegion = NULL )
repReg |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. |
scenarioType |
options: all, or one of the a-e groupings |
outFolder |
output folder to save to |
calorieSupply |
parameter to set if calorie figures needed for calories supply or calorie intake, set FALSE for Intake |
caseRegion |
set to a particular region (i.e. "IND") if plots are being used for country case studies |
if file is NULL a ggplot2 object will be return
David M Chen, Vartika Singh
Creates land conservation map
SupplPlotsLandConsv( outFolder, file = "suppPlotsLandConsv.png", gdxFolder = NULL )
SupplPlotsLandConsv( outFolder, file = "suppPlotsLandConsv.png", gdxFolder = NULL )
outFolder |
output folder |
file |
Name of file output |
gdxFolder |
Run folder |
Produces map of land targeted in the food system measure LandConservation
Map with cell share included in land conservation measure
Patrick v. Jeetze
creates supplementary themes for FSDP MAgPIE runs
themeSupplFood(base_size = 16)
themeSupplFood(base_size = 16)
base_size |
base size of plot |
creates supplementary themes for FSDP MAgPIE runs
themeSupplReg( base_size = 11, base_family = "", rotate_x = FALSE, panel.spacing = 3 )
themeSupplReg( base_size = 11, base_family = "", rotate_x = FALSE, panel.spacing = 3 )
base_size |
plot settings |
base_family |
plot settings |
rotate_x |
plot settings |
panel.spacing |
plot settings |
Validation for FSDP MAgPIE runs
validationFSDP( repReg, val, regionSel = "aggregate", folder = "output", scens = "BAU_FSEC", showHistLegend = TRUE )
validationFSDP( repReg, val, regionSel = "aggregate", folder = "output", scens = "BAU_FSEC", showHistLegend = TRUE )
repReg |
rds file or data.frame with all MAgPIE runs, produced with FSDP_collect.R output script. |
val |
rds file or data.frame with validation data |
regionSel |
Region that should be plotted (e.g. c("IND","EUR","GLO")). Aggregate will return LIR, MIR and HIR. |
folder |
output folder |
scens |
if "BAU_FSEC", BAU and FSEC scenarios are plotted, with "central" plots the core scenarios, "extended" plot the core scenarios and all ssps. |
showHistLegend |
show legend for historic data sets. TRUE / FALSE |
creates validation for FSDP MAgPIE runs
Florian Humpenoeder