Skip to content

Conversation

@AlgoFoe
Copy link
Contributor

@AlgoFoe AlgoFoe commented Feb 7, 2026

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

  • The previous scale implementation implicitly reshaped and squeezed scaling factors, which could lead to ambiguous or unintended broadcasting (e.g. when space and time dimensions have the same length).

What does this PR do?

  • Defers scaling factor broadcasting to xarray’s native alignment rules.
  • Preserves xarray.DataArray factors and allows dimension-aware scaling (e.g. time-dependent factors).

References

How has this PR been tested?

  • New tests were added to cover:
    • Dimension-aware scaling via xarray.DataArray
    • Time-dependent scaling factors

Is this a breaking change?

  • No.

Does this PR require an update to the documentation?

  • Yes, the scale() docstring was updated accordingly.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (fffc05f) to head (5bc5761).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #805   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           34        34           
  Lines         2118      2112    -6     
=========================================
- Hits          2118      2112    -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@niksirbi
Copy link
Member

niksirbi commented Feb 9, 2026

Thanks @AlgoFoe, we'll review this PR when we find some time.

Note that the Build Sphinx Docs action fails due to an unrelated reason, which I'm fixing in #807.

@niksirbi niksirbi requested a review from sfmig February 9, 2026 11:50
@sonarqubecloud
Copy link

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.

Scale an array by a factor that changes in time

2 participants