Create a drake plan for societal exergy analysis
get_plan.RdCreates a drake workflow for societal exergy analysis. The caller specifies location of IEA data, which countries should be analyzed, and which the maximum year to be analyzed.
Usage
get_plan(
countries,
additional_exemplar_countries = NULL,
max_year,
how_far = "all_targets",
iea_data_path,
country_concordance_path,
phi_constants_path,
ceda_data_folder,
machine_data_path,
exemplar_table_path,
fu_analysis_folder,
reports_source_folders,
reports_dest_folder,
pipeline_caches_folder,
pipeline_releases_folder,
release = FALSE
)Arguments
- countries
A vector of abbreviations for countries whose energy conversion chain is to be analyzed, such as "c('GHA', 'ZAF')". Countries named in
countriescan also serve as exemplars for final-to-useful allocations and efficiencies.- additional_exemplar_countries
A vector of country abbreviations for which final-to-useful allocations and efficiencies will be read. An energy conversion chain will not be constructed for these countries. However, their final-to-useful allocations and efficiencies may be used as exemplar information for the countries in
countries. Default isNULL, indicating no additional exemplars.- max_year
The last year to be studied, typically the last year for which data are available.
- how_far
A string indicating the last target to include in the plan that is returned. Default is "all_targets" to indicate all targets of the plan should be returned.
- iea_data_path
The path to IEA extended energy balance data in .csv format.
- country_concordance_path
The path to the country concordance Excel file.
- phi_constants_path
The path to a phi (exergy-to-energy ratio) Excel file.
- ceda_data_folder
The path to the CEDA data in text file, .per, format.
- machine_data_path
The path to the machine data in .xlsx format.
- exemplar_table_path
The path to an exemplar table.
- fu_analysis_folder
The path to a folder containing final-to-useful analyses. Sub-folders named with 3-letter country abbreviations are assumed.
- reports_source_folders
A string vector containing paths to folders of report sources, usually
.Rnwor.Rmdfiles.- reports_dest_folder
The path to a folder into which reports are written.
- pipeline_caches_folder
The path to a folder where .zip files of the pipeline cache folders are stored.
- pipeline_releases_folder
The path to a folder where releases of important targets are stored for later retrieval as pinned items on a pinboard..
- release
A boolean that tells whether a new release of the
PSUTtarget should be made. Default isFALSE.
Details
The return value is a drake plan object with the following targets:
countries: The countries to be analyzed, supplied in thecountriesargument.alloc_and_eff_couns: The full set of countries for which final-to-useful allocations and efficiencies will be read. This is the sum ofcountriesandadditional_exemplar_countries, with duplicates removed.max_year: The maximum year to be analyzed, supplied in themax_yearargument.iea_data_path: The path to IEA extended energy balance data, supplied in theiea_data_pathargument.country_concordance_path: The path to the country concordance file, supplied in thecountry_concordance_pathargument.phi_constants_path: The path to a phi (exergy-to-energy ratio) file, supplied in thephi_constants_pathargument.ceda_data_folder: The path to the CEDA data, supplied in theceda_data_folderargument.machine_data_path: The path to the machine data excel files, supplied in themachine_data_pathargument.exemplar_table_path: The path to an exemplar table, supplied in theexemplar_table_pathargument.fu_analysis_folder: The path to the final-to-useful analysis folder, supplied in thefu_analysis_folderargument.report_output_folder: The path to a report output folder, supplied in thereport_output_folderargument.CountryConcordanceTable: A data frame containing concordance information which maps full country names to custom 3 letter codes.AllIEAData: A data frame with all IEA extended energy balance data read fromiea_data_path.IEAData: A version of theAllIEADatadata frame containing data for only those countries specified incountries.CEDAData: A data frame containing temperature data supplied throughCEDATools::read_cru_cy_files.AllMachineData: A data frame containing Eta.fu values read through functions inmachine_functions.R.MachineData: A filtered version ofAllMachineDatacontaining information for onlyalloc_and_eff_couns.balanced_before: A boolean that tells where the data were balanced as received, usually a vector ofFALSE, one for each country.BalancedIEAData: A data frame containing balanced IEA extended energy balance data.balanced_after: A boolean telling whether IEA extended energy balance data is balanced after balancing, usually a vector ofTRUE, one for each country.OKToProceed:NULLmeans everything is balanced and proceeding is OK.Specified: A data frame with specified industries. SeeIEATools::specify_all().PSUT_final: A data frame containing PSUT matrices up to the final stage.ExemplarLists: A data frame containing lists of exemplar countries on a per-country, per-year basis.
Phi_constants: A table of reasonable constant values for phi, the energy-to-exergy ratio.
IncompleteAllocationTables: A data frame containing final-to-useful allocation tables.TidyIncompleteAllocationTables: A data frame containing final-to-useful allocation tables.CompletedAllocationTables: A data frame containing completed final-to-useful allocation tables.CompletedEfficiencyTables: A data frame containing completed final-to-useful efficiency tables.CompletedPhiTables: A data frame of completed exergy-to-energy ratios.Cmats: A data frame containingCompletedAllocationTablesin matrix form.EtaPhivecs: A data frame containing final-to-useful efficiency and exergy-to-energy ratio vectors.PSUT_useful: A data frame containing PSUT matrices up to the useful stage.FinalDemandSectors: A list of final demand sectors, supplied through theget_fd_sectorsfunction.PrimaryIndustryPrefixes: A string vector of primary industry prefixes, supplied through theget_p_industry_prefixesfunction.AggregatePrimaryData: A data frame containing aggregate primary energy and exergy values by total, product, and flow.AggregateFinalUsefulData: A data frame containing aggregate final and useful energy and exergy values by total, product, and sector.SocioEconData: A data frame containing socioeconomic data, supplied by theget_L_K_GDP_datafunction.AllocationGraphs: A data frame containing allocation plots.NonStationaryAllocationGraphs: A data frame containing allocation plots for non-stationary data only.EfficiencyGraphs: A data frame containing final-to-useful efficiency plots.ExergyEnergyGraphs: A data frame containing exergy-to-energy ratio plots.report_source_paths: A string vector of paths to sources for reports.report_dest_paths: A string for the path to a folder into which reports will written.reports_complete: A boolean that tells whether reports were written successfully.
Callers can execute the plan by calling drake::make(plan).
Results can be recovered with
drake::readd(target = iea_data_path) or similar.
Note that some targets can be read using readd_by_country(), including:
AllIEAData,IEAData,BalancedIEAData,Specified,PSUT_final,ExemplarLists,IncompleteAllocationTables,CompletedAllocationTables,IncompleteEfficiencyTables, andCompletedEfficiencyTables,
Examples
get_plan(countries = c("GHA", "ZAF"),
max_year = 1999,
iea_data_path = "iea_path",
country_concordance_path = "country_concordance_path",
phi_constants_path = "phi_constants_path",
ceda_data_folder = "ceda_path",
machine_data_path = "machine_path",
exemplar_table_path = "exemplar_path",
fu_analysis_folder = "fu_folder",
reports_source_folders = "reports_source_folders",
reports_dest_folder = "reports_dest_folder",
pipeline_caches_folder = "pipeline_caches_folder",
pipeline_releases_folder = "pipeline_releases_folder")
#> # A tibble: 51 × 3
#> target command dynamic
#> <chr> <expr_lst> <expr_lst>
#> 1 countries c(c("GHA", "ZAF")) NA
#> 2 alloc_and_eff_couns unique(c(countries, NULL)) NA
#> 3 max_year 1999 NA
#> 4 iea_data_path "iea_path" NA
#> 5 country_concordance_path "country_concordance_path" NA
#> 6 phi_constants_path "phi_constants_path" NA
#> 7 ceda_data_folder "ceda_path" NA
#> 8 machine_data_path "machine_path" NA
#> 9 exemplar_table_path "exemplar_path" NA
#> 10 fu_analysis_folder "fu_folder" NA
#> # … with 41 more rows