OSeMOSYS / OSeMOSYS_PuLP

OSeMOSYS_PuLP: A Stochastic Modelling Framework for Long-Term Energy Systems Modeling
Apache License 2.0
14 stars 6 forks source link

Cannot run model using data #4

Open willu47 opened 4 years ago

willu47 commented 4 years ago

When trying to run OSeMOSYS PuLP for the first time, I get the following error:

python OSeMOSYS_PuLP.py 
INFO:root:2020-10-16 14:07:00   Script started.
Traceback (most recent call last):
  File "/Users/wusher/miniconda3/envs/otoole/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2891, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'REGION'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "OSeMOSYS_PuLP.py", line 427, in <module>
    sets_df, p_df, p_default_df, mcs_df, mcs_num = loadData(inputPath, sheetSets, sheetParams, sheetParamsDefault, sheetMcs, sheetMcsNum)
  File "OSeMOSYS_PuLP.py", line 90, in loadData
    sets_df['REGION'] = sets_df['REGION'].astype(str)
  File "/Users/wusher/miniconda3/envs/otoole/lib/python3.7/site-packages/pandas/core/frame.py", line 2902, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/Users/wusher/miniconda3/envs/otoole/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2893, in get_loc
    raise KeyError(key) from err
KeyError: 'REGION'

I'm using Python 3.7, pandas 1.1.2 and PuLP 2.3 on OSX.

Looking at the UTOPIA_BASE.xlsx provided, the format of the SET worksheet doesn't seem to match the code. Perhaps the data format needs to be updated?