Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data source dimension name mapping option #687

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

brynpickering
Copy link
Member

Fixes #680

The only question I have is whether it is better described as rename_dims instead of map_dims.

Reviewer checklist

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

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.99%. Comparing base (e447d17) to head (e0123bd).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #687      +/-   ##
==========================================
+ Coverage   95.98%   95.99%   +0.01%     
==========================================
  Files          26       26              
  Lines        3981     3994      +13     
  Branches      837      771      -66     
==========================================
+ Hits         3821     3834      +13     
  Misses         70       70              
  Partials       90       90              
Files with missing lines Coverage Δ
src/calliope/preprocess/data_tables.py 100.00% <100.00%> (ø)

Copy link
Contributor

@irm-codebase irm-codebase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but there are some CHANGELOG issues.

Additionally, a small maintainability suggestion.

CHANGELOG.md Outdated Show resolved Hide resolved
src/calliope/preprocess/data_sources.py Outdated Show resolved Hide resolved
@brynpickering
Copy link
Member Author

@irm-codebase map_dims or rename_dims?

@irm-codebase
Copy link
Contributor

@brynpickering I like map_dims a bit more.

rename_dims is a bit ambiguous (is it renaming the model's dims? the data's?). map_dims is a bit clearer, and kind of similar to some pandas functionality, so I brain likes it more ¯_ (ツ)_/¯.

@brynpickering
Copy link
Member Author

@sjpfenninger I'll let you cast your vote on the naming. If it's unanimous then we'll stick with map_dims.

@brynpickering
Copy link
Member Author

On the side of rename_dims, it does align with pandas rename_axis and xarray rename_dims

@irm-codebase
Copy link
Contributor

irm-codebase commented Oct 1, 2024

Hmmm... I see the point.

Looking at how the yaml file would look like, it's perhaps less ambiguous than I thought.
rename_dims is perfectly fine!

My mind was linking the command to calliope, not pandas (timesteps is still timesteps, we are just telling data_tables to read time as timesteps), but in the yaml it is clear.

Copy link
Contributor

@irm-codebase irm-codebase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good.
Feel free to refactor to rename_dims, too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow mappings for tabular data
2 participants