OSeMOSYS / otoole

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

Loosing data when working with only one year and converting from datapackage to excel and back #99

Closed HauHe closed 1 year ago

HauHe commented 4 years ago

I am working on a model that has only one model year. To modify it I converted the datapackage to an excel file. When editing the excel file I didn't notice that otoole had for some parameter not created a column for the year, but instead put the year as header to the value column. When converting the excel back to a datapackage the csv files for the parameter where this was the case remained empty and hence the model didn't run.

trevorb1 commented 1 year ago

While I wasn't able to perfectly recreate this issue, partly because v0.11.0 does not want to convert to excel, I was able to recreate something similar to it. Specifically, how converting to excel and then back from excel will drop parameters (even if the model horizon is more than one year!).

It seems like when converting to excel, if the parameter only has a default value then an excel sheet will not be created for it. Then when we read the excel file back in, any parameter that does not have a sheet is dropped from the internal datastore. This means all parameters that only have a default value will be dropped in this process.

I left a thought/question about how we write out parameters to excel in this comment in issue #114. However, I also launched PR #136 which should fix this issue.