From 9c707c1a03d1791404d44667dadd212e6ef497d8 Mon Sep 17 00:00:00 2001 From: Ben Young Date: Wed, 15 Nov 2023 10:57:51 -0500 Subject: [PATCH 1/7] drop USEEIOv2.1-422, not finalized --- inst/extdata/modelspecs/USEEIOv2.1-422.yml | 867 --------------------- 1 file changed, 867 deletions(-) delete mode 100644 inst/extdata/modelspecs/USEEIOv2.1-422.yml diff --git a/inst/extdata/modelspecs/USEEIOv2.1-422.yml b/inst/extdata/modelspecs/USEEIOv2.1-422.yml deleted file mode 100644 index 42ba7621..00000000 --- a/inst/extdata/modelspecs/USEEIOv2.1-422.yml +++ /dev/null @@ -1,867 +0,0 @@ -Model: "USEEIOv2.1-422" -BaseIOSchema: 2012 -BaseIOLevel: &BaseIOLevel "Detail" -IOYear: 2012 # Year for IO data -ModelRegionAcronyms: ["US"] -ModelType: "EEIO" -IODataSource: "BEA" -BasePriceType: "PRO" #producer -BasewithRedefinitions: FALSE -CommodityorIndustryType: "Commodity" -ScrapIncluded: FALSE -DisaggregationSpecs: ["ElectricityDisaggregationDetail", "WasteDisaggregationDetail"] #Name of disaggregation yml file. -AggregationSpecs: ["ElectricityAggregationDetail"] - -SatelliteTable: - WAT: - FullName: "Water withdrawals" - Abbreviation: "WAT" - StaticSource: TRUE - StaticFile: "flowsa/FlowBySector/Water_national_2015_m3_v0.4.1_7c5071e.parquet" - FileLocation: "DataCommons" - DataYears: [2015] - Locations: ["US"] - SectorListSource: "NAICS" - SectorListYear: 2012 - SectorListLevel: "6" - OriginalFlowSource: "FEDEFLv1.0.6" - ScriptFunctionCall: "getFlowbySectorCollapsed" #function to call for script - ScriptFunctionParameters: null - DataSources: - USGS_NWIS_WU_2015: - Title: "Water Use in the US" - Author: "USGS" - DataYear: 2015 - URL: "https://waterdata.usgs.gov/" - Primary: TRUE - CHAIR: - FullName: "Criteria and Hazardous Air Emissions" - Abbreviation: "CHAIR" - StaticSource: TRUE - StaticFile: "flowsa/FlowBySector/CAP_HAP_national_2017_v0.3.1_f3cdf5b.parquet" - FileLocation: "DataCommons" - DataYears: [2017] - Locations: ["US"] - SectorListSource: "NAICS" - SectorListYear: 2012 - SectorListLevel: "6" - OriginalFlowSource: "FEDEFLv1.0.6" - ScriptFunctionCall: "getFlowbySectorCollapsed" #function to call for script - ScriptFunctionParameters: null - DataSources: - EPA_NEI_2017: - Title: "National Emissions Inventory" - Author: "EPA" - DataYear: 2017 - URL: "https://www.epa.gov/air-emissions-inventories/national-emissions-inventory-nei" - Primary: TRUE - EPA_TRI_2017: - Title: "Toxic Release Inventory" - Author: "EPA" - DataYear: 2017 - URL: "https://www.epa.gov/toxics-release-inventory-tri-program" - Primary: TRUE - GRDREL: - FullName: "Point source industrial releases to ground" - Abbreviation: "GRDREL" - StaticSource: TRUE - StaticFile: "flowsa/FlowBySector/GRDREL_national_2017_v0.3.1_f3cdf5b.parquet" - FileLocation: "DataCommons" - DataYears: [2017] - Locations: ["US"] - SectorListSource: "NAICS" - SectorListYear: 2012 - SectorListLevel: "6" - OriginalFlowSource: "FEDEFLv1.0.6" - ScriptFunctionCall: "getFlowbySectorCollapsed" #function to call for script - ScriptFunctionParameters: null - DataSources: - EPA_TRI_2017: - Title: "Toxic Release Inventory" - Author: "EPA" - DataYear: 2017 - URL: "https://www.epa.gov/toxics-release-inventory-tri-program" - Primary: TRUE - WATREL: - FullName: "Point source releases to water" - Abbreviation: "WATREL" - StaticSource: TRUE - StaticFile: "flowsa/FlowBySector/TRI_DMR_national_2017_v0.3.1_f3cdf5b.parquet" - FileLocation: "DataCommons" - DataYears: [2017] - Locations: ["US"] - SectorListSource: "NAICS" - SectorListYear: 2012 - SectorListLevel: "6" - OriginalFlowSource: "FEDEFLv1.0.6" - ScriptFunctionCall: "getFlowbySectorCollapsed" #function to call for script - ScriptFunctionParameters: null - DataSources: - EPA_TRI_2017: - Title: "Toxic Release Inventory" - Author: "EPA" - DataYear: 2017 - URL: "https://www.epa.gov/toxics-release-inventory-tri-program" - Primary: TRUE - EPA_DMR_2017: - Title: "Discharge Monitoring Report" - Author: "EPA" - DataYear: 2017 - URL: "https://echo.epa.gov/tools/data-downloads/icis-npdes-dmr-and-limit-data-set" - Primary: TRUE - GHG: - FullName: "Greenhouse Gases" - Abbreviation: "GHG" - StaticSource: TRUE - StaticFile: "useeior/NGHGIAM_GHG_TotalsBySector_wUUIDs.csv" - FileLocation: "DataCommons" - DataYears: [2016] - Locations: ["US"] - SectorListSource: "BEA" # or, NAICS - SectorListYear: 2012 - SectorListLevel: "Detail" - OriginalFlowSource: "FEDEFLv1.0.6" - DataSources: - USEPA_GHG_2018: - Title: "GHG Inventory" - Author: "USEPA" - DataYear: 2016 - URL: "https://www.epa.gov/ghgemissions/inventory-us-greenhouse-gas-emissions-and-sinks-1990-2016" - Primary: TRUE - LAND: - FullName: "Land use" - Abbreviation: "LAND" - StaticSource: TRUE - StaticFile: "flowsa/FlowBySector/Land_national_2012_v1.0.1_0470867.parquet" - FileLocation: "DataCommons" - DataYears: [2012] - Locations: ["US"] - SectorListSource: "NAICS" - SectorListYear: 2012 - SectorListLevel: "6" - OriginalFlowSource: "FEDEFLv1.0.6" - ScriptFunctionCall: "getFlowbySectorCollapsed" #function to call for script - ScriptFunctionParameters: null - DataSources: - BLM_PLS: - Title: "Public Land Statistics" - Author: "BLM" - DataYear: 2012 - URL: "https://www.blm.gov/about/data/public-land-statistics" - Primary: FALSE - EIA_CBECS_Land: - Title: "Commercial Building Energy Consumption Survey" - Author: "EIA" - DataYear: 2012 - URL: "https://www.eia.gov/consumption/commercial/data/2012/" - Primary: FALSE - EIA_MECS_Land: - Title: "Manufacturing Energy Consumption Survey" - Author: "EIA" - DataYear: 2014 - URL: "https://www.eia.gov/consumption/manufacturing/data/2014/" - Primary: FALSE - USDA_ERS_MLU: - Title: "Major Uses of Land in the United States" - Author: "USDA" - DataYear: 2012 - URL: "https://www.ers.usda.gov/data-products/major-land-uses/" - Primary: TRUE - MINE: - FullName: "Mineral extraction" - Abbreviation: "MINE" - StaticSource: TRUE - StaticFile: "useeior/USEEIOv1.1_MINE_TotalsBySector_FEDEFL_wUUIDs.csv" - FileLocation: "DataCommons" - DataYears: [2014] - Locations: ["US"] - SectorListSource: "BEA" - SectorListYear: 2007 - SectorListLevel: "Detail" - OriginalFlowSource: "FEDEFLv1.0.6" - DataSources: - USGS_MCS: - Title: "Mineral Commodity Summary" - Author: "USGS" - DataYear: 2014 - URL: "https://www.usgs.gov/centers/nmic/mineral-commodity-summaries" - Primary: TRUE - ENERGY: - FullName: "Energy extraction" - Abbreviation: "ENERGY" - StaticSource: TRUE - StaticFile: "useeior/USEEIOv1.1_Energy_TotalsBySector_FEDEFL_wUUIDs.csv" - FileLocation: "DataCommons" - DataYears: [2014] - Locations: ["US"] - SectorListSource: "BEA" - SectorListYear: 2007 - SectorListLevel: "Detail" - OriginalFlowSource: "FEDEFLv1.0.6" - DataSources: - EIA_MER: - Title: "Monthly Energy Review" - Author: "EIA" - DataYear: 2014 - URL: "http://www.eia.gov/totalenergy/data/monthly/" - Primary: TRUE - EIA_923: - Title: "Form EIA-923 Detailed" - Author: "EIA" - DataYear: 2014 - URL: "https://www.eia.gov/electricity/data/eia923/" - Primary: TRUE - NPAG: - FullName: "Nitrogen and Phosphorus Releases from Agriculture" - Abbreviation: "NPAG" - StaticSource: TRUE - StaticFile: "useeior/USEEIOv1.1_NPAG_TotalsBySector_wUUIDs.csv" - FileLocation: "DataCommons" - DataYears: [2013, 2015] - Locations: ["US"] - SectorListSource: "BEA" - SectorListYear: 2007 - SectorListLevel: "Detail" - OriginalFlowSource: "FEDEFLv1.0.6" - DataSources: - USDA_CUS_Corn_Potatoes: - Title: "Chemical Use Survey - Corn and Potatoes" - Author: "USDA" - DataYear: 2014 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2014_Corn_and_Potatoes/" - Primary: FALSE - USDA_CUS_Cotton: - Title: "Chemical Use Survey - Cotton" - Author: "USDA" - DataYear: 2010 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2010_Corn_Upland_Cotton_Fall_Potatoes/" - Primary: FALSE - USDA_CUS_Fruit: - Title: "Chemical Use Survey - Fruit" - Author: "USDA" - DataYear: 2011 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2011_Fruit_Chem_Usage/" - Primary: FALSE - USDA_CUS_Peanuts_Rice: - Title: "Chemical Use Survey - Peanuts and Rice" - Author: "USDA" - DataYear: 2013 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2013_Peanuts_and_Rice/" - Primary: FALSE - USDA_CUS_Soybeans_Wheat: - Title: "Chemical Use Survey - Soybeans and Wheat" - Author: "USDA" - DataYear: 2012 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2012_Soybeans_and_Wheat/" - Primary: FALSE - USDA_CUS_Vegetables: - Title: "Chemical Use Survey - Vegetables" - Author: "USDA" - DataYear: 2014 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2014_Vegetables/" - Primary: FALSE - PEST: - FullName: "Pesticide releases" - Abbreviation: "PEST" - StaticSource: TRUE - StaticFile: "useeior/USEEIOv1.1_PEST_TotalsBySector_wUUIDs.csv" - FileLocation: "DataCommons" - DataYears: [2004, 2005, 2010, 2011, 2012, 2013, 2014] - Locations: ["US"] - SectorListSource: "BEA" - SectorListYear: 2007 - SectorListLevel: "Detail" - OriginalFlowSource: "FEDEFLv1.0.6" - DataSources: - USDA_CUS_Corn_Potatoes: - Title: "Chemical Use Survey - Corn and Potatoes" - Author: "USDA" - DataYear: 2014 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2014_Corn_and_Potatoes/" - Primary: FALSE - USDA_CUS_Cotton: - Title: "Chemical Use Survey - Cotton" - Author: "USDA" - DataYear: 2010 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2010_Corn_Upland_Cotton_Fall_Potatoes/" - Primary: FALSE - USDA_CUS_Fruit: - Title: "Chemical Use Survey - Fruit" - Author: "USDA" - DataYear: 2011 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2011_Fruit_Chem_Usage/" - Primary: FALSE - USDA_CUS_Peanuts_Rice: - Title: "Chemical Use Survey - Peanuts and Rice" - Author: "USDA" - DataYear: 2013 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2013_Peanuts_and_Rice/" - Primary: FALSE - USDA_CUS_Soybeans_Wheat: - Title: "Chemical Use Survey - Soybeans and Wheat" - Author: "USDA" - DataYear: 2012 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2012_Soybeans_and_Wheat/" - Primary: FALSE - USDA_CUS_Vegetables: - Title: "Chemical Use Survey - Vegetables" - Author: "USDA" - DataYear: 2014 - URL: "https://www.nass.usda.gov/Data_and_Statistics/Pre-Defined_Queries/2014_Vegetables/" - Primary: FALSE - CNHW: - FullName: "Commercial non-hazardous waste excluding construction activities" - Abbreviation: "CNHW" - StaticSource: TRUE - StaticFile: "useeior/USEEIOv1.1_CNHW_TotalsBySector.csv" - FileLocation: "DataCommons" - DataYears: [2015] - Locations: ["US"] - SectorListSource: "BEA" - SectorListYear: 2007 - SectorListLevel: "Detail" - OriginalFlowSource: "Waste Characterization Study 2014" - DataSources: - CalRecycle_CWCS: - Title: "2014 Generator-Based Characterization of Commercial Sector" - Author: "CalRecycle" - DataYear: 2014 - URL: "https://www2.calrecycle.ca.gov/WasteCharacterization/PubExtracts/2014/GenSummary.pdf" - Primary: TRUE - CNHWC: - FullName: "Commercial non-hazardous waste from construction activities" - Abbreviation: "CNHWC" - StaticSource: TRUE - StaticFile: "useeior/USEEIOv1.1_CNHWC_TotalsBySector.csv" - FileLocation: "DataCommons" - DataYears: [2014] - Locations: ["US"] - SectorListSource: "BEA" - SectorListYear: 2007 - SectorListLevel: "Detail" - OriginalFlowSource: "CDDPath" - DataSources: - USEPA_FF_2014: - Title: "Advancing Sustainable Materials Management: 2014 Fact Sheet" - Author: "USEPA" - DataYear: 2014 - URL: "https://www.epa.gov/sites/production/files/2016-11/documents/2014_smmfactsheet_508.pdf" - Primary: TRUE - CRHW: - FullName: "Commercial RCRA-defined hazardous waste" - Abbreviation: "CRHW" - StaticSource: TRUE - StaticFile: "flowsa/FlowBySector/CRHW_national_2017_v0.3.1_f3cdf5b.parquet" - FileLocation: "DataCommons" - DataYears: [2017] - Locations: ["US"] - SectorListSource: "NAICS" - SectorListYear: 2012 - SectorListLevel: "6" - ScriptFunctionCall: "getFlowbySectorCollapsed" #function to call for script - ScriptFunctionParameters: null - OriginalFlowSource: "RCRAInfo" - DataSources: - USEPA_RCRAInfo_2017: - Title: "National Biennial RCRA Hazardous Waste Report" - Author: "USEPA" - DataYear: 2017 - URL: "https://rcrapublic.epa.gov/rcrainfoweb/action/modules/br/main/broverview" - Primary: TRUE - EMP: - FullName: "Employment" - Abbreviation: "EMP" - StaticSource: TRUE - StaticFile: "flowsa/FlowBySector/Employment_national_2017_v0.3.1_f3cdf5b.parquet" - FileLocation: "DataCommons" - DataYears: [2017] - Locations: ["US"] - SectorListSource: "NAICS" - SectorListYear: 2012 - SectorListLevel: "6" - ScriptFunctionCall: "getFlowbySectorCollapsed" #function to call for script - ScriptFunctionParameters: null - OriginalFlowSource: "National Employment Matrix" - DataSources: - BLS_QCEW_2017: - Title: "Quarterly Census of Employment and Wages" - Author: "BLS" - DataYear: 2017 - URL: "https://www.bls.gov/cew/" - Primary: TRUE - VADD: - FullName: "Value Added" - Abbreviation: "VADD" - StaticSource: FALSE - StaticFile: null - FileLocation: None - DataYears: [2012] - Locations: ["US"] - SectorListSource: "BEA" - SectorListYear: 2012 - SectorListLevel: *BaseIOLevel - OriginalFlowSource: "Input-Output Tables" - ScriptFunctionCall: "getValueAddedTotalsbySector" #function to call for script - ScriptFunctionParameters: ["model"] #list of parameters - DataSources: - BEA_USE: - Title: "Detail Use Before Redefinitions" - Author: "BEA" - DataYear: 2012 - URL: "https://apps.bea.gov//industry/iTables%20Static%20Files/AllTablesIO.zip" - 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/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["Global warming"] - DataSources: - USEPA_TRACI_2.1: - Title: "TRACI 2.1" - Author: "USEPA" - DataYear: NA - URL: "https://www.epa.gov/chemical-research/tool-reduction-and-assessment-chemicals-and-other-environmental-impacts-traci" - Primary: TRUE - Acidification: - Name: "Acidification Potential" - Code: "ACID" - Group: "Impact Potential" - Unit: "kg SO2 eq" - SimpleUnit: "Kilograms Sulphur Dioxide (SO2)" - SimpleName: "Acid Rain" - StaticSource: TRUE - StaticFile: "lciafmt/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["Acidification"] - DataSources: - USEPA_TRACI_2.1: - Title: "TRACI 2.1" - Author: "USEPA" - DataYear: NA - URL: "https://www.epa.gov/chemical-research/tool-reduction-and-assessment-chemicals-and-other-environmental-impacts-traci" - Primary: TRUE - Eutrophication: - Name: "Eutrophication Potential" - Code: "EUTR" - Group: "Impact Potential" - Unit: "kg N eq" - SimpleUnit: "Kilograms Nitrogen (N)" - SimpleName: "Water Eutrophication" - StaticSource: TRUE - StaticFile: "lciafmt/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["Eutrophication"] - DataSources: - USEPA_TRACI_2.1: - Title: "TRACI 2.1" - Author: "USEPA" - DataYear: NA - URL: "https://www.epa.gov/chemical-research/tool-reduction-and-assessment-chemicals-and-other-environmental-impacts-traci" - Primary: TRUE - FreshwaterEcotox: - Name: "Freshwater Ecotoxicity Potential" - Code: "ETOX" - Group: "Impact Potential" - Unit: "CTUe" - SimpleUnit: "Comparative Toxic Unit for Ecosystem (CTUe)" - SimpleName: "Freshwater Ecotoxicity" - StaticSource: TRUE - StaticFile: "lciafmt/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["Freshwater ecotoxicity"] - DataSources: - USEPA_TRACI_2.1: - Title: "TRACI 2.1" - Author: "USEPA" - DataYear: NA - URL: "https://www.epa.gov/chemical-research/tool-reduction-and-assessment-chemicals-and-other-environmental-impacts-traci" - Primary: TRUE - HumanHealthCancer: - Name: "Human Health - Cancer" - Code: "HCAN" - Group: "Impact Potential" - Unit: "CTUh" - SimpleUnit: "Comparative Toxic Unit for Humans (CTUh)" - SimpleName: "Cancer Disease" - StaticSource: TRUE - StaticFile: "lciafmt/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["Human health - cancer"] - DataSources: - USEPA_TRACI_2.1: - Title: "TRACI 2.1" - Author: "USEPA" - DataYear: NA - URL: "https://www.epa.gov/chemical-research/tool-reduction-and-assessment-chemicals-and-other-environmental-impacts-traci" - Primary: TRUE - HumanHealthNonCancer: - Name: "Human Health - Noncancer" - Code: "HNCN" - Group: "Impact Potential" - Unit: "CTUh" - SimpleUnit: "Comparative Toxic Unit for Humans (CTUh)" - SimpleName: "Noncancer Disease" - StaticSource: TRUE - StaticFile: "lciafmt/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["Human health - non-cancer"] - DataSources: - USEPA_TRACI_2.1: - Title: "TRACI 2.1" - Author: "USEPA" - DataYear: NA - URL: "https://www.epa.gov/chemical-research/tool-reduction-and-assessment-chemicals-and-other-environmental-impacts-traci" - Primary: TRUE - HumanHealthToxicity: - Name: "Human Health Toxicity" - Code: "HTOX" - Group: "Impact Potential" - Unit: "CTUh" - SimpleUnit: "Comparative Toxic Unit for Humans (CTUh)" - SimpleName: "Toxic to Humans" - StaticSource: TRUE - StaticFile: "lciafmt/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getCombinedImpactMethods" #function to call for script - ScriptFunctionParameters: - indicators: ["Human health - cancer", "Human health - non-cancer"] - DataSources: - USEEIO_LCIA_Aggregation: - Title: "Aggregation of HNCN and HCAN" - Author: NA - DataYear: NA - URL: NA - Primary: TRUE - HumanHealthRespEffects: - Name: "Human Health - Respiratory Effects" - Code: "HRSP" - Group: "Impact Potential" - Unit: "kg PM2.5 eq" - SimpleUnit: "Kilograms Particulate Matter" - SimpleName: "Respiratory Effects" - StaticSource: TRUE - StaticFile: "lciafmt/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["Human health - particulate matter"] - DataSources: - USEPA_TRACI_2.1: - Title: "TRACI 2.1" - Author: "USEPA" - URL: "https://www.epa.gov/chemical-research/tool-reduction-and-assessment-chemicals-and-other-environmental-impacts-traci" - Primary: TRUE - Ozone: - Name: "Ozone Depletion" - Code: "OZON" - Group: "Impact Potential" - Unit: "kg CFC-11 eq" - SimpleUnit: "Kilograms ChloroFluoroCarbon-11" - SimpleName: "Ozone Depletion" - StaticSource: TRUE - StaticFile: "lciafmt/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["Ozone depletion"] - DataSources: - USEPA_TRACI_2.1: - Title: "TRACI 2.1" - Author: "USEPA" - DataYear: NA - URL: "https://www.epa.gov/chemical-research/tool-reduction-and-assessment-chemicals-and-other-environmental-impacts-traci" - Primary: TRUE - Smog: - Name: "Smog Formation Potential" - Code: "SMOG" - Group: "Impact Potential" - Unit: "kg O3 eq" - SimpleUnit: "Kilograms Ozone (O3)" - SimpleName: "Smog Formation" - StaticSource: TRUE - StaticFile: "lciafmt/traci/TRACI_2.1_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["Smog formation"] - DataSources: - USEPA_TRACI_2.1: - Title: "TRACI 2.1" - Author: "USEPA" - DataYear: NA - URL: "https://www.epa.gov/chemical-research/tool-reduction-and-assessment-chemicals-and-other-environmental-impacts-traci" - Primary: TRUE - freshwater_withdrawal: - Name: "Freshwater withdrawals" - Code: "WATR" - Group: "Resource Use" - Unit: "kg" - SimpleUnit: "Kilograms" - SimpleName: "Water Use" - StaticSource: TRUE - StaticFile: "lciafmt/fedefl/FEDEFL_Inventory_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["freshwater_resources"] - DataSources: - LCIAformatter: - Title: "LCIAformatter FEDEFL Inventory Methods" - Author: "USEPA" - DataYear: 2020 - URL: "https://github.com/USEPA/LCIAformatter" - Primary: TRUE - land_use: - Name: "Land use" - Code: "LAND" - Group: "Resource Use" - Unit: "m2*yr" - SimpleUnit: "Square Meters per Year" - SimpleName: "Land Use" - StaticSource: TRUE - StaticFile: "lciafmt/fedefl/FEDEFL_Inventory_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["land_use"] - DataSources: - LCIAformatter: - Title: "LCIAformatter FEDEFL Inventory Methods" - Author: "USEPA" - DataYear: 2020 - URL: "https://github.com/USEPA/LCIAformatter" - Primary: TRUE - HAP: - Name: "Hazardous Air Pollutants" - Code: "HAPS" - Group: "Chemical Releases" - Unit: "kg" - SimpleUnit: "Kilograms" - SimpleName: "Hazardous Air Pollutants" - StaticSource: TRUE - StaticFile: "lciafmt/fedefl/FEDEFL_Inventory_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["HAP"] - DataSources: - LCIAformatter: - Title: "LCIAformatter FEDEFL Inventory Methods" - Author: "USEPA" - DataYear: 2020 - URL: "https://github.com/USEPA/LCIAformatter" - Primary: TRUE - Pesticides: - Name: "Pesticides" - Code: "PEST" - Group: "Chemical Releases" - Unit: "kg" - SimpleUnit: "Kilograms" - SimpleName: "Pesticides" - StaticSource: TRUE - StaticFile: "lciafmt/fedefl/FEDEFL_Inventory_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["USDA_CUS_pesticides"] - DataSources: - LCIAformatter: - Title: "LCIAformatter FEDEFL Inventory Methods" - Author: "USEPA" - DataYear: 2020 - URL: "https://github.com/USEPA/LCIAformatter" - Primary: TRUE - NonRenewableEnergy: - Name: "Nonrenewable Energy Use" - Code: "NNRG" - Group: "Resource Use" - Unit: "MJ" - SimpleUnit: "Megajoules (MJ)" - SimpleName: "Nonrenewable Energy Use" - StaticSource: TRUE - FileLocation: "DataCommons" - StaticFile: "lciafmt/fedefl/FEDEFL_Inventory_v1.0.0_5555779.parquet" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["nonrenewable_energy"] - DataSources: - LCIAformatter: - Title: "LCIAformatter FEDEFL Inventory Methods" - Author: "USEPA" - DataYear: 2020 - URL: "https://github.com/USEPA/LCIAformatter" - Primary: TRUE - RenewableEnergy: - Name: "Renewable Energy Use" - Code: "RNRG" - Group: "Resource Use" - Unit: "MJ" - SimpleUnit: "Megajoules (MJ)" - SimpleName: "Renewable Energy Use" - StaticSource: TRUE - StaticFile: "lciafmt/fedefl/FEDEFL_Inventory_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["renewable_energy"] - DataSources: - LCIAformatter: - Title: "LCIAformatter FEDEFL Inventory Methods" - Author: "USEPA" - DataYear: 2020 - URL: "https://github.com/USEPA/LCIAformatter" - Primary: TRUE - Energy: - Name: "Energy Use" - Code: "ENRG" - Group: "Resource Use" - Unit: "MJ" - SimpleUnit: "Megajoules (MJ)" - SimpleName: "Energy Use" - StaticSource: TRUE - StaticFile: "lciafmt/fedefl/FEDEFL_Inventory_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["energy"] - DataSources: - LCIAformatter: - Title: "LCIAformatter FEDEFL Inventory Methods" - Author: "USEPA" - DataYear: 2020 - URL: "https://github.com/USEPA/LCIAformatter" - Primary: TRUE - MineralsMetals: - Name: "Minerals and Metals Use" - Code: "MNRL" - Group: "Resource Use" - Unit: "kg" - SimpleUnit: "Kilograms" - SimpleName: "Minerals and Metals Use" - StaticSource: TRUE - StaticFile: "lciafmt/fedefl/FEDEFL_Inventory_v1.0.0_5555779.parquet" - FileLocation: "DataCommons" - ScriptFunctionCall: "getImpactMethod" #function to call for script - ScriptFunctionParameters: - indicators: ["USGS_mineral_resources"] - DataSources: - LCIAformatter: - Title: "LCIAformatter FEDEFL Inventory Methods" - Author: "USEPA" - DataYear: 2020 - URL: "https://github.com/USEPA/LCIAformatter" - Primary: TRUE - ValueAdded: - Name: "Value Added" - Code: "VADD" - Group: "Economic & Social" - Unit: "$" - SimpleUnit: "US Dollars ($)" - SimpleName: "Value Added" - StaticSource: TRUE - StaticFile: "USEEIO_LCIA_Factors.csv" - FileLocation: "useeior" - DataSources: - ingwersen_useeiov11_2017: - Title: "USEEIOv1.1 - Elementary Flows and Life Cycle Impact Assessment (LCIA) Characterization Factors" - Author: "USEPA" - DataYear: 2020 - URL: "http://doi.org/10.23719/1368541" - Primary: TRUE - Jobs: - Name: "Jobs Supported" - Code: "JOBS" - Group: "Economic & Social" - Unit: "jobs" - SimpleUnit: "Employees" - SimpleName: "Jobs Supported" - StaticSource: TRUE - StaticFile: "USEEIO_LCIA_Factors.csv" - FileLocation: "useeior" - DataSources: - ingwersen_useeiov11_2017: - Title: "USEEIOv1.1 - Elementary Flows and Life Cycle Impact Assessment (LCIA) Characterization Factors" - Author: "USEPA" - DataYear: 2020 - URL: "http://doi.org/10.23719/1368541" - Primary: TRUE - RCRAHazWaste: - Name: "Commercial RCRA Hazardous Waste" - Code: "CRHW" - Group: "Waste Generated" - Unit: "kg" - SimpleUnit: "Kilograms" - SimpleName: "Hazardous Waste" - StaticSource: TRUE - StaticFile: "USEEIO_LCIA_Factors.csv" - FileLocation: "useeior" - DataSources: - meyer_analyzing_2020: - Title: "Analyzing economy-scale solid waste generation using the United States environmentally-extended input-output model" - Author: "USEPA" - DataYear: 2020 - URL: "http://doi.org/10.1016/j.resconrec.2020.104795" - Primary: TRUE - MunicipalWaste: - Name: "Commercial Municipal Solid Waste" - Code: "CMSW" - Group: "Waste Generated" - Unit: "kg" - SimpleUnit: "Kilograms" - SimpleName: "Municipal Solid Waste" - StaticSource: TRUE - StaticFile: "USEEIO_LCIA_Factors.csv" - FileLocation: "useeior" - DataSources: - meyer_analyzing_2020: - Title: "Analyzing economy-scale solid waste generation using the United States environmentally-extended input-output model" - Author: "USEPA" - DataYear: 2020 - URL: "http://doi.org/10.1016/j.resconrec.2020.104795" - Primary: TRUE - ConstructionDebris: - Name: "Commercial Construction and Demolition Debris" - Code: "CCDD" - Group: "Waste Generated" - Unit: "kg" - SimpleUnit: "Kilograms" - SimpleName: "Construction Debris" - StaticSource: TRUE - StaticFile: "USEEIO_LCIA_Factors.csv" - FileLocation: "useeior" - DataSources: - meyer_analyzing_2020: - Title: "Analyzing economy-scale solid waste generation using the United States environmentally-extended input-output model" - Author: "USEPA" - DataYear: 2020 - URL: "http://doi.org/10.1016/j.resconrec.2020.104795" - Primary: TRUE - -DemandVectors: - DefaultDemand: "DefaultDemandVectors" # Name of default demand vectors yml file -# Additional demand vectors beyond useeior defaults - HouseholdConsumption: - Type: "Consumption" - Year: 2012 - System: "Household" - Location: "US" From b73e4e98b95b7304d6029bf68b3e98946b283799 Mon Sep 17 00:00:00 2001 From: WesIngwersen Date: Wed, 15 Nov 2023 17:13:32 -0500 Subject: [PATCH 2/7] Add State color palette to viz essentials yml --- inst/extdata/VisualizationEssentials.yml | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/inst/extdata/VisualizationEssentials.yml b/inst/extdata/VisualizationEssentials.yml index 5d0fa761..0f05bb05 100644 --- a/inst/extdata/VisualizationEssentials.yml +++ b/inst/extdata/VisualizationEssentials.yml @@ -94,3 +94,55 @@ Indicators: - "#428E55" # green, Eonomic & Social - "Jobs Supported": - "#428E55" + +# State color palette is from https://medialab.github.io/iwanthue/ +StateColorPalette: ["#d93762", +"#44c96a", +"#9969e4", +"#89c13d", +"#8b45b3", +"#43a132", +"#db4bb1", +"#c5ba34", +"#4d5ac6", +"#e09129", +"#6982ec", +"#919f35", +"#d974e1", +"#3d8339", +"#e43588", +"#56bd8a", +"#ac3e9b", +"#84b96b", +"#b13670", +"#5bcbb9", +"#d73440", +"#4ab4dd", +"#d04818", +"#406dac", +"#ee5e42", +"#3b9987", +"#af3733", +"#347c52", +"#e7699f", +"#5f7f24", +"#ba84d6", +"#c99e3b", +"#74569e", +"#bdb76b", +"#8a99dd", +"#e47d45", +"#a05e90", +"#596222", +"#d88bc1", +"#876c1d", +"#964969", +"#88894b", +"#e1646d", +"#b37e48", +"#e68c95", +"#a74f1b", +"#e6a573", +"#a64d54", +"#8c532c", +"#d07259"] From 6c3f23098eb3aa148b915e3b7c1ee776df760be3 Mon Sep 17 00:00:00 2001 From: Ben Young Date: Fri, 17 Nov 2023 10:56:09 -0500 Subject: [PATCH 3/7] remove function sourced from stateior that is not used and is replicated in other ways --- R/ValidateModel.R | 158 ++-------------------------------------------- 1 file changed, 7 insertions(+), 151 deletions(-) diff --git a/R/ValidateModel.R b/R/ValidateModel.R index d82f5b34..1e938597 100644 --- a/R/ValidateModel.R +++ b/R/ValidateModel.R @@ -323,13 +323,13 @@ printValidationResults <- function(model) { print(paste("Number of flow totals by commodity failing:",q_x_val$N_Fail)) print(paste("Sectors with flow totals failing:", paste(unique(q_x_val$Failure$rownames), collapse = ", "))) -if (model$specs$CommodityorIndustryType=="Commodity") { - print("Validate that commodity output equals to domestic use plus production demand") - q_val <- compareCommodityOutputandDomesticUseplusProductionDemand(model, tolerance = 0.01) - print(paste("Number of flow totals by commodity passing:",q_val$N_Pass)) - print(paste("Number of flow totals by commodity failing:",q_val$N_Fail)) - print(paste("Sectors with flow totals failing:", paste(unique(q_val$Failure$rownames), collapse = ", "))) -} + if (model$specs$CommodityorIndustryType=="Commodity") { + print("Validate that commodity output equals to domestic use plus production demand") + q_val <- compareCommodityOutputandDomesticUseplusProductionDemand(model, tolerance = 0.01) + print(paste("Number of flow totals by commodity passing:",q_val$N_Pass)) + print(paste("Number of flow totals by commodity failing:",q_val$N_Fail)) + print(paste("Sectors with flow totals failing:", paste(unique(q_val$Failure$rownames), collapse = ", "))) + } } #' Removes hybrid processes form a model object for successful validation @@ -354,150 +354,6 @@ removeHybridProcesses <- function(model, object) { return(object) } -#' Validate Leontief matrix (L) of two-region model and final demand against -#' SoI and RoUS output. -#' @param model A complete EEIO model: a list with USEEIO model components and attributes -#' @param state A text value specifying state of interest. -#' @return A list of validation components and result. -validate2RegionLagainstOutput <- function(model, state=NULL) { - startLogging() - #Get model data - iolevel <- model$specs$BaseIOLevel - ioschema <- model$specs$BaseIOSchema - year <- model$specs$IOYear - state_abb <- sub(".*-","",model$specs$ModelRegionAcronyms[1]) ## Extract characters after - - - # Define industries and commodities - industries <- getVectorOfCodes(ioschema, iolevel, "Industry") - commodities <- getVectorOfCodes(ioschema, iolevel, "Commodity") - ita_column <- ifelse(iolevel == "Detail", "F05100", "F051") - # Define state abbreviation - logging::loginfo(paste0("Generating A matrix of ",state_abb," (SoI) Make table ...")) - # SoI Make - TwoRegionMake <- as.data.frame(model$V) # will need to modify this when this part is moved to a new buildTwoRegionA matrix function - SoI_Make <- TwoRegionMake[endsWith(rownames(TwoRegionMake), state_abb), - endsWith(colnames(TwoRegionMake), state_abb)] - # SoI commodity output - TwoRegionCommodityOutput <- model$q - SoI_Commodity_Output <- TwoRegionCommodityOutput[endsWith(names(TwoRegionCommodityOutput), - state_abb)] - # SoI A matrix - SoI_A <- normalizeIOTransactions(SoI_Make, SoI_Commodity_Output) - # Check column sums of SoI_A - if (all(abs(colSums(SoI_A) - 1) < 1E-3)) { - logging::loginfo("FACT CHECK: column sums of A matrix of SoI Make table == 1.") - } else { - logging::logwarn("Column sums of A matrix of SoI Make table != 1") - } - - logging::loginfo("Generating A matrix of RoUS Make table ...") - # RoUS Make - RoUS_Make <- TwoRegionMake[endsWith(rownames(TwoRegionMake), "RoUS"), - endsWith(colnames(TwoRegionMake), "RoUS")] - # RoUS commodity output - RoUS_Commodity_Output <- TwoRegionCommodityOutput[endsWith(names(TwoRegionCommodityOutput), - "RoUS")] - - # RoUS A matrix - RoUS_A <- normalizeIOTransactions(RoUS_Make, RoUS_Commodity_Output) - # Check column sums of RoUS_A - if (all(abs(colSums(RoUS_A) - 1) < 1E-3)) { - logging::loginfo("FACT CHECK: column sums of A matrix of RoUS Make table == 1.") - } else { - logging::logerror("Column sums of A matrix of RoUS Make table != 1") - } - - # Two-region A matrix - # Commodity Commodity Industry Industry - # SoI RoUS SoI RoUS - # +-----------------------+-------------------------+---------------------------+----------------------------+ - # Commodity SoI | 0 | 0 |norm(SoI2SoI_Use, SoI_TIO)|norm(SoI2RoUS_Use, RoUS_TIO)| - # +-----------------------+-------------------------+---------------------------+----------------------------+ - # Commodity RoUS| 0 | 0 |norm(RoUS2SoI_Use, SoI_TIO)|norm(RoUS2RoUS_Use,RoUS_TIO)| - # +-----------------------+-------------------------+---------------------------+----------------------------+ - # Industry SoI |norm(SoI_Make, SoI_TCO)| 0 | 0 | 0 | - # +-----------------------+-------------------------+---------------------------+----------------------------+ - # Industry RoUS| 0 |norm(RoUS_Make, RoUS_TCO)| 0 | 0 | - # +-----------------------+-------------------------+---------------------------+----------------------------+ - # Total column sum must equal 1 Total column sum can but shouldn't equal 1 - - logging::loginfo("Generating two-region Domestic Use tables ...") - ls <- model$DomesticUseTransactionswithTrade - TwoRegionIndustryOutput <- model$x - SoI_Industry_Output <- TwoRegionIndustryOutput[endsWith(names(TwoRegionIndustryOutput), - state_abb)] - RoUS_Industry_Output <- TwoRegionIndustryOutput[endsWith(names(TwoRegionIndustryOutput), - "RoUS")] - # If industry/comm output == 0, it's not viable to generate A matrix, hence set it to 1. - SoI_Industry_Output[SoI_Industry_Output == 0] <- 1 - - logging::loginfo("Generating A matrix of SoI2SoI Domestic Use table ...") - SoI2SoI_A <- normalizeIOTransactions(ls[["SoI2SoI"]][, industries], - SoI_Industry_Output) - - logging::loginfo("Generating A matrix of RoUS2SoI Domestic Use table ...") - RoUS2SoI_A <- normalizeIOTransactions(ls[["RoUS2SoI"]][, industries], - SoI_Industry_Output) - - logging::loginfo("Generating A matrix of SoI2RoUS Domestic Use table ...") - SoI2RoUS_A <- normalizeIOTransactions(ls[["SoI2RoUS"]][, industries], - RoUS_Industry_Output) - - logging::loginfo("Generating A matrix of RoUS2RoUS Domestic Use table ...") - RoUS2RoUS_A <- normalizeIOTransactions(ls[["RoUS2RoUS"]][, industries], - RoUS_Industry_Output) - - logging::loginfo("Assembling the complete A matrix ...") - # Assemble A matrix - A_top <- cbind(diag(rep(0, length(commodities)*2)), - cbind(rbind(SoI2SoI_A, RoUS2SoI_A), - rbind(SoI2RoUS_A, RoUS2RoUS_A))) - colnames(A_top) <- c(1:ncol(A_top)) - A_btm <- cbind(as.matrix(Matrix::bdiag(list(as.matrix(SoI_A), - as.matrix(RoUS_A)))), - diag(rep(0, length(industries)*2))) - A <- as.matrix(rbind(A_top, setNames(A_btm, colnames(A_top)))) - rownames(A) <- paste(c(rep(c(state, "RoUS"), each = length(commodities)), - rep(c(state, "RoUS"), each = length(industries))), - c(rep(commodities, 2), rep(industries, 2)), - c(rep("Commodity", length(commodities)*2), - rep("Industry", length(industries)*2)), - sep = ".") - colnames(A) <- rownames(A) - - logging::loginfo("Generating the L matrix ...") - # Calculate L matrix - I <- diag(nrow(A)) - L <- solve(I - A, tol = 1E-20) - #----------------- END OF BUILD A, L MATRICES - logging::loginfo("Calculating y (Final Demand totals) of SoI and RoUS ...") - # Calculate Final Demand (y) - FD_columns <- getFinalDemandCodes("Summary") - ita_column <- ifelse(iolevel == "Detail", "F05100", "F051") - SoI2SoI_y <- rowSums(ls[["SoI2SoI"]][, c(FD_columns, ita_column, "ExportResidual")]) - SoI2RoUS_y <- rowSums(ls[["SoI2RoUS"]][, c(FD_columns, ita_column)]) - RoUS2SoI_y <- rowSums(ls[["RoUS2SoI"]][, c(FD_columns, ita_column)]) - RoUS2RoUS_y <- rowSums(ls[["RoUS2RoUS"]][, c(FD_columns, ita_column, "ExportResidual")]) - y <- c(SoI2SoI_y + SoI2RoUS_y, RoUS2SoI_y + RoUS2RoUS_y, rep(0, length(industries)*2)) - names(y) <- rownames(L) - - logging::loginfo("Validating L*y == commodity and industry output ...") - # Validate L * y == Output - # Output = c(SoI_TCO, RoUS_TCO, SoI_TIO, RoUS_TIO) - output <- c(SoI_Commodity_Output, RoUS_Commodity_Output, - SoI_Industry_Output, RoUS_Industry_Output) - validation <- as.data.frame(L %*% y - output) - colnames(validation) <- "L*y-output" - - validation$rel_diff <- validation$`L*y-output`/output - validation$Ly <- as.numeric(L %*% y) - validation$output <- output - validation[validation$output == 1, "rel_diff"] <- 0 - - logging::loginfo("Validation complete.") - return(list(A = A, L = L, y = y, Validation = validation)) -} - #' Compare commodity or industry output calculated from Make and Use tables. #' @param model A model list object with model specs and IO tables listed #' @param output_type A string indicating commodity or industry output. From 9269c08b20512e6732af3a4ddec46d6fd69246cb Mon Sep 17 00:00:00 2001 From: Ben Young Date: Fri, 17 Nov 2023 11:13:44 -0500 Subject: [PATCH 4/7] drop documentation --- man/validate2RegionLagainstOutput.Rd | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 man/validate2RegionLagainstOutput.Rd diff --git a/man/validate2RegionLagainstOutput.Rd b/man/validate2RegionLagainstOutput.Rd deleted file mode 100644 index ccc6e918..00000000 --- a/man/validate2RegionLagainstOutput.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ValidateModel.R -\name{validate2RegionLagainstOutput} -\alias{validate2RegionLagainstOutput} -\title{Validate Leontief matrix (L) of two-region model and final demand against -SoI and RoUS output.} -\usage{ -validate2RegionLagainstOutput(model, state = NULL) -} -\arguments{ -\item{model}{A complete EEIO model: a list with USEEIO model components and attributes} - -\item{state}{A text value specifying state of interest.} -} -\value{ -A list of validation components and result. -} -\description{ -Validate Leontief matrix (L) of two-region model and final demand against -SoI and RoUS output. -} From e47169d86d82f26049faad2e6b0b69f1979f00e1 Mon Sep 17 00:00:00 2001 From: WesIngwersen Date: Tue, 5 Dec 2023 15:17:31 -0500 Subject: [PATCH 5/7] write only first region out in model meta for API; suspend flow name check before writing due to #244 --- R/WriteModel.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/WriteModel.R b/R/WriteModel.R index 27691ead..514cd550 100644 --- a/R/WriteModel.R +++ b/R/WriteModel.R @@ -209,7 +209,7 @@ writeModelMetadata <- function(model, dirs) { model_desc <- file.path(dirs$data, "models.csv") ID <- model$specs$Model Name <- model$specs$Model - Location <- model$specs$ModelRegionAcronyms + Location <- model$specs$ModelRegionAcronyms[1] Description <- "" #Add in sector schema for model if (is.null(model$specs$DisaggregationSpecs)) { @@ -276,8 +276,8 @@ writeModelMetadata <- function(model, dirs) { flows <- flows[order(flows$ID),] flows$Index <- c(1:nrow(flows)-1) flows <- flows[, fields$flows] - checkNamesandOrdering(flows$ID, rownames(model$B), - "flows in flows.csv and rows in B matrix") + #checkNamesandOrdering(flows$ID, rownames(model$B), + # "flows in flows.csv and rows in B matrix") utils::write.csv(flows, paste0(dirs$model, "/flows.csv"), na = "", row.names = FALSE, fileEncoding = "UTF-8") From 2706f298754661e090027dd736634b078df475af Mon Sep 17 00:00:00 2001 From: jvendries Date: Thu, 4 Jan 2024 17:07:37 -0500 Subject: [PATCH 6/7] Change nomenclature in model from M_m to Q_t to align with nomenclature from Palm paper. --- R/BuildModel.R | 4 ++-- R/CalculationFunctions.R | 6 +++--- R/IOFunctions.R | 12 ++++++------ R/LoadExternalImportFactors.R | 12 ++++++------ R/ValidateModel.R | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/R/BuildModel.R b/R/BuildModel.R index 6d35683d..7eaa958e 100644 --- a/R/BuildModel.R +++ b/R/BuildModel.R @@ -137,9 +137,9 @@ constructEEIOMatrices <- function(model, configpaths = NULL) { } logging::loginfo("Calculating N_d matrix (total environmental impacts per dollar from domestic activity)...") model$N_d <- model$C %*% model$M_d - if(!is.null(model$M_m)) { + if(!is.null(model$Q_t)) { logging::loginfo("Calculating N_m matrix (total environmental impacts per dollar from imported activity)...") - model$N_m <- model$C %*% model$M_m # I don't think this is correct. See ImportFactorsTests.rmd, "Calculate the N matrix for the standard model using coupled model approach" chunk. + model$N_m <- model$C %*% model$Q_t # I don't think this is correct. See ImportFactorsTests.rmd, "Calculate the N matrix for the standard model using coupled model approach" chunk. } } diff --git a/R/CalculationFunctions.R b/R/CalculationFunctions.R index 00e2599c..ed76b1e6 100644 --- a/R/CalculationFunctions.R +++ b/R/CalculationFunctions.R @@ -117,15 +117,15 @@ calculateResultsWithExternalFactors <- function(model, demand = "Consumption", u if (use_domestic_requirements) { result$LCI_f <- (model$B %*% model$L_d %*% y_d) } else { - result$LCI_f <- (model$B %*% model$L_d %*% y_d) + (model$M_m %*% model$A_m %*% model$L_d %*% y_d + model$M_m %*% y_m) + result$LCI_f <- (model$B %*% model$L_d %*% y_d) + (model$Q_t %*% model$A_m %*% model$L_d %*% y_d + model$Q_t %*% y_m) } result$LCIA_f <- model$C %*% result$LCI_f result$LCI_f <- t(result$LCI_f) result$LCIA_f <- t(result$LCIA_f) - colnames(result$LCI_f) <- rownames(model$M_m) - rownames(result$LCI_f) <- colnames(model$M_m) + colnames(result$LCI_f) <- rownames(model$Q_t) + rownames(result$LCI_f) <- colnames(model$Q_t) colnames(result$LCIA_f) <- rownames(model$N_m) rownames(result$LCIA_f) <- colnames(model$N_m) diff --git a/R/IOFunctions.R b/R/IOFunctions.R index 65a46ec2..bce6c454 100644 --- a/R/IOFunctions.R +++ b/R/IOFunctions.R @@ -277,14 +277,14 @@ buildModelwithImportFactors <- function(model, configpaths = NULL) { logging::loginfo("Calculating M_d matrix (total emissions and resource use per dollar from domestic activity)...") model$M_d <- model$B %*% model$L_d - logging::loginfo("Calculating M_m matrix (total emissions and resource use per dollar from imported activity)...") - M_m <- loadExternalImportFactors(model, configpaths) + logging::loginfo("Calculating Q_t matrix (total emissions and resource use per dollar from imported activity)...") + Q_t <- loadExternalImportFactors(model, configpaths) - # Fill in flows for M_m not found in Import Factors but that exist in model and align order - M_m <- rbind(M_m, model$M_d[setdiff(rownames(model$M_d), rownames(M_m)),]) - M_m <- M_m[rownames(model$M_d), ] + # Fill in flows for Q_t not found in Import Factors but that exist in model and align order + Q_t <- rbind(Q_t, model$M_d[setdiff(rownames(model$M_d), rownames(Q_t)),]) + Q_t <- Q_t[rownames(model$M_d), ] - model$M_m <- M_m + model$Q_t <- Q_t return(model) } diff --git a/R/LoadExternalImportFactors.R b/R/LoadExternalImportFactors.R index ae8e6685..22294dd5 100644 --- a/R/LoadExternalImportFactors.R +++ b/R/LoadExternalImportFactors.R @@ -4,7 +4,7 @@ #' @param model An EEIO form USEEIO model object with model specs loaded #' @param configpaths str vector, paths (including file name) of model configuration file #' and optional agg/disagg configuration file(s). If NULL, built-in config files are used. -#' @return M_m, matrix of import coefficients (flow x sector). +#' @return Q_t, matrix of import coefficients (flow x sector). loadExternalImportFactors <- function(model, configpaths = NULL) { # Read in file with Import factors @@ -50,12 +50,12 @@ loadExternalImportFactors <- function(model, configpaths = NULL) { IFTable['Location'] <- "US" } - M_m <- standardizeandcastSatelliteTable(IFTable, model) + Q_t <- standardizeandcastSatelliteTable(IFTable, model) # standardizeandcast prepares df for industries, convert to commodities - M_m[, setdiff(model$Commodities$Code_Loc, colnames(M_m))] <- 0 + Q_t[, setdiff(model$Commodities$Code_Loc, colnames(Q_t))] <- 0 # Adjust column order to be the same with V_n rownames - M_m <- M_m[, model$Commodities$Code_Loc] - M_m <- as.matrix(M_m) + Q_t <- Q_t[, model$Commodities$Code_Loc] + Q_t <- as.matrix(Q_t) - return(M_m) + return(Q_t) } diff --git a/R/ValidateModel.R b/R/ValidateModel.R index 9540e151..9512a1bc 100644 --- a/R/ValidateModel.R +++ b/R/ValidateModel.R @@ -564,12 +564,12 @@ validateImportFactorsApproach <- function(model, demand = "Consumption"){ # Calculate LCI using coupled model approach # Revised equation from RW email (2023-11-01): # LCI <- (s_d * L_d * Y_d) + (s*L*A_m*L_d*Y_d + s*L*Y_m). I.e., s in RW email is analogous to model$B - # For validation, model$M = model$M_m, whereas in normally we'd be using model$M_m instead of model$M + # For validation, model$M = model$Q_t, whereas in normally we'd be using model$Q_t instead of model$M LCI_dm <- (model$M_d %*% y_d) + (M %*% model$A_m %*% model$L_d %*% y_d + M %*% y_m) cat("\nTesting that LCI results are equivalent between standard and coupled model approaches (i.e., LCI = LCI_dm) when\n") - cat("assuming model$M = model$M_m.\n") + cat("assuming model$M = model$Q_t.\n") print(all.equal(LCI, LCI_dm)) # Calculate LCIA using standard approach @@ -588,7 +588,7 @@ validateImportFactorsApproach <- function(model, demand = "Consumption"){ rownames(LCIA_dm) <- colnames(model$N_m) cat("\nTesting that LCIA results are equivalent between standard and coupled model approaches (i.e., LCIA = LCIA_dm) when\n") - cat("assuming model$M = model$M_m.\n") + cat("assuming model$M = model$Q_t.\n") all.equal(LCIA_dm, LCIA) } From 0feb975b7572a4cecebdcf38a5a35f975e459dea Mon Sep 17 00:00:00 2001 From: jvendries Date: Thu, 4 Jan 2024 20:18:21 -0500 Subject: [PATCH 7/7] Update comment in validateImportFactorsApproch --- R/ValidateModel.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/ValidateModel.R b/R/ValidateModel.R index 9512a1bc..ba861ef6 100644 --- a/R/ValidateModel.R +++ b/R/ValidateModel.R @@ -564,7 +564,7 @@ validateImportFactorsApproach <- function(model, demand = "Consumption"){ # Calculate LCI using coupled model approach # Revised equation from RW email (2023-11-01): # LCI <- (s_d * L_d * Y_d) + (s*L*A_m*L_d*Y_d + s*L*Y_m). I.e., s in RW email is analogous to model$B - # For validation, model$M = model$Q_t, whereas in normally we'd be using model$Q_t instead of model$M + # For validation, we use M as a stand-in for import emissions , whereas in normally we'd be using model$Q_t LCI_dm <- (model$M_d %*% y_d) + (M %*% model$A_m %*% model$L_d %*% y_d + M %*% y_m)