Skip to content

Comments

Further improvements to broadcast_techs#650

Merged
tsmbland merged 14 commits intomainfrom
limit_broadcast_techs
Feb 6, 2025
Merged

Further improvements to broadcast_techs#650
tsmbland merged 14 commits intomainfrom
limit_broadcast_techs

Conversation

@tsmbland
Copy link
Collaborator

@tsmbland tsmbland commented Jan 30, 2025

Description

This makes a number of changes to the broadcast_techs function and its usage, as a follow up to #585

  • Renamed the function to broadcast_over_assets, which better describes its general usage

  • Clarified the docstring, added example for using installed_as_year=False

  • Removed calls to this function away from several functions in the quantities module (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_share module

  • Removed filter_with_template. This always just called broadcast_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.

@tsmbland tsmbland changed the title Limit usage of broadcast_techs Move broadcast_techs outside of quantities module Jan 30, 2025
@tsmbland tsmbland changed the title Move broadcast_techs outside of quantities module Move broadcast_techs usage outside of quantities module Jan 30, 2025
@tsmbland tsmbland changed the title Move broadcast_techs usage outside of quantities module Move broadcast_techs usage away from quantities module Jan 30, 2025
@tsmbland tsmbland marked this pull request as ready for review January 30, 2025 14:00
This was referenced Jan 30, 2025
@tsmbland tsmbland marked this pull request as draft January 30, 2025 15:46
Base automatically changed from supply_func2 to main February 3, 2025 16:31
@tsmbland tsmbland force-pushed the limit_broadcast_techs branch from 99aa98a to 1c572f1 Compare February 3, 2025 16:41
@tsmbland tsmbland marked this pull request as ready for review February 4, 2025 12:13
@tsmbland tsmbland changed the title Move broadcast_techs usage away from quantities module Further improvements to broadcast_techs Feb 4, 2025
@tsmbland tsmbland requested a review from dalonsoa February 4, 2025 12:14
Copy link
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.

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 👍

@tsmbland tsmbland merged commit 4f28593 into main Feb 6, 2025
14 checks passed
@tsmbland tsmbland deleted the limit_broadcast_techs branch February 6, 2025 09:45
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