Skip to content

Commit

Permalink
update error message for unrecognized "data_format"
Browse files Browse the repository at this point in the history
  • Loading branch information
catherinebirney committed Dec 12, 2023
1 parent 1d39802 commit 15c6c1f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions flowsa/flowby.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ def get_flowby_from_config(

external_data_path = config.get('external_data_path')

if config['data_format'] == 'FBA':
if config.get('data_format') == 'FBA':
return FlowByActivity.return_FBA(
full_name=name,
config=config,
download_ok=download_sources_ok,
external_data_path=external_data_path
)
elif config['data_format'] == 'FBS':
elif config.get('data_format') == 'FBS':
return FlowBySector.return_FBS(
method=name,
config=config,
Expand All @@ -64,7 +64,7 @@ def get_flowby_from_config(
download_fbs_ok=download_sources_ok,
external_data_path=external_data_path
)
elif config['data_format'] == 'FBS_outside_flowsa':
elif config.get('data_format') == 'FBS_outside_flowsa':
return FlowBySector(
config['FBS_datapull_fxn'](
config=config,
Expand All @@ -75,9 +75,14 @@ def get_flowby_from_config(
config=config
)
else:
log.critical(f'Unrecognized data format {config["data_format"]} for '
f'source {name}')
raise ValueError('Unrecognized data format')
log.critical(f'Unrecognized `config["data_format"] = '
f'{config.get("data_format")}` for source {name}')
raise ValueError('Unrecognized data format, check assignment in '
'.../flowsa/methods/method_status.yaml or assign '
'within the method yaml. Data formats allowed: '
'"FBA", "FBS", "FBS_outside_flowsa".')




class _FlowBy(pd.DataFrame):
Expand Down

0 comments on commit 15c6c1f

Please sign in to comment.