You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. Whether an issue with the code itself, or just the documentation, I encountered issue with creating a Calliope model with calliope.model(...) from a previous model.
I was attempting to run a model in 'plan' mode and then use the capacity outputs from that model in a new model in 'operate' mode. Although it states that this is possible, it is not immediately clear from the documentation how to do this. Apologies, I do not have this code any longer to upload but to explain...
I created a plan model object: model_plan = calliope.model('model.yaml', ...)
Then built and solve: model_plan.build() >> model_plan.solve()
I then tried to create an operate model object, taking the model_plan as an input argument for the 'model_definition' parameter i.e.: model_operate = calliope.model(model_plan,...)
This failed.
I expected this to work as the dev5 documentation (https://calliope.readthedocs.io/en/v0.7.0.dev5/reference/api/model/?h=calliope.model#calliope.Model) for calliope.model() suggests that 'model_definition' can be a string, path, dictionary, or xarray dataset. With model_plan, a calliope model object, being an xarray dataset, I expected it to be a valid argument. Instead I received 'encoding' errors which may or may not be unique to the Windows OS. I did notice in the calliope backend a few times where UTF-8 was hardcoded for os.reads but not os.writes. Perhaps it may be better to use OS default or at least make this encoding consisting for writing and reading.
What i have later been informed is that instead of importing the model_plan object, I could have saved this file as a .netcdf and run the calliope.read_netcdf('model_plan_path') as the input parameter for 'model_definition.' If this is the case, it is not clear from your documentation and in any case, i feel it is good practice that one should be able to import the object and not have to write>read in order to access an object for re-runs.
Apologies if any of the above if unclear, happy to discuss!
The simplest short-term solution might be an example in the documentation of chaining models i.e. running 'operate' from the output of a 'build.'
Further, a clear explanation within the calliope.model() documentation to explain the precise format of xarray permissible for the model_definition parameter.
The text was updated successfully, but these errors were encountered:
Description
Hello. Whether an issue with the code itself, or just the documentation, I encountered issue with creating a Calliope model with calliope.model(...) from a previous model.
I was attempting to run a model in 'plan' mode and then use the capacity outputs from that model in a new model in 'operate' mode. Although it states that this is possible, it is not immediately clear from the documentation how to do this. Apologies, I do not have this code any longer to upload but to explain...
I created a plan model object: model_plan = calliope.model('model.yaml', ...)
Then built and solve: model_plan.build() >> model_plan.solve()
I then tried to create an operate model object, taking the model_plan as an input argument for the 'model_definition' parameter i.e.: model_operate = calliope.model(model_plan,...)
This failed.
I expected this to work as the dev5 documentation (https://calliope.readthedocs.io/en/v0.7.0.dev5/reference/api/model/?h=calliope.model#calliope.Model) for calliope.model() suggests that 'model_definition' can be a string, path, dictionary, or xarray dataset. With model_plan, a calliope model object, being an xarray dataset, I expected it to be a valid argument. Instead I received 'encoding' errors which may or may not be unique to the Windows OS. I did notice in the calliope backend a few times where UTF-8 was hardcoded for os.reads but not os.writes. Perhaps it may be better to use OS default or at least make this encoding consisting for writing and reading.
What i have later been informed is that instead of importing the model_plan object, I could have saved this file as a .netcdf and run the calliope.read_netcdf('model_plan_path') as the input parameter for 'model_definition.' If this is the case, it is not clear from your documentation and in any case, i feel it is good practice that one should be able to import the object and not have to write>read in order to access an object for re-runs.
Apologies if any of the above if unclear, happy to discuss!
Kind regards,
Dano
Related links
-https://calliope.readthedocs.io/en/v0.7.0.dev5/reference/api/model/?h=calliope.model#calliope.Model
...
Version
v.0.7.0.dev5
Proposed change
The simplest short-term solution might be an example in the documentation of chaining models i.e. running 'operate' from the output of a 'build.'
Further, a clear explanation within the calliope.model() documentation to explain the precise format of xarray permissible for the model_definition parameter.
The text was updated successfully, but these errors were encountered: