Skip to content

Fixes #262. Sets M and N to respective domestic versions in calculateEEIOmodel#263

Merged
bl-young merged 1 commit intorelease-v1.4.0from
262-domestic-result-calculation-using-final-perspective-domestic-versions-of-m-and-d-not-used
Sep 21, 2023
Merged

Fixes #262. Sets M and N to respective domestic versions in calculateEEIOmodel#263
bl-young merged 1 commit intorelease-v1.4.0from
262-domestic-result-calculation-using-final-perspective-domestic-versions-of-m-and-d-not-used

Conversation

@WesIngwersen
Copy link
Copy Markdown

@bl-young please determine the best place to pull this fix into and merge when ready

Performed this test to check that this fix is valid

## Test that the fix to the FINAL perspective calc for domestic models is valid (useeior issue #262)

library(devtools)
load_all()

# Use a summary GHG model
model <- useeior::buildModel("USEEIOv2.0-s-GHG")


# First check that calculateEEIOModel with FINAL perspective and use_domestic_requirements=TRUE is the same as manual calculation

LCI_final <- calculateEEIOModel(model, perspective = "FINAL", demand = "Consumption", use_domestic_requirements = TRUE)$LCI_f


LCI_final_check <- calculateFinalPerspectiveLCI(model$M_d,model$DemandVectors$vectors$`2012_US_Consumption_Domestic`)
all.equal(LCI_final,LCI_final_check)

> TRUE

## LCI colsums (sum by flow) should be the same in both FINAL or DIRECT calcs. Check this is true.

LCI_final_sum <- colSums(LCI_final)

LCI_direct <- calculateEEIOModel(model, perspective = "DIRECT", demand = "Consumption", use_domestic_requirements = TRUE)$LCI_d

LCI_direct_sum <- colSums(LCI_direct)

all.equal(LCI_final_sum,LCI_direct_sum)

>TRUE

…EEIOmodel and sends them to the FINAL perspective calc function.
@bl-young bl-young changed the base branch from master to release-v1.4.0 September 21, 2023 12:42
@bl-young bl-young merged commit 33496a9 into release-v1.4.0 Sep 21, 2023
@bl-young bl-young deleted the 262-domestic-result-calculation-using-final-perspective-domestic-versions-of-m-and-d-not-used branch September 29, 2023 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Domestic result calculation using final perspective ... domestic versions of M and d not used

3 participants