OSeMOSYS / otoole

OSeMOSYS Tools for Energy
https://otoole.readthedocs.io
MIT License
25 stars 19 forks source link

Problem when working with datafile from MoManI #124

Open HauHe opened 2 years ago

HauHe commented 2 years ago

Hi I ran a model that I originally extracted from MoManI using cplex. Now I would like to convert the results sol to csv files. But I get the error below:

otoole --verbose results cplex csv DE_25sens.sol result_csvs --input_datafile DE_25sens_data.txt
Traceback (most recent call last):
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\Scripts\otoole.exe\__main__.py", line 7, in <module>
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\site-packages\otoole\cli.py", line 299, in main
    args.func(args)
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\site-packages\otoole\cli.py", line 113, in result_matrix
    input_data, _ = ReadDatafile().read(args.input_datafile)
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\site-packages\otoole\read_strategies.py", line 215, in read
    amply_datafile = self.read_in_datafile(filepath, config)
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\site-packages\otoole\read_strategies.py", line 232, in read_in_datafile
    datafile_parser.load_file(datafile)
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\site-packages\amply\amply.py", line 817, in load_file
    self.load_string(f.read())
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\site-packages\amply\amply.py", line 806, in load_string
    obj.eval(self)
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\site-packages\amply\amply.py", line 311, in eval
    obj.addData(self.records.asList(), default=self.default)
  File "C:\Users\adm.esa\Anaconda3\envs\otoole\lib\site-packages\amply\amply.py", line 440, in addData
    " subscripts per value" % len(self.free_indices)
amply.amply.AmplyError: Incomplete data record, expecting 2 subscripts per value

I also tried to convert the datafile used to a datapackage, but I get the same error. Is the conversion of MoManI datafile not possible with otoole? Or is there an other issue?

HauHe commented 2 years ago

@willu47 , do you know what might be the problem here? If you point me in a direction, perhaps I could fix it.