This function produces charts given any number of tables in the metis format. The metis.chart() function produces charts for each region nd scenario. If there are more than one scenario then the function also produces a folder for diffplots. The input tables should be .csv files with the following columns: scenario, region, sources, param, x, xLabel, vintage, class1, class2, units, value, aggregate, classLabel1,classPalette1,classLabel2,classPalette2. Running the metis.readgcam automatically produces An empty template with these columns for the relevant parameters. Each column is defined below:
metis.chartsProcess( dataTables = NULL, rTable = NULL, scenRef = NULL, dirOutputs = paste(getwd(), "/outputs", sep = ""), pdfpng = "png", xRange = "All", xCompare = c("2015", "2030", "2050", "2100"), paramsSelect = "All", regionsSelect = "All", xData = "x", yData = "value", xLabel = "xLabel", yLabel = "units", aggregate = "sum", class = "class", classPalette = "pal_metis", regionCompare = 1, regionCompareOnly = 0, scenarioCompareOnly = 0, useNewLabels = 0, sizeBarLines = 0, sizeLines = 1.5, folderName = "folderNameDefault", facetBGColor = "grey30", facetBorderColor = "black", facetLabelColor = "white", facetLabelSize = 24, nameAppend = "", scensSelect = "All", xOrder = NULL, colOrder1 = NULL, colOrderName1 = NULL, colOrder2 = NULL, colOrderName2 = NULL, scaleRange = NULL, xScenCompFacetLabelSize = 35, legendPosition = "right", figWidth = 13, figHeight = 9, pointsOn = T, multiPlotOn = F, multiPlotFigsOnly = F, multiPlotFigLabels = T, multiPlotAllYears = F, mp = list(paramSet = list(c("energy"), c("water")), param = list(c("elecCapByFuel", "elecByTechTWh"), c("watWithdrawBySec", "watConsumBySec")), nColMax = list(c(3), c(3))), facetCols = 3, diffText = "_diff", diffPrcntText = "_diff_prcnt", theme_custom = NULL, panelBGcolor = NULL, plotBGcolor = "transparent", legendBGcolor = NULL, yMinDefault = 0, yMaxDefault = NULL, yMaxDiffAbsDefault = NULL, yMinDiffAbsDefault = NULL, yMaxDiffPrcntDefault = NULL, yMinDiffPrcntDefault = NULL )
dataTables | Vector of strings with full path to datatables to be read in. Example c("D:/metis/outputs/Colombia/dataTable_Colombia_1975to2100.csv", "D:/metis/outputs/Colombia/dataTableLocal_Colombia_1975to2100.csv"). Where "dataTableLocal_Colombia_1975to2100.csv" is the new datafile created based on "dataTableTemplate_Colombia_1975to2100.csv" and contains new local data. |
---|---|
rTable | If a table is created directly in R as a data.frame or tibble it can entered here. |
scenRef | The reference scenario to compare against. Default will pick first scenario from list f all scenarios |
dirOutputs | Full path to directory for outputs. Default is paste(getwd(),"/outputs",sep="") |
pdfpng | Choose the format for outputs. Either "pdf", "png" or "both. Default is "png" |
xRange | Default "All". Range of x values eg. c(2001:2005) |
xCompare | Choose the years to compare scenarios for xScenSelectYears plot. Default is c("2015","2030","2050","2100") |
paramsSelect | Default = "All". If desired dplyr::select a subset of paramaters to analyze from the full list of parameters: c(# 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", # transport "transportPassengerVMTByMode", "transportFreightVMTByMode", "transportPassengerVMTByFuel", "transportFreightVMTByFuel", # water "watConsumBySec", "watWithdrawBySec", "watWithdrawByCrop", "watBioPhysCons", "watIrrWithdrawBasin","watIrrConsBasin", # socioecon "gdpPerCapita", "gdp", "gdpGrowthRate", "pop", # ag "agProdbyIrrRfd","agProdBiomass", "agProdForest", "agProdByCrop", # land "landIrrRfd", "landAlloc","landAllocByCrop", # emissions "emissLUC", "emissCO2BySector","emissCO2NonCO2BySectorGWPAR5","emissCO2NonCO2BySectorGTPAR5","emissNonCO2BySectorOrigUnits", "emissNonCO2ByResProdGWPAR5", "emissTotalFFIBySec","emissMethaneBySource", "emissCO2BySectorNonCO2GWPAR5", "emissCO2BySectorNonCO2GWPAR5LUC", "emissTotalBySec","emissCO2BySectorNoBio") |
regionsSelect | Default = "All". Select regions to create charts for. |
xData | Default "x" |
yData | Default "value" |
xLabel | Default "xLabel" |
yLabel | Default "units" |
aggregate | Default "sum" |
class | Default "class" |
classPalette | Default "pal_metis" from metis.colors()$pal_metis |
regionCompare | Default =1. To turn of regional comparison make 0. |
regionCompareOnly | Default 0. If set to 1, will only run comparison plots and not individual |
scenarioCompareOnly | Default 0. If set to 1, will only run comparison plots and not individual |
useNewLabels | Default 0 |
sizeBarLines | Default 0.5 |
sizeLines | Default 1.5 |
folderName | Default ="folderNameDefault" |
facetBGColor | Default ="grey30", |
facetBorderColor | Default ="black", |
facetLabelColor | Default = "white", |
facetLabelSize | Default =24 |
nameAppend | Default ="" |
scensSelect | Default = "All". Select regions to create charts for. |
xOrder | Default = NULL, |
colOrder1 | Default = NULL, |
colOrderName1 | Default = NULL, |
colOrder2 | Default = NULL, |
colOrderName2 | Default = NULL, |
scaleRange | Default NULL. Dataframe with columns param, maxScale, minScale to indicate maximum and minumum values for a parameter scale. |
xScenCompFacetLabelSize | Default = 2 |
legendPosition | Default="right" ("none", "left", "right", "bottom", "top", or two-element numeric vector) |
figWidth | Default = 13 |
figHeight | Default = 9 |
pointsOn | Default =T |
multiPlotOn | Default=F, |
multiPlotFigsOnly | Default = F. Plot only multiplot figs. Much faster. |
multiPlotFigLabels | Default = T. AutoPlot Labels |
multiPlotAllYears | Default=F |
mp | This is a list with the paramSet and related params plus the max number of rows desired for summary plots. |
facetCols | Default=3 |
diffText | Default = "_diff", |
diffPrcntText | Default = "_diff_prcnt" |
theme_custom | Default = NULL, "theme_gray","theme_bw","theme_linedraw","theme_light", "theme_minimal","theme_classic","theme_void","theme_dark" |
panelBGcolor | Default = NULL, |
plotBGcolor | Default = "transparent", |
legendBGcolor | Default = NULL |
yMinDefault | Default = NULL, |
yMaxDefault | Default = NULL |
yMaxDiffAbsDefault | Default = NULL, |
yMinDiffAbsDefault | Default = NULL |
yMaxDiffPrcntDefault | Default = NULL, |
yMinDiffPrcntDefault | Default = NULL |
Produces charts in output folder and also returns combined table in metis format.
List of Assumptions
scenario: The name of the new data scenario
region: The region for the data
sources: Sources for the data
param: Name of the parameter
x: The x axis variable values
xLabel: X axis Label
vintage: Vintages if any. If not relevant then just enter "Vintage"
class1: Classes or types (eg. if param is water_demands then the classes may be Industry, Agriculture etc.)
class2: A second category of classes if exists.
units: Units for the parameter. These are used as the y axis label.
value: The parameter value.
aggregate: Either "sum" or "mean". This paramater is used to determine how to aggregate across regions or scenarios.
classLabel1: If class1 exists then this will be legend Label. If it doesnt exist enter "classLabel1"
classPalette1: An R or metis.colors() palette. Can leave the default as "pal_16".
classLabel2: If class2 exists then this will be legend Label. If it doesnt exist enter "classLabel2"
classPalette2: An R or metis.colors() palette. Can leave the default as "pal_16".