Skip to content

Commit

Permalink
Merge pull request #29 from USEPA/import_factors
Browse files Browse the repository at this point in the history
Import factors
  • Loading branch information
bl-young authored Aug 3, 2024
2 parents 35a63e0 + 581c685 commit 1d42b17
Show file tree
Hide file tree
Showing 103 changed files with 90,484 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import_factors_exio/*__pycache__*
import_factors_exio/mrio_models/*
import_factors_exio/processed_mrio_resources/*
import_factors_exio/output/*
import_factors_exio/response_data/*
import_factors_exio/API/*API_key.yaml
!import_factors_exio/output/*import_factors_exio_2019*
!import_factors_exio/output/aggregate*
!import_factors_exio/output/import_shares_2019*
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ A modeling framework for creating versions of the [USEEIO](https://www.epa.gov/l
potential impacts of goods and services in the US economy. This framework supports the Sustainable Materials Management program at US EPA (www.epa.gov/smm),
but may also be useful for other purposes. It is built using methods from input-output analysis and life cycle assessment (LCA) that combine industry economic data with data on environmental releases and resources used. A background and description of USEEIO can be found in the original manuscript cited below.

Within this repository are scripts to support:
1. JSON-LD versions of a USEEIO model in [u2o.py](olca/u2o.py)
2. The generation of Import Emission Factors from EXBIOASE [here](import_factors_exio/README.md)

## Current platform
[useeior](https://github.com/USEPA/useeior). An R package that reads in economic data, houses model configuration files, generates model components, result matrices and price adjustment matrices, and performs model calculations. useeior is used to generate USEEIO models >= v2.0

Expand Down
7 changes: 4 additions & 3 deletions VersioningScheme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ The base IO schema is the set of sector codes and names for commodities and indu
USEEIO models have used the BEA IO schema, which is updated every 5 years along with the release of the benchmark, detailed level IO tables for the same year.
USEEIO models alter names for commodities in the schema and may add or remove sectors, and hence the IO schema is used as the base schema for the model but will not necessarily be identical to the model IO schema.

| Major Version | IO Schema | Benchmark IO Data Year |
| Major / Minor Version | IO Schema | Benchmark IO Data Year |
|---|---|---|
| 1 | BEA 2007 | 2007 |
| 2 | BEA 2012 | 2012 |
| 1.0 | BEA 2007 | 2007 |
| 2.0 | BEA 2012 | 2012 |
| 2.2 | BEA 2017 | 2017 |

## Examples of model names

Expand Down
29 changes: 29 additions & 0 deletions import_factors_exio/API/BEA_API.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
author: US Bureau of Economic Analysis
source_name: International Services
source_url: https://www.bea.gov/data/intl-trade-investment/international-trade-goods-and-services
bib_id: BEA
api_name: BEA
api_key_required: True
format: [json,xml]
url:
base_url: https://apps.bea.gov/api/data/?
url_params:
Affiliation: AllAffiliations
method: GetData
DataSetName: IntlServTrade
TradeDirection: Imports
ResultFormat: json
AreaOrCountry: __areaorcountry__
Year: __year__
years:
- 2012
- 2013
- 2014
- 2015
- 2016
- 2017
- 2018
- 2019
- 2020
- 2021
- 2022
26 changes: 26 additions & 0 deletions import_factors_exio/API/Census_API.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
author: US Census Bureau
source_name: USA Data
source_url: https://usatrade.census.gov/
bib_id: Census
api_key_required: False
format: json
url:
base_url: http://api.census.gov/data/timeseries/intltrade/imports/naics?
url_params:
get: NAICS,GEN_CIF_YR,CTY_CODE
COMM_LVL: NA6
CTY_CODE: __areaorcountry__
YEAR: __year__
MONTH: "12"
years:
- 2012
- 2013
- 2014
- 2015
- 2016
- 2017
- 2018
- 2019
- 2020
- 2021
- 2022
25 changes: 25 additions & 0 deletions import_factors_exio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generating Import Emission Factors from Exiobase
To generate import emission factors from exiobase, run the script [generate_import_factors.py](generate_import_factors.py)

For each year, the following files are generated:

- *US_detail_import_factors_exio_{year}.csv*: Single set of import factors for the US by detail sector.
- *US_summary_import_factors_exio_{year}.csv*: Single set of import factors for the US by summary sector.
- *Regional_detail_import_factors_exio_{year}.csv*: Import factors for each of seven regions, by detail sector,
- *Regional_summary_import_factors_exio_{year}.csv*: Import factors for each of seven regions, by summary sector,
- *import_shares_{year}.csv*: Provides the contribution to sector imports by country
- *multiplier_df_exio_{year}.csv*: Full dataframe with emission factors and contributions by region and sector.

File names are appended with the BEA schema year, e.g., `_17sch`.

## BEA API Access
To make calls to BEA for service imports data (by BEA service category, country, and year), users must first register at https://apps.bea.gov/api/signup/.
After doing so, users will be provided with an API key to the provided email.
Store this as 'BEA_API_key.yaml' in the API subfolder of the import_factors_exio directory.

## Package requirements
- pandas
- esupy
- fedelemflowlist
- [currencyconverter](https://pypi.org/project/CurrencyConverter/)
- pymrio
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
BEA Service,API BEA Service,BEA_Detail_2012,BEA_Detail_2017
Maintenance and repair services n.i.e.,MaintenanceAndRepairNie,811100,811100
Maintenance and repair services n.i.e.,MaintenanceAndRepairNie,811200,811200
Maintenance and repair services n.i.e.,MaintenanceAndRepairNie,811300,811300
Maintenance and repair services n.i.e.,MaintenanceAndRepairNie,811400,811400
Transport,Transport,481000,481000
Transport,Transport,492000,492000
Insurance services,Insurance,524113,524113
Insurance services,Insurance,5241XX,5241XX
Insurance services,Insurance,524200,524200
Financial services,Financial,523A00,523A00
Financial services,Financial,523900,523900
Financial services,Financial,52A000,52A000
Financial services,Financial,522A00,522A00
"Telecommunications, computer, and information services",TelecomCompAndInfo,517110,517110
"Telecommunications, computer, and information services",TelecomCompAndInfo,517210,517210
"Telecommunications, computer, and information services",TelecomCompAndInfo,517A00,517A00
"Telecommunications, computer, and information services",TelecomCompAndInfo,541511,541511
"Telecommunications, computer, and information services",TelecomCompAndInfo,541512,541512
"Telecommunications, computer, and information services",TelecomCompAndInfo,54151A,54151A
"Telecommunications, computer, and information services",TelecomCompAndInfo,511200,511200
"Telecommunications, computer, and information services",TelecomCompAndInfo,518200,518200
"Telecommunications, computer, and information services",TelecomCompAndInfo,511110,511110
"Telecommunications, computer, and information services",TelecomCompAndInfo,511120,511120
"Telecommunications, computer, and information services",TelecomCompAndInfo,511130,511130
"Telecommunications, computer, and information services",TelecomCompAndInfo,5111A0,5111A0
"Telecommunications, computer, and information services",TelecomCompAndInfo,519130,519130
"Telecommunications, computer, and information services",TelecomCompAndInfo,5191A0,5191A0
Professional and management consulting services,ProfMgmtConsult,541800,541800
Professional and management consulting services,ProfMgmtConsult,561300,561300
Professional and management consulting services,ProfMgmtConsult,561700,561700
Professional and management consulting services,ProfMgmtConsult,561100,561100
Professional and management consulting services,ProfMgmtConsult,561200,561200
Professional and management consulting services,ProfMgmtConsult,561400,561400
Professional and management consulting services,ProfMgmtConsult,561500,561500
Professional and management consulting services,ProfMgmtConsult,561600,561600
Professional and management consulting services,ProfMgmtConsult,561900,561900
"Legal, accounting, management consulting, and public relations services",LegalAccountMgmtConsAndPubRel,541100,541100
"Legal, accounting, management consulting, and public relations services",LegalAccountMgmtConsAndPubRel,541200,541200
"Technical, trade-related, and other business services",TechTradeRelatedOth,541300,541300
"Technical, trade-related, and other business services",TechTradeRelatedOth,541610,541610
"Technical, trade-related, and other business services",TechTradeRelatedOth,5416A0,5416A0
"Technical, trade-related, and other business services",TechTradeRelatedOth,541400,541400
"Technical, trade-related, and other business services",TechTradeRelatedOth,5419A0,5419A0
"Technical, trade-related, and other business services",TechTradeRelatedOth,541920,541920
"Technical, trade-related, and other business services",TechTradeRelatedOth,541940,541940
"Technical, trade-related, and other business services",TechTradeRelatedOth,541700,541700
"Technical, trade-related, and other business services",TechTradeRelatedOth,562111,562000
"Technical, trade-related, and other business services",TechTradeRelatedOth,562HAZ,562000
"Technical, trade-related, and other business services",TechTradeRelatedOth,562212,562000
"Technical, trade-related, and other business services",TechTradeRelatedOth,562213,562000
"Technical, trade-related, and other business services",TechTradeRelatedOth,562910,562000
"Technical, trade-related, and other business services",TechTradeRelatedOth,562920,562000
"Technical, trade-related, and other business services",TechTradeRelatedOth,562OTH,562000
"Technical, trade-related, and other business services",TechTradeRelatedOth,213111,213111
"Technical, trade-related, and other business services",TechTradeRelatedOth,21311A,21311A
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,711100,711100
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,711200,711200
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,711A00,711A00
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,711500,711500
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,712000,712000
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,512100,512100
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,512200,512200
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,611100,611100
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,611A00,611A00
"Personal, cultural, and recreational services",PersonalCulturalAndRecreational,611B00,611B00
Government goods and services n.i.e.,GovtGoodsAndServicesNie,491000,491000
Government goods and services n.i.e.,GovtGoodsAndServicesNie,S00101,S00101
Government goods and services n.i.e.,GovtGoodsAndServicesNie,S00102,S00102
Loading

0 comments on commit 1d42b17

Please sign in to comment.