From cb97a41eea9fc97b3e7fd1e7da0daea86e1fab99 Mon Sep 17 00:00:00 2001 From: Ben Young Date: Tue, 17 Dec 2024 10:54:24 -0500 Subject: [PATCH] use alias for state model files --- .github/workflows/save-two-region-model-data.yaml | 2 +- data-raw/TwoRegionModel.R | 14 ++++++-------- ...tateIOv1.0.0-75.yml => StateIOv1.2-milkbar.yml} | 2 +- ...StateIOv1.0.0-s.yml => StateIOv1.2-shoofly.yml} | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) rename inst/extdata/modelspecs/{StateIOv1.0.0-75.yml => StateIOv1.2-milkbar.yml} (79%) rename inst/extdata/modelspecs/{StateIOv1.0.0-s.yml => StateIOv1.2-shoofly.yml} (83%) diff --git a/.github/workflows/save-two-region-model-data.yaml b/.github/workflows/save-two-region-model-data.yaml index ccf301d..43edc5f 100644 --- a/.github/workflows/save-two-region-model-data.yaml +++ b/.github/workflows/save-two-region-model-data.yaml @@ -7,7 +7,7 @@ on: model_spec: description: "Model spec file (in quotes)" required: true - default: "StateIOv1.0.0-s" + default: "StateIOv1.2-shoofly" type: string diff --git a/data-raw/TwoRegionModel.R b/data-raw/TwoRegionModel.R index 2610a58..cd9bfde 100644 --- a/data-raw/TwoRegionModel.R +++ b/data-raw/TwoRegionModel.R @@ -1,26 +1,24 @@ # Generate and save two-region IO tables -## Temp code inputs: -# model_spec <- "StateIOv1.0.0-75" -# model_spec <- "StateIOv1.0.0-s" -# year <- 2017 + +# model_spec <- "StateIOv1.2-milkbar" # Utilities disaggregation +# model_spec <- "StateIOv1.2-shoofly" # base model +# year <- 2019 # Load model spec logging::loginfo(paste("Generating two region model for", model_spec)) configpath <- system.file("extdata/modelspecs/", paste0(model_spec, ".yml"), package = "stateior") specs <- configr::read.config(configpath) -# specs <- useeior:::getConfiguration(model_spec, "model", pkg="stateior") # Build model TwoRegionModel <- assembleTwoRegionIO(year, iolevel = specs$BaseIOLevel, disagg_specs = specs$DisaggregationSpecs) +alias <- gsub("^.*-", "", model_spec) # Subset data set for (name in names(TwoRegionModel)) { df <- TwoRegionModel[[name]] # Write data to .rds - name <- ifelse(is.null(specs$DisaggregationSpecs), name, - paste0(name, "_", specs$DisaggregationSpecs)) - data_name <- paste("TwoRegion_Summary", name, year, + data_name <- paste("TwoRegion_Summary", name, alias, year, utils::packageDescription("stateior", fields = "Version"), sep = "_") saveRDS(object = df, diff --git a/inst/extdata/modelspecs/StateIOv1.0.0-75.yml b/inst/extdata/modelspecs/StateIOv1.2-milkbar.yml similarity index 79% rename from inst/extdata/modelspecs/StateIOv1.0.0-75.yml rename to inst/extdata/modelspecs/StateIOv1.2-milkbar.yml index a299fea..a268451 100644 --- a/inst/extdata/modelspecs/StateIOv1.0.0-75.yml +++ b/inst/extdata/modelspecs/StateIOv1.2-milkbar.yml @@ -1,4 +1,4 @@ -Model: "StateIOv1.0.0-75" # 75 represents Summary level disaggregated model (73 + 2 = 75 commodities & 71 + 2 = 73 industries) +Model: "StateIOv1.2-milkbar" # alias milkbar reflects summary level disaggregated model for utilities BaseIOSchema: 2012 BaseIOLevel: "Summary" IOYear: diff --git a/inst/extdata/modelspecs/StateIOv1.0.0-s.yml b/inst/extdata/modelspecs/StateIOv1.2-shoofly.yml similarity index 83% rename from inst/extdata/modelspecs/StateIOv1.0.0-s.yml rename to inst/extdata/modelspecs/StateIOv1.2-shoofly.yml index 0ed211e..c6b715f 100644 --- a/inst/extdata/modelspecs/StateIOv1.0.0-s.yml +++ b/inst/extdata/modelspecs/StateIOv1.2-shoofly.yml @@ -1,4 +1,4 @@ -Model: "StateIOv1.0.0-s" # s represents Summary level (73 commodities & 71 industries) +Model: "StateIOv1.2-shoofly" # Summary level (73 commodities & 71 industries), no adjustments BaseIOSchema: 2012 BaseIOLevel: "Summary" IOYear: