Title: | Create GDP and Population Scenarios |
---|---|
Description: | Create GDP and population scenarios This package constructs the GDP and population scenarios used as drivers in both the REMIND and MAgPIE models. |
Authors: | Johannes Koch [aut, cre], Bjoern Soergel [aut], Deborra Leip [aut], Falk Benke [aut], Jan Philipp Dietrich [aut] |
Maintainer: | Johannes Koch <[email protected]> |
License: | LGPL (>= 3) |
Version: | 7.1.0 |
Built: | 2025-02-20 14:22:17 UTC |
Source: | https://github.com/pik-piam/mrdrivers |
Like all scenarios in mrdrivers, the GDP and GDP per capita scenarios are the result of a harmonization exercise
between past data and future projections. Together with the corresponding population scenarios
(see calcPopulation()
) they comprise a consistent set of scenarios.
The scenario
argument is used to designate the scenario(s) to be returned. Currently available GDP scenarios are:
SSPs, SSP1, SSP2, SSP3, SSP4, SSP5, SDPs, ISIMIP, SSP2IndiaDEAs, SSP2IndiaMedium, SSP2IndiaHigh. See the vignette: vignette("scenarios")
and/or
toolGetScenarioDefinition()
for more information, scenario options, definitions and references.
calcGDP( scenario, unit = toolGetUnitDollar(inPPP = TRUE), average2020 = TRUE, ... ) calcGDPpc( scenario, unit = toolGetUnitDollar(inPPP = TRUE), average2020 = TRUE, ... )
calcGDP( scenario, unit = toolGetUnitDollar(inPPP = TRUE), average2020 = TRUE, ... ) calcGDPpc( scenario, unit = toolGetUnitDollar(inPPP = TRUE), average2020 = TRUE, ... )
scenario |
A string (or vector of strings) designating the scenario(s) to be returned. Use
|
unit |
A string specifying the unit of GDP. Can be either:
In all cases, GDP is returned in millions. |
average2020 |
If TRUE (default), then the 2020 value is replaced by the 2018-2022 average. To be consistent, the yearly resolution is decreased to 5 year intervals. |
... |
Arguments passed on to
|
magpie object with the requested output data either on country or on regional level depending on the choice of argument "aggregate" or a list of information if supplementary is set to TRUE.
toolGetScenarioDefinition()
for scenario options and definitions.
madrat::calcOutput()
for how to return supplementary information and other control options.
calcDriver()
, calcScenarioConstructor()
and calcHarmonizedData()
for how to create new scenarios
(for developers).
## Not run: # Return all SSP scenarios calcOutput("GDP", scenario = "SSPs") # Return only the SSP2 GDP scenario calcOutput("GDP", scenario = "SSP2") # Return the SSP and SDP GDPpc scenarios calcOutput("GDP", scenario = c("SSPs", "SDPs")) ## End(Not run) ## Not run: calcOutput("GDPpc") ## End(Not run)
## Not run: # Return all SSP scenarios calcOutput("GDP", scenario = "SSPs") # Return only the SSP2 GDP scenario calcOutput("GDP", scenario = "SSP2") # Return the SSP and SDP GDPpc scenarios calcOutput("GDP", scenario = c("SSPs", "SDPs")) ## End(Not run) ## Not run: calcOutput("GDPpc") ## End(Not run)
Like all scenarios in mrdrivers, the Population, Labour and Urban population share scenarios are the result of a harmonization exercise between past data and future projections.
The scenario
argument is used to designate the scenario(s) to be returned. Currently available Population
scenarios are: SSPs, SSP1, SSP2, SSP3, SSP4, SSP5, SDPs, ISIMIP, SSP2IndiaDEAs, SSP2IndiaMedium, SSP2IndiaHigh. See the vignette:
vignette("scenarios")
and/or toolGetScenarioDefinition()
for more information, scenario options,
definitions and references.
calcPopulation(scenario, ...) calcLabour(scenario, ...) calcUrban(scenario, asShare = TRUE, ...)
calcPopulation(scenario, ...) calcLabour(scenario, ...) calcUrban(scenario, asShare = TRUE, ...)
scenario |
A string (or vector of strings) designating the scenario(s) to be returned. Use
|
... |
Arguments passed on to
|
asShare |
If TRUE (default) urban population shares are returned. If FALSE, then urban population in millions is returned. |
magpie object with the requested output data either on country or on regional level depending on the choice of argument "aggregate" or a list of information if supplementary is set to TRUE.
toolGetScenarioDefinition()
for scenario options and definitions.
madrat::calcOutput()
for how to return supplementary information and other control options.
calcDriver()
, calcScenarioConstructor()
and calcHarmonizedData()
for how to create new scenarios
(for developers).
## Not run: # Return all SSP scenarios calcOutput("Population", scenario = "SSPs") # Return only the SSP2 GDP scenario calcOutput("Population", scenario = "SSP2") # Return the SSP and SDP Labour scenarios calcOutput("Population", scenario = c("SSPs", "SDPs")) ## End(Not run) ## Not run: calcOutput("Labour", scenario = "SSPs") ## End(Not run) ## Not run: calcOutput("Urban", scenario = "SSPs") ## End(Not run)
## Not run: # Return all SSP scenarios calcOutput("Population", scenario = "SSPs") # Return only the SSP2 GDP scenario calcOutput("Population", scenario = "SSP2") # Return the SSP and SDP Labour scenarios calcOutput("Population", scenario = c("SSPs", "SDPs")) ## End(Not run) ## Not run: calcOutput("Labour", scenario = "SSPs") ## End(Not run) ## Not run: calcOutput("Urban", scenario = "SSPs") ## End(Not run)
Read-in data from the IMF's World Economic Outlook. Currently reading GDP per capita and current account balance data.
downloadIMF() readIMF() convertIMF(x, subtype = "all")
downloadIMF() readIMF() convertIMF(x, subtype = "all")
x |
MAgPIE object returned by readIMF |
subtype |
Use to filter the IMF data |
The read-in data, usually a magpie object. If supplementary is TRUE a list including the data and metadata is returned instead. The temporal and data dimensionality should match the source data. The spatial dimension should either match the source data or, if the convert argument is set to TRUE, should be on ISO code country level.
madrat::readSource()
and madrat::downloadSource()
## Not run: readSource("IMF") ## End(Not run)
## Not run: readSource("IMF") ## End(Not run)
Read-in GDP per-capita data from the publication James, Spencer L., Paul Gubbins, Christopher JL Murray, and Emmanuela Gakidou. 2012. "Developing a Comprehensive Time Series of GDP per Capita for 210 Countries from 1950 to 2015." Population Health Metrics 10 (1): 12. doi:10.1186/1478-7954-10-12.
downloadJames() readJames(subtype) convertJames(x, subtype)
downloadJames() readJames(subtype) convertJames(x, subtype)
subtype |
String indicating the data series |
x |
MAgPIE object returned by readJames |
The data is in Annex 3.
The read-in data, usually a magpie object. If supplementary is TRUE a list including the data and metadata is returned instead. The temporal and data dimensionality should match the source data. The spatial dimension should either match the source data or, if the convert argument is set to TRUE, should be on ISO code country level.
madrat::readSource()
and madrat::downloadSource()
## Not run: readSource("James", subtype = "gdppc") # Or more explicitly: readSource("James", subtype = "WB_USD05_PPP_pc") ## End(Not run)
## Not run: readSource("James", subtype = "gdppc") # Or more explicitly: readSource("James", subtype = "WB_USD05_PPP_pc") ## End(Not run)
Read-in gdp or population data for minor islands (not included in big inventories) from a custom made dataset that gets data from a variety of sources (e.g. CIA World Factbook, Insee, BEA, PRISM, and Woldometers).
downloadMissingIslands() readMissingIslands(subtype) convertMissingIslands(x, subtype)
downloadMissingIslands() readMissingIslands(subtype) convertMissingIslands(x, subtype)
subtype |
pop for population, or gdp for gdp |
x |
MAgPIE object returned by readMissingIslands |
The read-in data, usually a magpie object. If supplementary is TRUE a list including the data and metadata is returned instead. The temporal and data dimensionality should match the source data. The spatial dimension should either match the source data or, if the convert argument is set to TRUE, should be on ISO code country level.
madrat::readSource()
and madrat::downloadSource()
## Not run: readSource("MissingIslands", subtype = "pop") ## End(Not run)
## Not run: readSource("MissingIslands", subtype = "pop") ## End(Not run)
Read-in an xlsx file from the World Bank's Population Estimates And Projections (PEAP) The PEAP data cannot seemed to be accessed by the WDI::WDI package nor the World Bank's API directly. Manual download required from https://databank.worldbank.org/source/population-estimates-and-projections#
downloadPEAP() readPEAP() convertPEAP(x)
downloadPEAP() readPEAP() convertPEAP(x)
x |
MAgPIE object returned by readPEAP |
The read-in data, usually a magpie object. If supplementary is TRUE a list including the data and metadata is returned instead. The temporal and data dimensionality should match the source data. The spatial dimension should either match the source data or, if the convert argument is set to TRUE, should be on ISO code country level.
madrat::readSource()
and madrat::downloadSource()
Read-in UN population data.
downloadUN_PopDiv() readUN_PopDiv(subtype, subset = "estimates") convertUN_PopDiv(x)
downloadUN_PopDiv() readUN_PopDiv(subtype, subset = "estimates") convertUN_PopDiv(x)
subtype |
Either "pop" or "lab". |
subset |
Either "estimates" or "medium". |
x |
MAgPIE object returned from readUN_PopDiv |
The read-in data, usually a magpie object. If supplementary is TRUE a list including the data and metadata is returned instead. The temporal and data dimensionality should match the source data. The spatial dimension should either match the source data or, if the convert argument is set to TRUE, should be on ISO code country level.
madrat::readSource()
and madrat::downloadSource()
Download, read-in and convert WDI (World development indicators) data.
downloadWDI() readWDI(subtype) convertWDI(x, subtype)
downloadWDI() readWDI(subtype) convertWDI(x, subtype)
subtype |
A string. Type of WDI data that should be read. Use the World Bank indicator abbreviation. Available subtypes are:
|
x |
MAgPIE object returned by readWDI |
The workflow to update the WDI data is the following: call the download function manually, and rename the new WDI.rds file including the download date. Then change the file_name that is read by readWDI. This ensures, that the past data is not changed between users.
The read-in data, usually a magpie object. If supplementary is TRUE a list including the data and metadata is returned instead. The temporal and data dimensionality should match the source data. The spatial dimension should either match the source data or, if the convert argument is set to TRUE, should be on ISO code country level.
madrat::readSource()
and madrat::downloadSource()
## Not run: readSource("WDI", subtype = "pop") ## End(Not run)
## Not run: readSource("WDI", subtype = "pop") ## End(Not run)
Read-in DEA data as magclass object
readIndiaDEA() convertIndiaDEA(x, subtype = "all", subset = c("baseline", "optimistic")) downloadIndiaDEA()
readIndiaDEA() convertIndiaDEA(x, subtype = "all", subset = c("baseline", "optimistic")) downloadIndiaDEA()
x |
MAgPIE object returned from readIndiaDEA |
subtype |
A string, either "all", "gdppc", "pop" |
subset |
A vector of strings designating the scenarios. Defaults to c("baseline", "optimistic"). |
The read-in data, usually a magpie object. If supplementary is TRUE a list including the data and metadata is returned instead. The temporal and data dimensionality should match the source data. The spatial dimension should either match the source data or, if the convert argument is set to TRUE, should be on ISO code country level.
## Not run: readSource("IndiaDEA", subtype = "gdppc") ## End(Not run)
## Not run: readSource("IndiaDEA", subtype = "gdppc") ## End(Not run)
Read-in SSP data and store as magclass object. Filter for subtype and subset in the convert function to use common read cache (speeds up the computations).
readSSP() convertSSP( x, subtype = "all", subset = c("SSP1", "SSP2", "SSP3", "SSP4", "SSP5") ) downloadSSP()
readSSP() convertSSP( x, subtype = "all", subset = c("SSP1", "SSP2", "SSP3", "SSP4", "SSP5") ) downloadSSP()
x |
MAgPIE object returned from readSSP |
subtype |
A string, either "all", "gdp", "pop", "lab", "urb" |
subset |
A vector of strings designating the scenarios. Defaults to c("SSP1", "SSP2", "SSP3", "SSP4", "SSP5"). "Historical Reference" is also available as a scenario. |
The read-in data, usually a magpie object. If supplementary is TRUE a list including the data and metadata is returned instead. The temporal and data dimensionality should match the source data. The spatial dimension should either match the source data or, if the convert argument is set to TRUE, should be on ISO code country level.
## Not run: readSource("SSP", subtype = "gdp") ## End(Not run)
## Not run: readSource("SSP", subtype = "gdp") ## End(Not run)
The most important and common "convert" operations are:
removing undefined countries,
substituting NAs, see the "substituteNAsWith" argument,
using default set names "iso3c", "year", and "variable",
fill in countries,
sort in chronological order.
toolGeneralConvert( x, useDefaultSetNames = TRUE, countryFillWith = 0, substituteNAsWith = 0, warn = TRUE, note = TRUE, ... )
toolGeneralConvert( x, useDefaultSetNames = TRUE, countryFillWith = 0, substituteNAsWith = 0, warn = TRUE, note = TRUE, ... )
x |
A magpie object. |
useDefaultSetNames |
TRUE or FALSE. |
countryFillWith |
|
substituteNAsWith |
|
warn |
TRUE or FALSE. |
note |
TRUE or FALSE. |
... |
Arguments passed on to |
A magpie object.
## Not run: toolGeneralConvert(x) ## End(Not run)
## Not run: toolGeneralConvert(x) ## End(Not run)
toolGetScenarioDefinition can be used to figure out which scenarios are made available by mrdrivers, and how they are constructed, i.e. what past data, future data and harmonization methods are used.
toolGetScenarioDefinition( driver = NULL, scen = NULL, aslist = FALSE, getGroupShortcuts = FALSE )
toolGetScenarioDefinition( driver = NULL, scen = NULL, aslist = FALSE, getGroupShortcuts = FALSE )
driver |
NULL or a character vector designating the driver for which information is to be returned. If NULL, information for all drivers is returned. Available drivers are:
|
scen |
NULL or a character vector designating the scenario for which information is to be returned. If NULL, information for all scenarios is returned. |
aslist |
TRUE or FALSE (default). If TRUE then the pastData, futureData and harmonization strings are returned as a list. |
getGroupShortcuts |
TRUE or FALSE (default). If TRUE then return list of scenario group shortcuts. |
A tibble with the driver and scenario information.
toolGetScenarioDefinition() toolGetScenarioDefinition(driver = "GDP") toolGetScenarioDefinition(scen = "SSP2") toolGetScenarioDefinition(driver = "Population", scen = "SSPs", aslist = TRUE)
toolGetScenarioDefinition() toolGetScenarioDefinition(driver = "GDP") toolGetScenarioDefinition(scen = "SSP2") toolGetScenarioDefinition(driver = "Population", scen = "SSPs", aslist = TRUE)
toolGetUnitDollar returns default unit used for monetary values. Currently: constant 2017 US$MER.
toolGetUnitDollar(returnOnlyBase = FALSE, inPPP = FALSE)
toolGetUnitDollar(returnOnlyBase = FALSE, inPPP = FALSE)
returnOnlyBase |
TRUE or FALSE (default). If true only the base year is returned (as string). |
inPPP |
TRUE or FALSE (default). If TRUE the the string ends in 'Int$PPP', instead of 'Int$MER'. |
A string with the monetary unit, currently constant 2017 US$MER.
toolGetUnitDollar() toolGetUnitDollar(inPPP = TRUE) toolGetUnitDollar(returnOnlyBase = TRUE)
toolGetUnitDollar() toolGetUnitDollar(inPPP = TRUE) toolGetUnitDollar(returnOnlyBase = TRUE)
Like all harmonization tools in mrdrivers, toolHarmonizeFuture takes two magpie objects, 'past' and 'future', and returns a single magpie object, i.e. the harmonized time-series. In this case, the harmonized time-series is always equal to 'future', in the years of 'future'. After that the harmonized time-series depends on the 'method' argument chosen.
toolHarmonizeFuture(past, future, method = "level")
toolHarmonizeFuture(past, future, method = "level")
past |
A magpie object. |
future |
A magpie object with only one scenario/datatype, i.e. the length of the third dimension should be 1. |
method |
A string defining the harmonization method:
|
A magpie object with the same dimensions as 'past'.
If the 'past' object has multiple scenarios/datatypes, i.e. the length of the third dimension is larger than 1, then the a harmonized time-series is created for every scenario/datatype in past. The same 'future' object is used in every case - hence the requirement that 'future' only have one scenario/datatype.
## Not run: toolHarmonizePast(past, future) ## End(Not run)
## Not run: toolHarmonizePast(past, future) ## End(Not run)
Like all harmonization tools in mrdrivers, toolHarmonizePast takes two magpie objects, 'past' and 'future', and returns a single magpie object, i.e. the harmonized time-series. In this case, the harmonized time-series is always equal to 'past', in the years of 'past'. After that the harmonized time-series depends on the 'method' argument chosen.
toolHarmonizePast(past, future, method = "level", yEnd = 2100)
toolHarmonizePast(past, future, method = "level", yEnd = 2100)
past |
A magpie object with only one scenario/datatype, i.e. the length of the third dimension should be 1. |
future |
A magpie object. |
method |
A string defining the harmonization method:
|
yEnd |
Additional input for "transition" method. Year by which the transition period is completed. |
A magpie object with the same dimensions as 'future'.
If the 'future' object has multiple scenarios/datatypes, i.e. the length of the third dimension is larger than 1, then the a harmonized time-series is created for every scenario/datatype in future. The same 'past' object is used in every case - hence the requirement that 'past' only have one scenario/datatype.
## Not run: toolHarmonizePast(past, future) ## End(Not run)
## Not run: toolHarmonizePast(past, future) ## End(Not run)
Some scenarios can be referred to as a group, e.g. as "SSPs". In some cases however the individual scenarios of that group are wanted explicitly. This function replaces the group-shortcuts with the names of the scenarios in that group.
Current available groups are: SSPs, SSP2IndiaDEAs
toolReplaceShortcuts(scenario)
toolReplaceShortcuts(scenario)
scenario |
A string (or vector of strings) designating the scenario(s) to be returned. Use
|
The modified scenario argument, with the group-names replaced.
toolGetScenarioDefinition()
for scenario options and definitions. Set getGroupShortcuts
to TRUE
to
return the available shortcuts: toolGetScenarioDefinition(getGroupShortcuts = TRUE)
.
toolReplaceShortcuts("SSPs")
toolReplaceShortcuts("SSPs")