OSeMOSYS / otoole

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

Error when converting old data files with generic DiscountRate #109

Closed HauHe closed 1 year ago

HauHe commented 3 years ago

The implementation of the technology specific DiscountRate doesn't produce any problems when running old models where the discount rate is defined only per region. However, otoole produces an error when converting such datafiles, for example from datafile to datapackage. This can be avoided when the format in the datafile is changed from: param DiscountRate default 0 := REGION1 0.05 ; to param DiscountRate default 0.05 := ;

Nevertheless, perhaps this could be fixed to avoid confusion for people who are less familiar with the developments of OSeMOSYS.

robertodawid commented 1 year ago

I have been experiencing this error since quite some time ago, I use otoole 0.11.0 AmplyError: Incomplete data record, expecting 2 subscripts per value After testing every parameter, in the data file, the issue is with the DiscountRate. For now, the only solution available I found is to manually change to: param DiscountRate default 0.05 := ;

Any hint of how to solve this?

willu47 commented 1 year ago

Hi @robertodawid. This issue is because in versions of otoole prior to the forthcoming v1.0, otoole uses a hardcoded representation of the OSeMOSYS parameters. If this does not match the model you are using, these types of errors occur. In version 1.0 users will be required to provide a configuration file which describes the parameters with indices and sets that make up those indices.

trevorb1 commented 1 year ago

Hi @robertodawid, thanks for flagging the error! otoole v1.0.0 is now released, and @willu47's solution should be good to implement; just make sure you update your otoole version via pip! 🙂

Instructions on how to generate a template configuration file can be found here: https://otoole.readthedocs.io/en/latest/examples.html#template-setup

Examples on how to modify the configuration file can be found here: https://otoole.readthedocs.io/en/latest/data.html#user-configuration-file

Examples on how to use the configuration file with otoole convert commands can be found here: https://otoole.readthedocs.io/en/latest/examples.html#data-conversion