Skip to content

21 enable production demand vector for 2r models#22

Closed
WesIngwersen wants to merge 5 commits into
developfrom
21-enable-production-demand-vector-for-2r-models
Closed

21 enable production demand vector for 2r models#22
WesIngwersen wants to merge 5 commits into
developfrom
21-enable-production-demand-vector-for-2r-models

Conversation

@WesIngwersen

Copy link
Copy Markdown
Member

Prepare production demand vector for import demand for use in coupled model calculations with 2R models.

@WesIngwersen

Copy link
Copy Markdown
Member Author

Tested for a pecan series model

library(devtools)
load_all()
model <- readRDS("../USEEIO-State/models/MAEEIOv1.3-pecan-22.rds")
location <- "US-MA"
domestic <- FALSE
import = TRUE
iolevel <- "Summary"
r <- calculateEEIOModel(model,perspective="FINAL",demand="Production",location=location, use_domestic_requirements = FALSE)
r$H_l

Results are negative for emissions looking invalid. This is due to negative in demand from having negatives in import demand col of Use table that outweigh other elements of final demand.

Commodity Greenhouse Gases
111CA/US-MA -1.3E+08
113FF/US-MA -7.1E+07
211/US-MA -2.4E+09
212/US-MA -2.9E+08
213/US-MA 20227568
22/US-MA 1.28E+09
23/US-MA 9.68E+09
321/US-MA -4.4E+08
327/US-MA -1.6E+09
331/US-MA -7.4E+08
332/US-MA -1E+09
333/US-MA 6.83E+08
334/US-MA -1.7E+09
335/US-MA -8.5E+08
3361MV/US-MA -5.3E+08
3364OT/US-MA 1.45E+08
337/US-MA -1.1E+08
339/US-MA -9.7E+07
311FT/US-MA 3.18E+09
313TT/US-MA -2.9E+08
315AL/US-MA -2.4E+08
322/US-MA -1.8E+08
323/US-MA -2.6E+07
324/US-MA -1.3E+09
325/US-MA -3.9E+09
326/US-MA -3.9E+08
42/US-MA 1.64E+09
441/US-MA 1.63E+09
445/US-MA 3.3E+09
452/US-MA 605774.1
4A0/US-MA 1.12E+09
481/US-MA 2.08E+09
482/US-MA 1.9E+08
483/US-MA 1.07E+09
484/US-MA 1.88E+09
485/US-MA 6.92E+08
486/US-MA 2.58E+08
487OS/US-MA -5E+08
493/US-MA 1551813
511/US-MA 3E+08
512/US-MA -3.4E+07
513/US-MA 7.01E+08
514/US-MA 4.18E+08
521CI/US-MA 1.9E+08
523/US-MA 7.26E+08
524/US-MA -4.4E+07
525/US-MA 8.84E+08
HS/US-MA 2.85E+09
ORE/US-MA -2.4E+09
532RL/US-MA 2.73E+08
5411/US-MA 93471005
5415/US-MA 8.58E+08
5412OP/US-MA 1.53E+09
55/US-MA 8592241
561/US-MA 1.27E+08
562/US-MA -3.5E+07
61/US-MA 5.11E+08
621/US-MA 3.15E+09
622/US-MA 6.42E+09
623/US-MA 1.09E+09
624/US-MA 1.6E+09
711AS/US-MA 1.69E+08
713/US-MA 4.46E+08
721/US-MA 4.64E+08
722/US-MA 4.79E+09
81/US-MA 2.37E+09
GFGD/US-MA 1.79E+09
GFGN/US-MA 1.7E+09
GFE/US-MA 10160584
GSLG/US-MA 1.28E+10
GSLE/US-MA 4E+08
Used/US-MA -9.5E+08
Other/US-MA 11170845
111CA/RoUS 2.68E+09
113FF/RoUS 9066863
211/RoUS 0
212/RoUS 1022686
213/RoUS 60814.8
22/RoUS 1.42E+10
23/RoUS 0
321/RoUS 86310407
327/RoUS 71550730
331/RoUS 8141908
332/RoUS 1.11E+08
333/RoUS 5.99E+08
334/RoUS 4.24E+08
335/RoUS 2.19E+08
3361MV/RoUS 9.99E+08
3364OT/RoUS 3.31E+08
337/RoUS 1.65E+08
339/RoUS 3.3E+08
311FT/RoUS 6.18E+09
313TT/RoUS 95913202
315AL/RoUS 27812653
322/RoUS 1.87E+08
323/RoUS 3374122
324/RoUS 3.37E+09
325/RoUS 1.59E+09
326/RoUS 1.48E+08
42/RoUS 2.29E+09
441/RoUS 0
445/RoUS 0
452/RoUS 1.05E+09
4A0/RoUS 2.89E+09
481/RoUS 2.19E+09
482/RoUS 95157026
483/RoUS 2.79E+08
484/RoUS 1.66E+09
485/RoUS 0
486/RoUS 1.83E+08
487OS/RoUS 0
493/RoUS 928598.4
511/RoUS 3.95E+08
512/RoUS 50300441
513/RoUS 4.91E+08
514/RoUS 1.09E+08
521CI/RoUS 4.72E+08
523/RoUS 1.08E+08
524/RoUS 4.53E+08
525/RoUS 2.51E+08
HS/RoUS 0
ORE/RoUS 0
532RL/RoUS 1.94E+08
5411/RoUS 52012405
5415/RoUS 2.42E+08
5412OP/RoUS 4.59E+09
55/RoUS 0
561/RoUS 1.16E+08
562/RoUS 8.88E+08
61/RoUS 1.43E+09
621/RoUS 0
622/RoUS 0
623/RoUS 0
624/RoUS 0
711AS/RoUS 45342411
713/RoUS 1.44E+09
721/RoUS 1.24E+08
722/RoUS 0
81/RoUS 3.36E+08
GFGD/RoUS 0
GFGN/RoUS 0
GFE/RoUS 47535779
GSLG/RoUS 0
GSLE/RoUS 0
Used/RoUS 0
Other/RoUS 0

@WesIngwersen WesIngwersen requested a review from jvendries April 2, 2026 16:04
@WesIngwersen WesIngwersen self-assigned this Apr 2, 2026
@jvendries

Copy link
Copy Markdown

I think a part of the issue might be that the way the code treats imports when the external imports factor flag is true is different than what is expected in the prepare2RDemand() function. Specifically, we did not include special handling in the external import factors code for two region models, and so the way that the imports are handled might be different than the way they are treated in stateior when preparing the 4 sub-Use table objects (SoI2SoI, SoI2RoUS, etc). We even have a TODO comment to indicate this in LoadIOTables for 2R models.

I think we need to confirm if this is the case before we can determine whether the edits you made to prepare2RDemand() are correct.

…alculation of SoI2SoI and RoUS2RoUS portions of two region models.

Needs to be tested for consumption demand
@WesIngwersen

Copy link
Copy Markdown
Member Author

Hold on production vector preparation and shift to address #23 which can enable a new way of calculating the production impacts.

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.

2 participants