useeior icon indicating copy to clipboard operation
useeior copied to clipboard

Show results from RoW separately in results matrix

Open bl-young opened this issue 1 year ago • 6 comments

bl-young avatar Aug 15 '24 19:08 bl-young

We might want to make it optional in the result calculation and not the default unless we're sure it won't interfere with pkg functions operating on the result objects

WesIngwersen avatar Aug 15 '24 20:08 WesIngwersen

We might want to make it optional in the result calculation and not the default unless we're sure it won't interfere with pkg functions operating on the result objects

Good plan that will expedite the implementation as well

bl-young avatar Aug 15 '24 21:08 bl-young

We might want to make it optional in the result calculation and not the default unless we're sure it won't interfere with pkg functions operating on the result objects

Good plan that will expedite the implementation as well

I will add the parameter in

WesIngwersen avatar Aug 16 '24 12:08 WesIngwersen

did this in https://github.com/USEPA/useeior/commit/455b406050dac84623b7a1b086fa8f6da0f70808 and https://github.com/USEPA/useeior/commit/f9f1ab437de25c41a620622201eac9af40a16054

tested with this code

library(devtools)
load_all()

model <- buildModel("USEEIOv2.3-s-GHG-19")

model <- buildModel("MEEEIOv1.1-GHGc-20",configpaths = "../USEEIO-State/model_specs/ME/MEEEIOv1.1-GHGc-20.yml")

loc <- model$specs$ModelRegionAcronyms[1]

r_noRoW_f <- calculateEEIOModel(model, perspective="FINAL", demand = "Consumption", location = loc,
use_domestic_requirements = FALSE, household_emissions = TRUE, show_RoW = FALSE)

r_RoW_f <- calculateEEIOModel(model, perspective="FINAL", demand = "Consumption", location = loc,
                              use_domestic_requirements = FALSE, household_emissions = TRUE, show_RoW = TRUE)


colSums(r_noRoW_f$LCI_f) == colSums(r_RoW_f$LCI_f)

r_noRoW_d <- calculateEEIOModel(model, perspective="DIRECT", demand = "Consumption", location = loc,
                                use_domestic_requirements = FALSE, household_emissions = TRUE, show_RoW = FALSE)

r_RoW_d <- calculateEEIOModel(model, perspective="DIRECT", demand = "Consumption", location = loc,
                              use_domestic_requirements = FALSE, household_emissions = TRUE, show_RoW = TRUE)


all.equal(colSums(r_noRoW_d$LCI_d),colSums(r_RoW_f$LCI_f))
all.equal(colSums(r_RoW_d$LCI_d),colSums(r_RoW_f$LCI_f))
all.equal(colSums(r_noRoW_d$LCI_d),colSums(r_RoW_f$LCI_f))

those statements return TRUE

Also my recommendation is some refactoring..its a very long set of operations with a lot of redundancy in the direct and final IF clauses

WesIngwersen avatar Aug 16 '24 13:08 WesIngwersen

ok are you still working on this now or should I take over?

bl-young avatar Aug 16 '24 15:08 bl-young

The RoW block does not have an F010 record. This is 0 by definition but I think its better to add it in - otherwise it requires an adjustment to line up results by region

WesIngwersen avatar Aug 16 '24 19:08 WesIngwersen