R package piamInterfaces, version 0.17.11
Project specific interfaces to REMIND / MAgPIE.
- To understand how to submit to the IIASA database, read this REMIND tutorial.
- In the following, we differentiate templates (list of variables and corresponding units used in a project) and mappings (specifying which PIAM variable will be mapped to a project variable).
Mappings found in
the inst/mappings folder
serve to map variables from the PIAM framework to variables needed for the submission to databases.
The mappings are ;-separated files, using # as comment character, with the following mandatory columns:
variable: name of the variable in the project templateunit: unit corresponding tovariablepiam_variable: name of the variable in REMIND / MAgPIE / EDGE-T etc. reportingpiam_unit: unit corresponding topiam_variablepiam_factor: factor with which thepiam_variablehas to be multiplied for units to match
Recommended column:
description: description text defining thevariable. Never use"and;in the text.source: abbreviation of the PIAM part where thepiam_variablecomes from. UseB= Brick,C= MAGICC,M= MAgPIE,R= REMIND,S= SDP postprocessing,T= EDGE-Transport. This column is used to select the variables passed to remind2 and coupling tests. If the variable is not normally reported, add a smallxafter the model abbreviation for it to be skipped.
Additionally, some mappings use those columns:
idx: serial number ofvariableTier: importance of variable. 1 means most importantComment: place for comments
To edit a mapping in R, use:
mappingdata <- getMapping("AR6")
...
write.csv2(mappingdata, "test.csv", na = "", row.names = FALSE, quote = FALSE)
Opening the csv files in Excel can be problematic, as it sometimes changes values and quotation marks. You can edit the files in LibreOffice Calc using these settings in the Text Import dialog:
- Text Import with:
- Character set: Unicode (UTF-8)
- Separated by: Semicolon.
- Save with:
- Character set: Unicode (UTF-8)
- Field Delimiter: ;
- String Delimiter: (none)
The github diff on a large semicolon-separated file is often unreadable. For a human-readable output, save the old version of the mapping and run:
remind2::compareScenConf(fileList = c("oldfile.csv", "mappingfile.csv"), row.names = NULL)
-
To compare the results of different models, pass as
modeldataa quitte object or a csv/xlsx file. You get a PDF document for each scenario and each model with area plots for all the summation groups inAR6(orNAVIGATE) summation files plus line plots for each variable in thelineplotVariablesvector you supplied. It takes some time, better use aslurmjob for:plotIntercomparison(modeldata, summationsFile = "AR6", lineplotVariables = c("Temperature|Global Mean", "Population")) -
If your
modeldatais not well filtered such that for example model regions are not too different, you can useinteractive = TRUEwhich allows to select models, regions, scenarios and variables that you like in your PDF. AslineplotVariables, you can also specify mapping names.plotIntercomparison(modeldata, summationsFile = "AR6", lineplotVariables = c("AR6", "AR6_NGFS"), interactive = TRUE)
For installation of the most recent package version an additional repository has to be added in R:
options(repos = c(CRAN = "@CRAN@", pik = "https://rse.pik-potsdam.de/r/packages"))The additional repository can be made available permanently by adding the line above to a file called .Rprofile stored in the home folder of your system (Sys.glob("~") in R returns the home directory).
After that the most recent version of the package can be installed using install.packages:
install.packages("piamInterfaces")Package updates can be installed using update.packages (make sure that the additional repository has been added before running that command):
update.packages()In case of questions / problems please contact Falk Benke benke@pik-potsdam.de.
To cite package piamInterfaces in publications use:
Benke F, Richters O (2024). piamInterfaces: Project specific interfaces to REMIND / MAgPIE. R package version 0.17.11, <URL: https://github.com/pik-piam/piamInterfaces>.
A BibTeX entry for LaTeX users is
@Manual{,
title = {piamInterfaces: Project specific interfaces to REMIND / MAgPIE},
author = {Falk Benke and Oliver Richters},
year = {2024},
note = {R package version 0.17.11},
url = {https://github.com/pik-piam/piamInterfaces},
}