This function connects to a gcamdatabase and uses a query file to out results into a table ready for plotting.

metis.readgcam(
  gcamdatabase = NULL,
  queryFile = NULL,
  dataProjFile = paste(getwd(), "/outputs/dataProj.proj", sep = ""),
  scenOrigNames = "All",
  scenNewNames = NULL,
  reReadData = T,
  dirOutputs = paste(getwd(), "/outputs", sep = ""),
  regionsSelect = NULL,
  paramsSelect = "All",
  folderName = NULL,
  nameAppend = "",
  saveData = T
)

Arguments

gcamdatabase

Default = NULL. Full path to GCAM database folder.

queryFile

Defualt = NULL. When NULL metis loads pre-saved xml file metis::xmlMetisQueries

dataProjFile

Default = NULL. Optional. A default 'dataProj.proj' is produced if no .Proj file is specified.

scenOrigNames

Default = "All". Original Scenarios names in GCAM database in a string vector. For example c('scenario1','scenario2).

scenNewNames

New Names which may be shorter and more useful for figures etc. Default will use Original Names. For example c('scenario1','scenario2)

reReadData

If TRUE will read the GCAM data base and create a queryData.proj file in the same folder as the GCAM database. If FALSE will load a '.proj' file if a file with full path is provided otherwise it will search for a dataProj.proj file in the existing folder which may have been created from an old run.

dirOutputs

Full path to directory for outputs

regionsSelect

The regions to analyze in a vector. Example c('Colombia','Argentina'). Full list:

USA, Africa_Eastern, Africa_Northern, Africa_Southern, Africa_Western, Australia_NZ, Brazil, Canada Central America and Caribbean, Central Asia, China, EU-12, EU-15, Europe_Eastern, Europe_Non_EU, European Free Trade Association, India, Indonesia, Japan, Mexico, Middle East, Pakistan, Russia, South Africa, South America_Northern, South America_Southern, South Asia, South Korea, Southeast Asia,

paramsSelect

Default = "All".

Choose "All" or paramSet from "energy", "electricity", "transport", "water" , "socioecon" ,"ag" , "livestock" ,"land" ,"emissions".

Or pick an individual param from the list:

# energy "energyPrimaryByFuelEJ","energyPrimaryRefLiqProdEJ", "energyFinalConsumBySecEJ","energyFinalByFuelBySectorEJ","energyFinalSubsecByFuelTranspEJ", "energyFinalSubsecByFuelBuildEJ", "energyFinalSubsecByFuelIndusEJ","energyFinalSubsecBySectorBuildEJ", "energyPrimaryByFuelMTOE","energyPrimaryRefLiqProdMTOE", "energyFinalConsumBySecMTOE","energyFinalbyFuelMTOE","energyFinalSubsecByFuelTranspMTOE", "energyFinalSubsecByFuelBuildMTOE", "energyFinalSubsecByFuelIndusMTOE","energyFinalSubsecBySectorBuildMTOE", "energyPrimaryByFuelTWh","energyPrimaryRefLiqProdTWh", "energyFinalConsumBySecTWh","energyFinalbyFuelTWh","energyFinalSubsecByFuelTranspTWh", "energyFinalSubsecByFuelBuildTWh", "energyFinalSubsecByFuelIndusTWh","energyFinalSubsecBySectorBuildTWh",

# electricity "elecByTechTWh","elecCapByFuel","elecFinalBySecTWh","elecFinalByFuelTWh", "elecNewCapCost","elecNewCapGW","elecAnnualRetPrematureCost","elecAnnualRetPrematureGW","elecCumCapCost","elecCumCapGW","elecCumRetPrematureCost","elecCumRetPrematureGW",

# transport "transportPassengerVMTByMode", "transportFreightVMTByMode", "transportPassengerVMTByFuel", "transportFreightVMTByFuel",

# water "watConsumBySec", "watWithdrawBySec", "watWithdrawByCrop", "watBioPhysCons", "watIrrWithdrawBasin","watIrrConsBasin",

# socioecon "gdpPerCapita", "gdp", "gdpGrowthRate", "pop",

# ag "agProdbyIrrRfd", "agProdBiomass", "agProdForest","agProdByCrop",

# livestock "livestock_MeatDairybyTechMixed","livestock_MeatDairybyTechPastoral","livestock_MeatDairybyTechImports", "livestock_MeatDairybySubsector",

# land "landIrrRfd", "landIrrCrop","landRfdCrop", "landAlloc","landAllocByCrop",

# emissions "emissLUC", "emissNonCO2BySectorGWPAR5","emissNonCO2BySectorGTPAR5","emissNonCO2BySectorOrigUnits", "emissNonCO2ByResProdGWPAR5", "emissBySectorGWPAR5FFI","emissMethaneBySourceGWPAR5", "emissByGasGWPAR5FFI", "emissByGasGWPAR5LUC", "emissBySectorGWPAR5LUC", "emissNonCO2ByResProdGTPAR5", "emissBySectorGTPAR5FFI","emissMethaneBySourceGTPAR5", "emissByGasGTPAR5FFI", "emissByGasGTPAR5LUC","emissBySectorGTPAR5LUC", "emissCO2BySectorNoBio"

folderName

Default = NULL

nameAppend

Default="". Name to append to saved files.

saveData

Default = "T". Set to F if do not want to save any data to file.

Value

A list with the scenarios in the gcam database, queries in the queryxml file and a tibble with gcam data formatted for metis charts aggregated to different categories. These include data, dataAggParam, dataAggClass1, dataAggClass2.