calliope icon indicating copy to clipboard operation
calliope copied to clipboard

tech/node groups to templates

Open brynpickering opened this issue 1 year ago • 3 comments

Fixes #600

I've merged tech_ and node_ into templates as there's no real reason to split them. You can access the same template from techs or nodes but the chance that it causes issues is minimal. The benefit is fewer top-level keys.

I've kept the reference to "inheriting" templates in the docs and the helper function. If there is a perference to purge all concept of inheritance, we could change it, but I don't have a good idea what to replace it with.

Summary of changes in this pull request

  • tech_groups/node_groups -> templates
  • inherit -> template

Reviewer checklist

  • [ ] Test(s) added to cover contribution
  • [ ] Documentation updated
  • [ ] Changelog updated
  • [ ] Coverage maintained or improved

brynpickering avatar Aug 07 '24 15:08 brynpickering

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.97%. Comparing base (2099815) to head (b063029). Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #655      +/-   ##
==========================================
- Coverage   95.98%   95.97%   -0.01%     
==========================================
  Files          26       26              
  Lines        3981     3980       -1     
  Branches      836      767      -69     
==========================================
- Hits         3821     3820       -1     
  Misses         70       70              
  Partials       90       90              
Files with missing lines Coverage Δ
src/calliope/backend/helper_functions.py 96.84% <ø> (ø)
src/calliope/preprocess/model_data.py 100.00% <100.00%> (ø)

codecov[bot] avatar Aug 07 '24 15:08 codecov[bot]

@sjpfenninger @irm-codebase one thing I missed is that you still end up with the two input variables in the xarray dataset: techs_inheritance and nodes_inheritance. For techs/nodes, they define the inheritance chain that was used to create that tech/node's definition. They need to be separated as they are indexed only over their respective dimensions. Should these be tech_templates and node_templates, or does inheritance make sense here?

brynpickering avatar Aug 24 '24 11:08 brynpickering

@brynpickering looking at the code, it seems they achieve very similar things, but I do not think they match template's purpose, since template is more of a 'user-side' thing, and this seems more 'internal'...

I think you are right in just going for inheritance.

irm-codebase avatar Aug 24 '24 14:08 irm-codebase

@sjpfenninger @irm-codebase one thing I missed is that you still end up with the two input variables in the xarray dataset: techs_inheritance and nodes_inheritance. For techs/nodes, they define the inheritance chain that was used to create that tech/node's definition. They need to be separated as they are indexed only over their respective dimensions. Should these be tech_templates and node_templates, or does inheritance make sense here?

I agree with @irm-codebase that we can stick to inheritance here which marks this as a separate (but related) variable.

sjpfenninger avatar Aug 30 '24 15:08 sjpfenninger