Skip to content

Fix same_enduse and spend_limit filters#670

Merged
tsmbland merged 7 commits intomainfrom
refactor_filters
Mar 26, 2025
Merged

Fix same_enduse and spend_limit filters#670
tsmbland merged 7 commits intomainfrom
refactor_filters

Conversation

@tsmbland
Copy link
Copy Markdown
Collaborator

@tsmbland tsmbland commented Mar 11, 2025

Tiny fix, but the same_enduse and spend_limit filters were failing because they tried to filter the technologies dataset by year, but it's already been filtered by year here so complains when trying to use these filters.

I've fixed that bug.

Also added a check to the decorator to enforce that technologies cannot have a year dimension. This was a bit trickier than usual as not all filters take technologies, so I had to get creative using inspect. Not sure if there's a better way to do this.

Had to make a few other changes to keep the tests happy

EDIT: Switched to the approach suggested by Diego below

@tsmbland tsmbland changed the title Refactor filters module Fix same_enduse and spend_limit filters Mar 12, 2025
@tsmbland tsmbland requested a review from dalonsoa March 25, 2025 10:10
Copy link
Copy Markdown
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

This looks good. I've made a suggestion that I think might make the code simpler and more explicit, but up to you if you want to take it. Your implementation looks fine as well.

Comment thread src/muse/filters.py Outdated
@tsmbland tsmbland moved this to 👀 In review in MUSE Mar 26, 2025
@tsmbland tsmbland merged commit 3e87a33 into main Mar 26, 2025
14 checks passed
@tsmbland tsmbland deleted the refactor_filters branch March 26, 2025 10:33
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in MUSE Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants