-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathreadIEA_ETP.R
567 lines (561 loc) · 29.5 KB
/
readIEA_ETP.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
#' Read IEA ETP projections
#'
#' @author Falk Benke
#' @param subtype data subtype. Either "industry", "buildings", "summary", or "transport"
#' @importFrom tibble tibble
#' @importFrom dplyr bind_rows select mutate
#' @importFrom readxl read_xlsx
#'
readIEA_ETP <- function(subtype) {
# nolint start
subtypes <- list(
industry = {
list(
file = "ETP2017_industry_summary.xlsx",
prefix = "Industry",
sheets = list(
"WORLD", "OECD", "Non-OECD",
"ASEAN", "Brazil", "China", "European Union",
"India", "Mexico", "Russia", "South Africa", "United States"
),
scenarios = list(
"RTS" = "B4:K110",
"2DS" = "O4:X110",
"B2DS" = "AB4:AK110"
),
rows = tibble(
name = {
c(
NA,
"Total industry final energy consumption|Coal (PJ)",
"Total industry final energy consumption|Oil (PJ)",
"Total industry final energy consumption|Natural gas (PJ)",
"Total industry final energy consumption|Electricity (PJ)",
"Total industry final energy consumption|Heat (PJ)",
"Total industry final energy consumption|Biomass (PJ)",
"Total industry final energy consumption|Waste (PJ)",
"Total industry final energy consumption|Other renewables (PJ)",
"Total industry final energy consumption|Total (PJ)",
NA,
NA,
"CO2 emissions|Total CO2 emissions (MtCO2)",
"CO2 emissions|CO2 captured (MtCO2)",
NA,
NA,
"Cement - final energy consumption|Coal (PJ)",
"Cement - final energy consumption|Oil (PJ)",
"Cement - final energy consumption|Natural gas (PJ)",
"Cement - final energy consumption|Electricity (PJ)",
"Cement - final energy consumption|Heat (PJ)",
"Cement - final energy consumption|Biomass (PJ)",
"Cement - final energy consumption|Waste (PJ)",
"Cement - final energy consumption|Other renewables (PJ)",
"Cement - final energy consumption|Total (PJ)",
NA,
NA,
"Chemicals and petrochemicals - final energy consumption and chemical feedstock|Coal (PJ)",
"Chemicals and petrochemicals - final energy consumption and chemical feedstock|Oil (PJ)",
"Chemicals and petrochemicals - final energy consumption and chemical feedstock|Natural gas (PJ)",
"Chemicals and petrochemicals - final energy consumption and chemical feedstock|Electricity (PJ)",
"Chemicals and petrochemicals - final energy consumption and chemical feedstock|Heat (PJ)",
"Chemicals and petrochemicals - final energy consumption and chemical feedstock|Biomass (PJ)",
"Chemicals and petrochemicals - final energy consumption and chemical feedstock|Waste (PJ)",
"Chemicals and petrochemicals - final energy consumption and chemical feedstock|Other renewables (PJ)",
"Chemicals and petrochemicals - final energy consumption and chemical feedstock|Total (PJ)",
NA,
NA,
"Chemicals and petrochemicals - feedstocks|Coal (PJ)",
"Chemicals and petrochemicals - feedstocks|Oil (PJ)",
"Chemicals and petrochemicals - feedstocks|Natural gas (PJ)",
"Chemicals and petrochemicals - feedstocks|Electricity (PJ)",
"Chemicals and petrochemicals - feedstocks|Heat (PJ)",
"Chemicals and petrochemicals - feedstocks|Biomass (PJ)",
"Chemicals and petrochemicals - feedstocks|Waste (PJ)",
"Chemicals and petrochemicals - feedstocks|Other renewables (PJ)",
"Chemicals and petrochemicals - feedstocks|Total (PJ)",
NA,
NA,
"Iron and steel - final energy consumption incl. blast furnaces and coke ovens|Coal (PJ)",
"Iron and steel - final energy consumption incl. blast furnaces and coke ovens|Oil (PJ)",
"Iron and steel - final energy consumption incl. blast furnaces and coke ovens|Natural gas (PJ)",
"Iron and steel - final energy consumption incl. blast furnaces and coke ovens|Electricity (PJ)",
"Iron and steel - final energy consumption incl. blast furnaces and coke ovens|Heat (PJ)",
"Iron and steel - final energy consumption incl. blast furnaces and coke ovens|Biomass (PJ)",
"Iron and steel - final energy consumption incl. blast furnaces and coke ovens|Waste (PJ)",
"Iron and steel - final energy consumption incl. blast furnaces and coke ovens|Other renewables (PJ)",
"Iron and steel - final energy consumption incl. blast furnaces and coke ovens|Total (PJ)",
NA,
NA,
"Iron and steel - blast furnaces and coke ovens|Coal (PJ)",
"Iron and steel - blast furnaces and coke ovens|Oil (PJ)",
"Iron and steel - blast furnaces and coke ovens|Natural gas (PJ)",
"Iron and steel - blast furnaces and coke ovens|Electricity (PJ)",
"Iron and steel - blast furnaces and coke ovens|Heat (PJ)",
"Iron and steel - blast furnaces and coke ovens|Biomass (PJ)",
"Iron and steel - blast furnaces and coke ovens|Waste (PJ)",
"Iron and steel - blast furnaces and coke ovens|Other renewables (PJ)",
"Iron and steel - blast furnaces and coke ovens|Total (PJ)",
NA,
NA,
"Pulp and paper - final energy consumption|Coal (PJ)",
"Pulp and paper - final energy consumption|Oil (PJ)",
"Pulp and paper - final energy consumption|Natural gas (PJ)",
"Pulp and paper - final energy consumption|Electricity (PJ)",
"Pulp and paper - final energy consumption|Heat (PJ)",
"Pulp and paper - final energy consumption|Biomass (PJ)",
"Pulp and paper - final energy consumption|Waste (PJ)",
"Pulp and paper - final energy consumption|Other renewables (PJ)",
"Pulp and paper - final energy consumption|Total (PJ)",
NA,
NA,
"Aluminium - final energy consumption|Coal (PJ)",
"Aluminium - final energy consumption|Oil (PJ)",
"Aluminium - final energy consumption|Natural gas (PJ)",
"Aluminium - final energy consumption|Electricity (PJ)",
"Aluminium - final energy consumption|Heat (PJ)",
"Aluminium - final energy consumption|Biomass (PJ)",
"Aluminium - final energy consumption|Waste (PJ)",
"Aluminium - final energy consumption|Other renewables (PJ)",
"Aluminium - final energy consumption|Total (PJ)",
NA,
NA,
"Sub-sector CO2 emissions|Cement (MtCO2)",
"Sub-sector CO2 emissions|Chemicals and petrochemicals (MtCO2)",
"Sub-sector CO2 emissions|Iron and steel (MtCO2)",
"Sub-sector CO2 emissions|Pulp and paper (MtCO2)",
"Sub-sector CO2 emissions|Aluminium (MtCO2)",
NA,
NA,
"Materials production|Cement (Mt)",
"Materials production|High value chemicals (Mt)",
"Materials production|Ammonia (Mt)",
"Materials production|Methanol (Mt)",
"Materials production|Crude steel (Mt)",
"Materials production|Paper and paperboard (excl. recovered paper) (Mt)",
"Materials production|Total aluminium (primary and secondary) (Mt)"
)
}
) %>%
tidyr::extract("name", c("variable", "unit"), "^(.*) \\((.*)\\)$")
)
},
buildings = {
list(
file = "ETP2017_buildings_summary.xlsx",
prefix = "Buildings",
sheets = list(
"WORLD", "OECD", "NonOECD",
"ASEAN", "Brazil", "China", "European Union",
"India", "Mexico", "Russia", "South Africa", "United States"
),
scenarios = list(
"RTS" = "B4:K109",
"2DS" = "O4:X109",
"B2DS" = "AB4:AK109"
),
rows = tibble(
name = {
c(
NA,
"Buildings - Total final energy consumption|Coal (PJ)",
"Buildings - Total final energy consumption|Oil products (PJ)",
"Buildings - Total final energy consumption|Natural gas (PJ)",
"Buildings - Total final energy consumption|Electricity (PJ)",
"Buildings - Total final energy consumption|Biomass, waste and other renewables (PJ)",
"Buildings - Total final energy consumption|Commercial heat (PJ)",
"Buildings - Total final energy consumption|Total (PJ)",
NA,
NA,
"Buildings - Total final energy consumption by end-use|Space heating (PJ)",
"Buildings - Total final energy consumption by end-use|Water heating (PJ)",
"Buildings - Total final energy consumption by end-use|Space cooling (PJ)",
"Buildings - Total final energy consumption by end-use|Lighting (PJ)",
"Buildings - Total final energy consumption by end-use|Appliances and miscellaneous equipments (PJ)",
"Buildings - Total final energy consumption by end-use|Cooking (PJ)",
"Buildings - Total final energy consumption by end-use|Total (PJ)",
NA,
NA,
"Buildings - Total emissions by fuel|Coal (MtCO2)",
"Buildings - Total emissions by fuel|Oil products (MtCO2)",
"Buildings - Total emissions by fuel|Natural gas (MtCO2)",
"Buildings - Total emissions by fuel|Electricity (MtCO2)",
"Buildings - Total emissions by fuel|Biomass, waste and other renewables (MtCO2)",
"Buildings - Total emissions by fuel|Commercial heat (MtCO2)",
"Buildings - Total emissions by fuel|Total (MtCO2)",
NA,
NA,
"Buildings - Total emissions by end-use|Space heating (MtCO2)",
"Buildings - Total emissions by end-use|Water heating (MtCO2)",
"Buildings - Total emissions by end-use|Space cooling (MtCO2)",
"Buildings - Total emissions by end-use|Lighting (MtCO2)",
"Buildings - Total emissions by end-use|Appliances and miscellaneous equipments (MtCO2)",
"Buildings - Total emissions by end-use|Cooking (MtCO2)",
"Buildings - Total emissions by end-use|Total (MtCO2)",
NA,
NA,
"Residential - Total final energy consumption|Coal (PJ)",
"Residential - Total final energy consumption|Oil products (PJ)",
"Residential - Total final energy consumption|Natural gas (PJ)",
"Residential - Total final energy consumption|Electricity (PJ)",
"Residential - Total final energy consumption|Biomass, waste and other renewables (PJ)",
"Residential - Total final energy consumption|Commercial heat (PJ)",
"Residential - Total final energy consumption|Total (PJ)",
NA,
NA,
"Residential - Total final energy consumption by end-use|Space heating (PJ)",
"Residential - Total final energy consumption by end-use|Water heating (PJ)",
"Residential - Total final energy consumption by end-use|Space cooling (PJ)",
"Residential - Total final energy consumption by end-use|Lighting (PJ)",
"Residential - Total final energy consumption by end-use|Appliances and miscellaneous equipments (PJ)",
"Residential - Total final energy consumption by end-use|Cooking (PJ)",
"Residential - Total final energy consumption by end-use|Total (PJ)",
NA,
NA,
"Residential - Total emissions by fuel|Coal (MtCO2)",
"Residential - Total emissions by fuel|Oil products (MtCO2)",
"Residential - Total emissions by fuel|Natural gas (MtCO2)",
"Residential - Total emissions by fuel|Electricity (MtCO2)",
"Residential - Total emissions by fuel|Biomass, waste and other renewables (MtCO2)",
"Residential - Total emissions by fuel|Commercial heat (MtCO2)",
"Residential - Total emissions by fuel|Total (MtCO2)",
NA,
NA,
"Residential - Total emissions by end-use|Space heating (MtCO2)",
"Residential - Total emissions by end-use|Water heating (MtCO2)",
"Residential - Total emissions by end-use|Space cooling (MtCO2)",
"Residential - Total emissions by end-use|Lighting (MtCO2)",
"Residential - Total emissions by end-use|Appliances and miscellaneous equipments (MtCO2)",
"Residential - Total emissions by end-use|Cooking (MtCO2)",
"Residential - Total emissions by end-use|Total (MtCO2)",
NA,
NA,
"Services - Total final energy consumption|Coal (PJ)",
"Services - Total final energy consumption|Oil products (PJ)",
"Services - Total final energy consumption|Natural gas (PJ)",
"Services - Total final energy consumption|Electricity (PJ)",
"Services - Total final energy consumption|Biomass, waste and other renewables (PJ)",
"Services - Total final energy consumption|Commercial heat (PJ)",
"Services - Total final energy consumption|Total (PJ)",
NA,
NA,
"Services - Total final energy consumption by end-use|Space heating (PJ)",
"Services - Total final energy consumption by end-use|Water heating (PJ)",
"Services - Total final energy consumption by end-use|Space cooling (PJ)",
"Services - Total final energy consumption by end-use|Lighting (PJ)",
"Services - Total final energy consumption by end-use|Appliances and miscellaneous equipments (PJ)",
"Services - Total final energy consumption by end-use|Cooking (PJ)",
"Services - Total final energy consumption by end-use|Total (PJ)",
NA,
NA,
"Services - Total final energy consumption by end-use|Coal (MtCO2)",
"Services - Total final energy consumption by end-use|Oil products (MtCO2)",
"Services - Total final energy consumption by end-use|Natural gas (MtCO2)",
"Services - Total final energy consumption by end-use|Electricity (MtCO2)",
"Services - Total final energy consumption by end-use|Biomass, waste and other renewables (MtCO2)",
"Services - Total final energy consumption by end-use|Commercial heat (MtCO2)",
"Services - Total final energy consumption by end-use|Total (MtCO2)",
NA,
NA,
"Services - Total emissions by end-use|Space heating (MtCO2)",
"Services - Total emissions by end-use|Water heating (MtCO2)",
"Services - Total emissions by end-use|Space cooling (MtCO2)",
"Services - Total emissions by end-use|Lighting (MtCO2)",
"Services - Total emissions by end-use|Appliances and miscellaneous equipments (MtCO2)",
"Services - Total emissions by end-use|Total (MtCO2)"
)
}
) %>%
tidyr::extract("name", c("variable", "unit"), "^(.*) \\((.*)\\)$")
)
},
summary = {
list(
file = "ETP2017_scenario_summary.xlsx",
prefix = "Summary",
sheets = list(
"WORLD", "OECD", "NonOECD",
"ASEAN", "Brazil", "China", "European Union",
"India", "Mexico", "Russia", "South Africa", "United States"
),
scenarios = list(
"RTS" = "B4:K154",
"2DS" = "O4:X154",
"B2DS" = "AB4:AK154"
),
rows = tibble(
name = {
c(
NA,
"Total primary energy demand|Oil (PJ)",
"Total primary energy demand|Coal (PJ)",
"Total primary energy demand|Natural gas (PJ)",
"Total primary energy demand|Nuclear (PJ)",
"Total primary energy demand|Biomass and waste (PJ)",
"Total primary energy demand|Hydro (PJ)",
"Total primary energy demand|Other (PJ)",
"Total primary energy demand|Total (PJ)",
"Total primary energy demand|Memo: Biofuels and waste (excl. conversion losses of liquid and gaseous biofuels production) (PJ)",
NA,
NA,
"Fuel input electricity and heat generation|Oil (PJ)",
"Fuel input electricity and heat generation|Coal (PJ)",
"Fuel input electricity and heat generation|Natural gas (PJ)",
"Fuel input electricity and heat generation|Nuclear (PJ)",
"Fuel input electricity and heat generation|Biomass and waste (PJ)",
"Fuel input electricity and heat generation|Hydro (PJ)",
"Fuel input electricity and heat generation|Geothermal (PJ)",
"Fuel input electricity and heat generation|Wind (PJ)",
"Fuel input electricity and heat generation|Solar PV (PJ)",
"Fuel input electricity and heat generation|Solar CSP (PJ)",
"Fuel input electricity and heat generation|Ocean (PJ)",
"Fuel input electricity and heat generation|Hydrogen (PJ)",
"Fuel input electricity and heat generation|Other (PJ)",
"Fuel input electricity and heat generation|Total (PJ)",
NA,
NA,
"Final energy demand|Oil (PJ)",
"Final energy demand|Coal (PJ)",
"Final energy demand|Natural gas (PJ)",
"Final energy demand|Electricity (PJ)",
"Final energy demand|Heat (PJ)",
"Final energy demand|Biomass and waste (PJ)",
"Final energy demand|Hydrogen (PJ)",
"Final energy demand|Other (PJ)",
"Final energy demand|Total (PJ)",
NA,
NA,
"Final energy demand industry sector|Oil (PJ)",
"Final energy demand industry sector|Coal (PJ)",
"Final energy demand industry sector|Natural gas (PJ)",
"Final energy demand industry sector|Electricity (PJ)",
"Final energy demand industry sector|Heat (PJ)",
"Final energy demand industry sector|Biomass and waste (PJ)",
"Final energy demand industry sector|Hydrogen (PJ)",
"Final energy demand industry sector|Other (PJ)",
"Final energy demand industry sector|Total (PJ)",
NA,
NA,
"Final energy demand non-energy use|Total (PJ)",
NA,
NA,
"Final energy demand transport sector|Oil (PJ)",
"Final energy demand transport sector|Coal (PJ)",
"Final energy demand transport sector|Natural gas (PJ)",
"Final energy demand transport sector|Electricity (PJ)",
"Final energy demand transport sector|Biomass (PJ)",
"Final energy demand transport sector|Hydrogen (PJ)",
"Final energy demand transport sector|Total (PJ)",
NA,
NA,
"Final energy demand residential sector|Oil (PJ)",
"Final energy demand residential sector|Coal (PJ)",
"Final energy demand residential sector|Natural gas (PJ)",
"Final energy demand residential sector|Electricity (PJ)",
"Final energy demand residential sector|Heat (PJ)",
"Final energy demand residential sector|Biomass and waste (PJ)",
"Final energy demand residential sector|Hydrogen (PJ)",
"Final energy demand residential sector|Other (PJ)",
"Final energy demand residential sector|Total (PJ)",
NA,
NA,
"Final energy demand services sector|Oil (PJ)",
"Final energy demand services sector|Coal (PJ)",
"Final energy demand services sector|Natural gas (PJ)",
"Final energy demand services sector|Electricity (PJ)",
"Final energy demand services sector|Heat (PJ)",
"Final energy demand services sector|Biomass and waste (PJ)",
"Final energy demand services sector|Hydrogen (PJ)",
"Final energy demand services sector|Other (PJ)",
"Final energy demand services sector|Total (PJ)",
NA,
NA,
"Final energy demand agriculture, fisheries and forestry sector|Oil (PJ)",
"Final energy demand agriculture, fisheries and forestry sector|Coal (PJ)",
"Final energy demand agriculture, fisheries and forestry sector|Natural gas (PJ)",
"Final energy demand agriculture, fisheries and forestry sector|Electricity (PJ)",
"Final energy demand agriculture, fisheries and forestry sector|Heat (PJ)",
"Final energy demand agriculture, fisheries and forestry sector|Biomass and waste (PJ)",
"Final energy demand agriculture, fisheries and forestry sector|Hydrogen (PJ)",
"Final energy demand agriculture, fisheries and forestry sector|Other (PJ)",
"Final energy demand agriculture, fisheries and forestry sector|Total (PJ)",
NA,
NA,
"Gross electricity generation|Oil (TWh)",
"Gross electricity generation|Coal (TWh)",
"Gross electricity generation|Coal with CCS (TWh)",
"Gross electricity generation|Natural gas (TWh)",
"Gross electricity generation|Natural gas with CCS (TWh)",
"Gross electricity generation|Nuclear (TWh)",
"Gross electricity generation|Biomass and waste (TWh)",
"Gross electricity generation|Biomass with CCS (TWh)",
"Gross electricity generation|Hydro (excl. pumped storage) (TWh)",
"Gross electricity generation|Geothermal (TWh)",
"Gross electricity generation|Wind onshore (TWh)",
"Gross electricity generation|Wind offshore (TWh)",
"Gross electricity generation|Solar PV (TWh)",
"Gross electricity generation|Solar CSP (TWh)",
"Gross electricity generation|Ocean (TWh)",
"Gross electricity generation|Other (TWh)",
"Gross electricity generation|Total (TWh)",
NA,
NA,
"Gross electricity capacity|Oil (GW)",
"Gross electricity capacity|Coal (GW)",
"Gross electricity capacity|Coal with CCS (GW)",
"Gross electricity capacity|Natural gas (GW)",
"Gross electricity capacity|Natural gas with CCS (GW)",
"Gross electricity capacity|Nuclear (GW)",
"Gross electricity capacity|Biomass and waste (GW)",
"Gross electricity capacity|Biomass with CCS (GW)",
"Gross electricity capacity|Hydro (excl. pumped storage) (GW)",
"Gross electricity capacity|Geothermal (GW)",
"Gross electricity capacity|Wind onshore (GW)",
"Gross electricity capacity|Wind offshore (GW)",
"Gross electricity capacity|Solar PV (GW)",
"Gross electricity capacity|Solar CSP (GW)",
"Gross electricity capacity|Ocean (GW)",
"Gross electricity capacity|Other (GW)",
"Gross electricity capacity|Total (GW)",
NA,
NA,
"Direct CO2 emissions|Industry (Mt CO2)",
"Direct CO2 emissions|Buildings, agriculture, fishing, non-specified other (Mt CO2)",
"Direct CO2 emissions|Transport (Mt CO2)",
"Direct CO2 emissions|Power (Mt CO2)",
"Direct CO2 emissions|Other transformation (Mt CO2)",
"Direct CO2 emissions|Total (Mt CO2)",
NA,
NA,
"CO2 captured|Industry (Mt CO2)",
"CO2 captured|Power (Mt CO2)",
"CO2 captured|Other transformation (Mt CO2)",
"CO2 captured|Total (Mt CO2)",
NA,
NA,
"BECCS, CO2 captured|Industry (Mt CO2)",
"BECCS, CO2 captured|Power (Mt CO2)",
"BECCS, CO2 captured|Other transformation (Mt CO2)",
"BECCS, CO2 captured|Total (Mt CO2)"
)
}
) %>%
tidyr::extract("name", c("variable", "unit"), "^(.*) \\((.*)\\)$")
)
},
transport = {
list(
file = "ETP2017_transport_summary.xlsx",
prefix = "Transport",
sheets = list(
"WORLD", "OECD", "Non-OECD",
"ASEAN", "Brazil", "China", "European Union",
"India", "Mexico", "Russia", "South Africa", "United States"
),
scenarios = list(
"RTS" = "B4:K49",
"2DS" = "O4:X49",
"B2DS" = "AB4:AK49"
),
rows = tibble(
name = {
c(
NA,
"Total final energy consumption|Conventional gasoline (PJ)",
"Total final energy consumption|Conventional diesel (PJ)",
"Total final energy consumption|Jet fuel (PJ)",
"Total final energy consumption|Residual Fuel (PJ)",
"Total final energy consumption|Compressed natural gas and liquid petroleum gas (PJ)",
"Total final energy consumption|Electricity (PJ)",
"Total final energy consumption|Biofuels (PJ)",
"Total final energy consumption|Hydrogen (PJ)",
"Total final energy consumption|Total (PJ)",
NA,
NA,
"Passenger transport final energy consumption|Air (PJ)",
"Passenger transport final energy consumption|Light road (PJ)",
"Passenger transport final energy consumption|Heavy road (PJ)",
"Passenger transport final energy consumption|Rail (PJ)",
"Passenger transport final energy consumption|Shipping (PJ)",
"Passenger transport final energy consumption|Total (PJ)",
NA,
NA,
"Freight transport final energy consumption|Air (PJ)",
"Freight transport final energy consumption|Light road (PJ)",
"Freight transport final energy consumption|Heavy road (PJ)",
"Freight transport final energy consumption|Rail (PJ)",
"Freight transport final energy consumption|Shipping (PJ)",
"Freight transport final energy consumption|Total (PJ)",
NA,
NA,
"Well-to-wheel emissions by mode|Air (MtCO2)",
"Well-to-wheel emissions by mode|Light road (MtCO2)",
"Well-to-wheel emissions by mode|Heavy road (MtCO2)",
"Well-to-wheel emissions by mode|Rail (MtCO2)",
"Well-to-wheel emissions by mode|Shipping (MtCO2)",
"Well-to-wheel emissions by mode|Total (MtCO2)",
NA,
NA,
"Passenger kilometres|Air (billion)",
"Passenger kilometres|Light road (billion)",
"Passenger kilometres|Heavy road (billion)",
"Passenger kilometres|Rail (billion)",
"Passenger kilometres|Total (billion)",
NA,
NA,
"Freight tonne kilometres|Light road (billion)",
"Freight tonne kilometres|Heavy road (billion)",
"Freight tonne kilometres|Rail (billion)"
)
}
) %>%
tidyr::extract("name", c("variable", "unit"), "^(.*) \\((.*)\\)$")
)
}
)
# nolint end
# ---- guardians ----
if (!subtype %in% names(subtypes)) {
stop(
"Invalid subtype -- supported subtypes are: ",
paste(names(subtypes), collapse = ", ")
)
}
file <- file.path("1.1", subtypes[[subtype]]$file)
col_names <- c("rownames", "2014", "2025", "2030", "2035", "2040", "2045", "2050", "2055", "2060")
col_types <- c("text", rep("numeric", length(col_names) - 1))
tmp <- tibble()
for (sheet in subtypes[[subtype]]$sheets) {
for (scenario in names(subtypes[[subtype]]$scenarios)) {
tmp <- bind_rows(
tmp,
read_xlsx(
path = file, sheet = sheet, col_names = col_names,
col_types = col_types, range = subtypes[[subtype]]$scenarios[[scenario]]
) %>%
# add variable and unit columns
dplyr::bind_cols(subtypes[[subtype]]$rows) %>%
# drop unneeded rows
tidyr::drop_na("variable", "unit") %>%
# drop rownames from worksheet
select(-1) %>%
# add variable prefix
mutate("variable" = paste0(subtypes[[subtype]]$prefix, "|", !!sym("variable"))) %>%
tidyr::pivot_longer(
cols = c(-"variable", -"unit"), names_to = "year",
names_transform = list("year" = as.integer)
) %>%
mutate("region" = sheet, "scenario" = scenario)
)
}
}
tmp <- tmp %>%
select("region", "year", "scenario", "variable", "unit", "value") %>%
as.magpie(spatial = 1, temporal = 2, tidy = TRUE)
# set all 2055 data (for RTS/OECD/Chemicals with feedstocks) to NA due to faulty data in source
if (subtype == "industry") {
tmp[, 2055, "RTS.Industry|Chemicals and petrochemicals - final energy consumption and chemical feedstock|",
pmatch = TRUE
]["OECD", , ] <- NA
}
return(tmp)
}