Skip to content

Commit

Permalink
updates for stewi_to_sector
Browse files Browse the repository at this point in the history
  • Loading branch information
bl-young committed Nov 12, 2022
1 parent c9b9003 commit 1012098
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
13 changes: 10 additions & 3 deletions flowsa/data_source_scripts/stewiFBS.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ def stewicombo_to_sector(
return fbs


def stewi_to_sector(config, **_) -> 'FlowBySector':
def stewi_to_sector(
config,
full_name,
external_config_path: str = None,
**_
) -> 'FlowBySector':
"""
Returns emissions from stewi in fbs format, requires stewi >= 0.9.5
:param config: which may contain the following elements:
Expand All @@ -105,6 +110,7 @@ def stewi_to_sector(config, **_) -> 'FlowBySector':
"""
# determine if fxns specified in FBS method yaml
functions = config.get('functions', [])
config['full_name'] = full_name

# run stewi to generate inventory and filter for LCI
df = pd.DataFrame()
Expand Down Expand Up @@ -289,8 +295,9 @@ def prepare_stewi_fbs(df_load, config) -> 'FlowBySector':
:return: df
"""
config['sector-like_activities']=True
config['fedefl_mapping'] = list(
config.get('inventory_dict').keys())
config['fedefl_mapping'] = (
[x for x in config.get('inventory_dict').keys()
if x != 'RCRAInfo'])
config['drop_unmapped_rows'] = True

# update location to appropriate geoscale prior to aggregating
Expand Down
7 changes: 4 additions & 3 deletions flowsa/methods/flowbysectormethods/CRHW_national_2017.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
industry_spec:
default: NAICS_6
year: 2017
geoscale: national
source_names:
stewiFBS:
data_format: FBS_outside_flowsa
FBS_datapull_fxn: !script_function:stewiFBS stewi_to_sector
# temporarily maintain target_sector_level for
# allocation.equally_allocate_parent_to_child_naics()
target_sector_level: NAICS_6
# Below are arguments needed by the stewicombo_to_sector function
inventory_dict: {"RCRAInfo":"2017"}
compartments:
- waste
7 changes: 4 additions & 3 deletions flowsa/methods/flowbysectormethods/CRHW_state_2017.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
industry_spec:
default: NAICS_6
year: 2017
geoscale: state
source_names:
stewiFBS:
data_format: FBS_outside_flowsa
FBS_datapull_fxn: !script_function:stewiFBS stewi_to_sector
# temporarily maintain target_sector_level for
# allocation.equally_allocate_parent_to_child_naics()
target_sector_level: NAICS_6
# Below are arguments needed by the stewicombo_to_sector function
inventory_dict: {"RCRAInfo":"2017"}
compartments:
- waste
7 changes: 4 additions & 3 deletions flowsa/methods/flowbysectormethods/TRI_DMR_national_2017.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
industry_spec:
default: NAICS_6
year: 2017
geoscale: national
source_names:
stewiFBS:
data_format: FBS_outside_flowsa
FBS_datapull_fxn: !script_function:stewiFBS stewicombo_to_sector
# temporarily maintain target_sector_level for
# allocation.equally_allocate_parent_to_child_naics()
target_sector_level: NAICS_6
# Below are arguments needed by the stewicombo_to_sector function
inventory_dict: {"TRI":"2017", "DMR":"2017"}
local_inventory_name: TRI_DMR_2017
compartments:
Expand Down
7 changes: 4 additions & 3 deletions flowsa/methods/flowbysectormethods/TRI_DMR_state_2017.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
industry_spec:
default: NAICS_6
year: 2017
geoscale: state
source_names:
stewiFBS:
data_format: FBS_outside_flowsa
FBS_datapull_fxn: !script_function:stewiFBS stewicombo_to_sector
# temporarily maintain target_sector_level for
# allocation.equally_allocate_parent_to_child_naics()
target_sector_level: NAICS_6
# Below are arguments needed by the stewicombo_to_sector function
inventory_dict: {"TRI":"2017", "DMR":"2017"}
local_inventory_name: TRI_DMR_2017
compartments:
Expand Down

0 comments on commit 1012098

Please sign in to comment.