calliope-project / calliope

A multi-scale energy systems modelling framework
https://www.callio.pe
Apache License 2.0
287 stars 93 forks source link

New object-oriented backend API #510

Open brynpickering opened 11 months ago

brynpickering commented 11 months ago

Problem description

In #429, I introduced a backend api available at Calliope.Model.backend. E.g., to view parameters: model.backend.parameters; to update a parameter: model.backend.update_parameter("param_name", ...), etc.

If we wrapped the backend component arrays in a class, we could move some of this functionality more nested objects with associated methods, e.g., model.backend.parameters has each parameter as an attribute. these paramter classes can then be updated model.backend.parameters.param_name.update(...) or simply viewed: model.backend.parameters.param_name.data. The benefit of this is that you get tab autocompletion for free, and it is probably the more "pythonic" way to implement the API.

However, the current approach works. So maybe this is low priority to implement.

Calliope version

v0.7.0.dev