Skip to content

Commit

Permalink
Finish up the PCe development and prepare for the squash merge
Browse files Browse the repository at this point in the history
  • Loading branch information
realxinzhao committed Jan 15, 2025
1 parent e0c1104 commit ed55c7e
Show file tree
Hide file tree
Showing 133 changed files with 814 additions and 337 deletions.
6 changes: 1 addition & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ Package: gcamfaostat
Type: Package
Title: Prepare, process, and synthesize FAOSTAT data for global agroeconomic and multisector dynamic modeling
Version: 1.1.0
Date: 2024-12-1
Date: 2025-11-11
Authors@R: c(person("Xin", "Zhao", email = "xin.zhao@pnnl.gov", role = c("cre", "aut"), comment = c(ORCID = "0000-0002-1801-4393")),
person("Maksym", "Chepeliev", role = "aut", comment = c(ORCID = "0000-0001-8585-2314")),
person("Pralit", "Patel", role = "aut", comment = c(ORCID = "0000-0003-3992-1061")),
person("Marshall", "Wise", role = "aut", comment = c(ORCID = "0000-0002-2718-0051")),
person("Kate", "Calvin", role = "aut", comment = c(ORCID = "0000-0003-2191-4189")),
person("Kanishka", "Narayan", role = "aut", comment = c(ORCID = "0000-0001-8483-6216")),
person("Chris", "Vernon", role = "aut", comment = c(ORCID = "0000-0002-3406-6214")),
person("Pacific Northwest National Laboratory", role = "cph"))
Description: Clean and balance agricultural input, trade, and supply-utilization data for GCAM and other global agroeconomic modeling.
License: BSD_2_clause + file LICENSE
Expand Down
26 changes: 15 additions & 11 deletions R/yfaostat_Traceable_FBS_DataExport.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ module_yfaostat_Traceable_FBS_DataExport <- function(command, ...) {

Curr_Envir <- environment()

# out_filename_suffix is appended to output file names, e.g., dates could be used
out_filename_suffix <- paste0("_", Sys.Date())
out_filename_suffix <- ""

# adding dummy output ----
Metadata_GCAMFAOSTAT_Traceable_FBS <-
tibble(CSV_export = MODULE_OUTPUTS)
Expand Down Expand Up @@ -113,7 +117,7 @@ module_yfaostat_Traceable_FBS_DataExport <- function(command, ...) {

output_csv_data(
gcam_dataset = Nested_Mapping_SUA_To_Traceable_FBS,
out_filename = "Nested_Mapping_SUA_To_Traceable_FBS" %>% paste0("_", Sys.Date()),
out_filename = "Nested_Mapping_SUA_To_Traceable_FBS" %>% paste0(out_filename_suffix),
col_type_nonyear = "ccicici",
title = "Mapping of SUA items to aggregated primary commodity equivalent products by level of nestings",
unit = "NA",
Expand Down Expand Up @@ -150,14 +154,14 @@ module_yfaostat_Traceable_FBS_DataExport <- function(command, ...) {

output_csv_data(
gcam_dataset = SUA_2010_2022,
out_filename = "SUA_2010_2022" %>% paste0("_", Sys.Date()),
out_filename = "SUA_2010_2022" %>% paste0(out_filename_suffix),
col_type_nonyear = "ccifc",
title = "Supply utilization accounts for all FAO items in 2010 - 2022",
unit = "1000 tonnes",
code = "SCL",
description = "Data is compiled and generated by gcamfaostat. Data is balanced in trade, supply_utilization, and storage",
out_dir = DIR_OUTPUT_CSV,
GZIP = F)
GZIP = T)

add_to_output_meta(.df = SUA_2010_2022, "SUA_2010_2022")

Expand All @@ -179,14 +183,14 @@ module_yfaostat_Traceable_FBS_DataExport <- function(command, ...) {

output_csv_data(
gcam_dataset = SUA_Food_Calorie_Macronutrient_2010_2022,
out_filename = "SUA_Food_Calorie_Macronutrient_2010_2022" %>% paste0("_", Sys.Date()),
out_filename = "SUA_Food_Calorie_Macronutrient_2010_2022" %>% paste0(out_filename_suffix),
col_type_nonyear = "ccicc",
title = "SUA: food energy and macronutrient in 2010 - 2022",
unit = "Mt or Mkcal",
code = "SCL",
description = "Data is compiled and generated by gcamfaostat. Food energy and macronutrient by iso and SUA items. Item and item code are based on FAO/gcamfaostat definitions",
out_dir = DIR_OUTPUT_CSV,
GZIP = F)
GZIP = T)

add_to_output_meta(.df = SUA_Food_Calorie_Macronutrient_2010_2022,
"SUA_Food_Calorie_Macronutrient_2010_2022")
Expand All @@ -208,14 +212,14 @@ module_yfaostat_Traceable_FBS_DataExport <- function(command, ...) {

output_csv_data(
gcam_dataset = Traceable_FBS_PCe_2010_2022,
out_filename = "Traceable_FBS_PCe_2010_2022" %>% paste0("_", Sys.Date()),
out_filename = "Traceable_FBS_PCe_2010_2022" %>% paste0(out_filename_suffix),
col_type_nonyear = "cccc",
title = "Traceable FBS: supply utilization accounts in primary equivalent for APE items in 2010 - 2022",
unit = "1000 tonnes",
code = "SCL",
description = "Data is compiled and generated by gcamfaostat.",
out_dir = DIR_OUTPUT_CSV,
GZIP = F)
GZIP = T)

add_to_output_meta(.df = Traceable_FBS_PCe_2010_2022,
"Traceable_FBS_PCe_2010_2022")
Expand All @@ -237,14 +241,14 @@ module_yfaostat_Traceable_FBS_DataExport <- function(command, ...) {

output_csv_data(
gcam_dataset = Traceable_FBS_Food_Calorie_Macronutrient_2010_2022,
out_filename = "Traceable_FBS_Food_Calorie_Macronutrient_2010_2022" %>% paste0("_", Sys.Date()),
out_filename = "Traceable_FBS_Food_Calorie_Macronutrient_2010_2022" %>% paste0(out_filename_suffix),
col_type_nonyear = "cccc",
title = "Traceable FBS: food energy and macronutrient in 2010 - 2022",
unit = "Mt or Mkcal",
code = "SCL",
description = "Data is compiled and generated by gcamfaostat. Food energy and macronutrient by iso and APE items",
out_dir = DIR_OUTPUT_CSV,
GZIP = F)
GZIP = T)

add_to_output_meta(.df = Traceable_FBS_Food_Calorie_Macronutrient_2010_2022,
"Traceable_FBS_Food_Calorie_Macronutrient_2010_2022")
Expand Down Expand Up @@ -302,14 +306,14 @@ module_yfaostat_Traceable_FBS_DataExport <- function(command, ...) {

output_csv_data(
gcam_dataset = Traceable_FBS_Extraction_Rate_2010_2022,
out_filename = "Traceable_FBS_Extraction_Rate_2010_2022" %>% paste0("_", Sys.Date()),
out_filename = "Traceable_FBS_Extraction_Rate_2010_2022" %>% paste0(out_filename_suffix),
col_type_nonyear = "cciiccc",
title = "Extraction rates used for compiling the traceable FBS dataset",
unit = "NA",
code = "NA",
description = "Data is compiled and generated by gcamfaostat.",
out_dir = DIR_OUTPUT_CSV,
GZIP = F)
GZIP = T)

add_to_output_meta(.df = Traceable_FBS_Extraction_Rate_2010_2022 %>% rename(item = sink_item),
"Traceable_FBS_Extraction_Rate_2010_2022")
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ The package is documented in the [online manual](https://jgcri.github.io/gcamfao

#### 4. Run the driver
* `driver_drake()`
* if `write_csv_model = GCAM` in the function, related CSV will be exported to `output/gcamfaostat_GCAM`
* if `driver_drake(write_csv_model = GCAM)`, related CSV for GCAM will be exported to `output/gcamfaostat_GCAM`
* if `driver_drake(write_csv_model = "Traceable_FBS")`, related CSV for generating traceable FBS (T-FBS) will be exported to `output/gcamfaostat_Traceable_FBS`
* Users can add and design data flows for other models.

#### 5. Use data and package functions
Expand Down
Binary file modified data/GCAM_DATA_MAP.rda
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/CONTRIBUTING.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/articles/vignette_getting_started.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/articles/vignette_news.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions docs/articles/vignette_preparing_data.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ed55c7e

Please sign in to comment.