Skip to content

Commit

Permalink
fix error in assigning factors to CO2e flows #281
Browse files Browse the repository at this point in the history
  • Loading branch information
bl-young committed Jun 14, 2024
1 parent 429ebfb commit e740d88
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/BuildModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ createCfromFactorsandBflows <- function(factors,B_flows) {
C[, flows_inBnotC] <- 0
C[is.na(C)] <- 0

# Make sure CO2e flows are characterized (see issue #281)
f <- B_flows[!(B_flows %in% factors$Flow) & grepl("kg CO2e", B_flows)]
C[, f] <- 1
if("Greenhouse Gases" %in% factors$Indicator) {
# Make sure CO2e flows are characterized (see issue #281)
f <- B_flows[!(B_flows %in% factors$Flow) & grepl("kg CO2e", B_flows)]
C["Greenhouse Gases", f] <- 1
}
# Filter and resort model C flows and make it into a matrix
C <- as.matrix(C[, B_flows])
return(C)
Expand Down

0 comments on commit e740d88

Please sign in to comment.