From 556ec51f4ea04d45e7f5c7e5985a61b9b1a02cdd Mon Sep 17 00:00:00 2001 From: Ben Young Date: Thu, 1 Aug 2024 13:33:23 -0400 Subject: [PATCH] add USEEIOv2.3 model specs --- inst/extdata/modelspecs/USEEIOv2.3-GHG.yml | 66 +++++++++++++++++++ .../modelspecs/USEEIOv2.3-s-GHG-19.yml | 66 +++++++++++++++++++ tests/import_factors_summary_2019.csv | 40 ----------- tests/test_model_build.R | 23 +++---- 4 files changed, 141 insertions(+), 54 deletions(-) create mode 100644 inst/extdata/modelspecs/USEEIOv2.3-GHG.yml create mode 100644 inst/extdata/modelspecs/USEEIOv2.3-s-GHG-19.yml delete mode 100644 tests/import_factors_summary_2019.csv diff --git a/inst/extdata/modelspecs/USEEIOv2.3-GHG.yml b/inst/extdata/modelspecs/USEEIOv2.3-GHG.yml new file mode 100644 index 00000000..da62535d --- /dev/null +++ b/inst/extdata/modelspecs/USEEIOv2.3-GHG.yml @@ -0,0 +1,66 @@ +Model: "USEEIOv2.3-GHG" # 2017 Detail, Commodity +BaseIOSchema: 2017 +BaseIOLevel: "Detail" +IOYear: 2017 # Year for IO data +ModelRegionAcronyms: ["US"] +ModelType: "EEIO" +IODataSource: "BEA" +BasePriceType: "PRO" #producer +BasewithRedefinitions: FALSE +CommodityorIndustryType: "Commodity" +ScrapIncluded: FALSE +DisaggregationSpecs: null +ExternalImportFactors: TRUE + +SatelliteTable: + GHG: + FullName: "Greenhouse Gases" + Abbreviation: "GHG" + StaticSource: TRUE + StaticFile: "flowsa/FlowBySector/GHG_national_2019_m2_v2.0.3_1cb504c.parquet" + FileLocation: "DataCommons" + DataYears: [2019] + Locations: ["US"] + SectorListSource: "NAICS" + SectorListYear: 2017 + SectorListLevel: "6" + OriginalFlowSource: "FEDEFLv1.2" + ScriptFunctionCall: "getFlowbySectorCollapsed" #function to call for script + ScriptFunctionParameters: null + DataSources: + USEPA_GHG_2024: + Title: "GHG Inventory" + Author: "USEPA" + DataYear: 2022 + URL: "https://www.epa.gov/ghgemissions/inventory-us-greenhouse-gas-emissions-and-sinks-1990-2022" + Primary: TRUE + +Indicators: + GreenhouseGases: + Name: "Greenhouse Gases" + Code: "GHG" + Group: "Impact Potential" + Unit: "kg CO2 eq" + SimpleUnit: "Kilograms Carbon Dioxide (CO2)" + SimpleName: "Greenhouse Gases" + StaticSource: TRUE + StaticFile: "lciafmt/ipcc/IPCC_v1.1.1_27ba917.parquet" + FileLocation: "DataCommons" + ScriptFunctionCall: "getImpactMethod" #function to call for script + ScriptFunctionParameters: + indicators: ["AR6-100"] + DataSources: + IPCC_AR6: + Title: "IPCC Sixth Assessment Report: Direct Global Warming Potentials for 100 year time horizon" + Author: "IPCC" + DataYear: 2021 + URL: "" + Primary: TRUE + +DemandVectors: + DefaultDemand: "DefaultDemandVectors" # Name of default demand vectors yml file +# Additional demand vectors beyond useeior defaults + +ImportFactors: + StaticFile: "useeior/US_detail_import_factors_exio_2019_17sch.csv" + FileLocation: "DataCommons" diff --git a/inst/extdata/modelspecs/USEEIOv2.3-s-GHG-19.yml b/inst/extdata/modelspecs/USEEIOv2.3-s-GHG-19.yml new file mode 100644 index 00000000..3f3b4f82 --- /dev/null +++ b/inst/extdata/modelspecs/USEEIOv2.3-s-GHG-19.yml @@ -0,0 +1,66 @@ +Model: "USEEIOv2.3-s-GHG-19" +BaseIOSchema: 2017 +BaseIOLevel: "Summary" +IOYear: 2019 # Year for IO data +ModelRegionAcronyms: ["US"] +ModelType: "EEIO" +IODataSource: "BEA" +BasePriceType: "PRO" #producer +BasewithRedefinitions: FALSE +CommodityorIndustryType: "Commodity" +ScrapIncluded: FALSE +DisaggregationSpecs: null +ExternalImportFactors: TRUE + +SatelliteTable: + GHG: + FullName: "Greenhouse Gases" + Abbreviation: "GHG" + StaticSource: TRUE + StaticFile: "flowsa/FlowBySector/GHG_national_2019_m1_v2.0.3_1cb504c.parquet" + FileLocation: "DataCommons" + DataYears: [2019] + Locations: ["US"] + SectorListSource: "NAICS" + SectorListYear: 2017 + SectorListLevel: "6" + OriginalFlowSource: "FEDEFLv1.2" + ScriptFunctionCall: "getFlowbySectorCollapsed" #function to call for script + ScriptFunctionParameters: null + DataSources: + USEPA_GHG_2024: + Title: "GHG Inventory" + Author: "USEPA" + DataYear: 2022 + URL: "https://www.epa.gov/ghgemissions/inventory-us-greenhouse-gas-emissions-and-sinks-1990-2022" + Primary: TRUE + +Indicators: + GreenhouseGases: + Name: "Greenhouse Gases" + Code: "GHG" + Group: "Impact Potential" + Unit: "kg CO2 eq" + SimpleUnit: "Kilograms Carbon Dioxide (CO2)" + SimpleName: "Greenhouse Gases" + StaticSource: TRUE + StaticFile: "lciafmt/ipcc/IPCC_v1.1.1_27ba917.parquet" + FileLocation: "DataCommons" + ScriptFunctionCall: "getImpactMethod" #function to call for script + ScriptFunctionParameters: + indicators: ["AR6-100"] + DataSources: + IPCC_AR6: + Title: "IPCC Sixth Assessment Report: Direct Global Warming Potentials for 100 year time horizon" + Author: "IPCC" + DataYear: 2021 + URL: "" + Primary: TRUE + +DemandVectors: + DefaultDemand: "DefaultDemandVectors" # Name of default demand vectors yml file +# Additional demand vectors beyond useeior defaults + +ImportFactors: + StaticFile: "useeior/US_summary_import_factors_exio_2019_17sch.csv" + FileLocation: "DataCommons" diff --git a/tests/import_factors_summary_2019.csv b/tests/import_factors_summary_2019.csv deleted file mode 100644 index a89bf13f..00000000 --- a/tests/import_factors_summary_2019.csv +++ /dev/null @@ -1,40 +0,0 @@ -Sector,Year,Unit,ReferenceCurrency,PriceType,Flowable,Context,FlowUUID,FlowAmount,BaseIOLevel -111CA,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.016474093,Summary -113FF,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001714068,Summary -211,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.03152246,Summary -212,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.007191763,Summary -213,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.050956032,Summary -22,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.004375101,Summary -311FT,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.019902282,Summary -313TT,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.007445201,Summary -315AL,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.009335478,Summary -321,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.003049574,Summary -322,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.004033682,Summary -323,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.003288144,Summary -324,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.015549277,Summary -325,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.00460312,Summary -326,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.00371466,Summary -327,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.005381323,Summary -331,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.002696413,Summary -332,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.003273309,Summary -333,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.002147959,Summary -334,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.002565242,Summary -335,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.002797834,Summary -3361MV,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001959626,Summary -3364OT,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001650024,Summary -337,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.003552752,Summary -339,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.002593169,Summary -487OS,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.000464863,Summary -511,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.000577812,Summary -513,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001197334,Summary -514,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001058551,Summary -523,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001496857,Summary -524,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001086412,Summary -5411,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001960833,Summary -5412OP,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.002227838,Summary -5415,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001714786,Summary -561,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001981614,Summary -61,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.004780619,Summary -711AS,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.000258994,Summary -81,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.001542824,Summary -GFE,2019,kg,USD,Basic,Methane,emission/air,aab83476-ec6c-3742-af85-15d320b7ce80,0.000471873,Summary diff --git a/tests/test_model_build.R b/tests/test_model_build.R index 3997d8bd..810d59c4 100644 --- a/tests/test_model_build.R +++ b/tests/test_model_build.R @@ -90,20 +90,15 @@ cfg <- c(paste0("modelspecs/", m, ".yml")) model <- buildModel(m, configpaths = file.path(cfg)) printValidationResults(model) -## USEEIOv2.0 Summary, commodity model with GHGs and Import Factors -cfg <- c(paste0("modelspecs/", m, ".yml"), - "import_factors_summary_2019.csv" - ) -model <- useeior:::initializeModel(m, configpaths = file.path(cfg)) -model$specs$Model <- "USEEIOv2.0-s-GHG-19-IF" -model$specs$ExternalImportFactors <- TRUE -model$specs$ImportFactors <- list() -model$specs$ImportFactors$StaticFile <- "import_factors_summary_2019.csv" -model <- useeior:::loadIOData(model, file.path(cfg)) -model <- useeior:::loadandbuildSatelliteTables(model) -model <- useeior:::loadandbuildIndicators(model) -model <- useeior:::loadDemandVectors(model) -model <- useeior:::constructEEIOMatrices(model, file.path(cfg)) +## USEEIOv2.3 Detail, commodity model with GHGs and Import Factors +m <- "USEEIOv2.3-GHG" +model <- buildModel(m) +printValidationResults(model) +writeModeltoXLSX(model, ".") + +## USEEIOv2.3 Summary, commodity model with GHGs and Import Factors +m <- "USEEIOv2.3-s-GHG-19" +model <- buildModel(m) printValidationResults(model) ## USEEIOv2.0 Summary, industry model