Further improvements to broadcast_techs#650
Merged
Conversation
quantities module
quantities modulebroadcast_techs usage outside of quantities module
broadcast_techs usage outside of quantities modulebroadcast_techs usage away from quantities module
This was referenced Jan 30, 2025
Merged
70ed464 to
cde04f8
Compare
99aa98a to
1c572f1
Compare
broadcast_techs usage away from quantities modulebroadcast_techs
dalonsoa
approved these changes
Feb 6, 2025
Collaborator
dalonsoa
left a comment
There was a problem hiding this comment.
LGTM. The code is more readable with the use of technologies instead of a bunch of random words to define the same thing and the purpose of the broadcast function clearer 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This makes a number of changes to the
broadcast_techsfunction and its usage, as a follow up to #585Renamed the function to
broadcast_over_assets, which better describes its general usageClarified the docstring, added example for using
installed_as_year=FalseRemoved calls to this function away from several functions in the
quantitiesmodule (emission,consumption,maximum_production,capacity_in_use,minimum_production). It is now the responsibility of the code calling these functions to make sure the data is in the correct format. However, due to the check introduced in Xarray patch: Check array dimensions #647, any errors due to inconsistent formatting (i.e. trying to combine asset-level data with technology-level data) will be flagged, so I don't think this is any less robust. Overall, I think this makes these functions more readable, flexible (so long as the inputs are in a consistent format) and reduces the number of times conversions have to happen, as a converted technologies can be passed to multiple functions.The above change required some reformatting to other parts of the code, particularly the
demand_sharemoduleRemoved
filter_with_template. This always just calledbroadcast_techs(the code beneath the first return statement was never accessed), so isn't required.Updated the tests in line with these changes
There are still a couple of TODOs in
broadcast_over_assets, but I'm leaving these for now as they have knock on consequences for other parts of the code (particularly the adhoc solver and constraints), which I'm not yet comfortable changing.