Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cannot read TradeRoute from Excel #165

Open
willu47 opened this issue Apr 20, 2023 · 0 comments
Open

[Bug]: Cannot read TradeRoute from Excel #165

willu47 opened this issue Apr 20, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@willu47
Copy link
Member

willu47 commented Apr 20, 2023

The Issue

The TradeRoute parameter has two REGION indexes, and issue discussed in #130.

Expected Behavior

The TradeRoute parameter should be converted to whatever format with the two indices intact.

Steps To Reproduce

Set up an Excel file with the TradeRoute parameter

REGION	REGION	FUEL	2015 2016 2017
a b ELC 1 1 1
a a ELC 0 0 0

and a config file config.yaml:

TradeRoute:
    indices: [REGION,REGION,FUEL,YEAR]
    type: param
    dtype: float
    default: 0

and then run otoole convert excel csv <workbook.xlsx> <folder> config.yaml

Log output

DEBUG:otoole.input:Expected indices for TradeRoute are ['REGION', 'REGION', 'FUEL', 'YEAR']
Traceback (most recent call last):
  File "/Users/wusher/miniconda3/envs/otoole38/bin/otoole", line 33, in <module>
    sys.exit(load_entry_point('otoole', 'console_scripts', 'otoole')())
  File "/Users/wusher/repository/otoole/src/otoole/cli.py", line 470, in main
    args.func(args)
  File "/Users/wusher/repository/otoole/src/otoole/cli.py", line 220, in conversion_matrix
    input_data, _ = read_strategy.read(args.from_path)
  File "/Users/wusher/repository/otoole/src/otoole/read_strategies.py", line 158, in read
    input_data = self._check_index(input_data)
  File "/Users/wusher/repository/otoole/src/otoole/input.py", line 388, in _check_index
    self._check_param_index_names(name=name, config=details, df=df)
  File "/Users/wusher/repository/otoole/src/otoole/input.py", line 435, in _check_param_index_names
    raise OtooleIndexError(
otoole.exceptions.OtooleIndexError: TradeRoute -> Indices inconsistent between config and data. Config indices are ['REGION', 'REGION', 'FUEL', 'YEAR']. Data indices are ['REGION', 'REGION.1', 'FUEL', 'YEAR'].

Operating System

MacOS

What version of otoole are you running?

v1.01

Possible Solution

Investigate using xarray as an internal data store. This allows the definition of variables over duplicate dimensions.

Anything else?

No response

@willu47 willu47 added the bug Something isn't working label Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant