Skip to content

Commit

Permalink
move prepareDemandVectorforStandardResults() inside `calculateStand…
Browse files Browse the repository at this point in the history
…ardResults()` for consistency with `calculateResultsWithExternalFactors()`
  • Loading branch information
bl-young committed Sep 4, 2024
1 parent 98410e5 commit 5cc4f0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions R/CalculationFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ calculateEEIOModel <- function(model, perspective, demand = "Production", locati
household_emissions = household_emissions, show_RoW = show_RoW)
} else {
# Standard model results calculation
f <- prepareDemandVectorForStandardResults(model, demand, location, use_domestic_requirements)
result <- calculateStandardResults(model, perspective, f, use_domestic_requirements, location, household_emissions)
result <- calculateStandardResults(model, perspective, demand, use_domestic_requirements, location, household_emissions)
}

logging::loginfo("Result calculation complete.")
Expand Down Expand Up @@ -224,15 +223,17 @@ calculateResultsWithExternalFactors <- function(model, perspective = "FINAL", de
#' @param perspective Perspective of the model, can be "DIRECT" or "FINAL". "DIRECT" perspective
#' aligns results with the sectors in which they are produced, while "FINAL" perspective aligns
#' results with the sectors consumed by the final user.
#' @param f A demand vector with names as one or more model sectors and
#' @param demand A demand vector, can be name of a built-in model demand vector, e.g. "Production" or "Consumption",
#' or an actual demand vector with names as one or more model sectors and
#' numeric values in USD with the same dollar year as model.
#' @param use_domestic_requirements A logical value: if TRUE, use domestic demand and L_d matrix;
#' if FALSE, use complete demand and L matrix.
#' @param location, str optional location code for demand vector, required for two-region models
#' @param household_emissions, bool, if TRUE, include calculation of emissions from households
#' @return A list with LCI and LCIA results (in data.frame format) of the EEIO model.
calculateStandardResults <- function(model, perspective, f, use_domestic_requirements = FALSE,
calculateStandardResults <- function(model, perspective, demand, use_domestic_requirements = FALSE,
location = NULL, household_emissions = FALSE) {
f <- prepareDemandVectorForStandardResults(model, demand, location, use_domestic_requirements)
# Initialize results list
result <- list()
# Generate Total Requirements (L or L_d) matrix based on whether "use_domestic"
Expand Down
5 changes: 3 additions & 2 deletions man/calculateStandardResults.Rd

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

0 comments on commit 5cc4f0e

Please sign in to comment.