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

Merged
merged 6 commits into from
Oct 16, 2024

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.96%. Comparing base (b2d2dd1) to head (7589500).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #687      +/-   ##
==========================================
+ Coverage   95.95%   95.96%   +0.01%     
==========================================
  Files          29       29              
  Lines        4026     4039      +13     
  Branches      845      576     -269     
==========================================
+ Hits         3863     3876      +13     
  Misses         72       72              
  Partials       91       91              
Files with missing lines Coverage Δ
src/calliope/preprocess/data_tables.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

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.

irm-codebase
irm-codebase previously approved these changes Oct 1, 2024
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!

@sjpfenninger
Copy link
Member

I vote for rename_dims: I think it's clearer in this context

@brynpickering brynpickering merged commit a9a610e into main Oct 16, 2024
13 checks passed
@brynpickering brynpickering deleted the add-map-dims-option branch October 16, 2024 12:32
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
3 participants