Skip to content

Commit

Permalink
use alias for state model files
Browse files Browse the repository at this point in the history
  • Loading branch information
bl-young committed Dec 17, 2024
1 parent 429dd8c commit cb97a41
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/save-two-region-model-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
14 changes: 6 additions & 8 deletions data-raw/TwoRegionModel.R
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit cb97a41

Please sign in to comment.