Skip to content

Ensures callbacks do not realise data#1985

Open
David Flack (daflack) wants to merge 2 commits intomainfrom
1984_ensure_callbacks_retain_lazy_data
Open

Ensures callbacks do not realise data#1985
David Flack (daflack) wants to merge 2 commits intomainfrom
1984_ensure_callbacks_retain_lazy_data

Conversation

@daflack
Copy link
Copy Markdown
Collaborator

@daflack David Flack (daflack) commented Mar 25, 2026

Fixes are required to um winds callback for the rotation, and to the cloud base altitude callback.

Fixes #1984

Contribution checklist

Aim to have all relevant checks ticked off before merging. See the developer's guide for more detail.

  • Documentation has been updated to reflect change.
  • New code has tests, and affected old tests have been updated.
  • All tests and CI checks pass.
  • Ensured the pull request title is descriptive.
  • Ensure rose-suite.conf.example has been updated if new diagnostic added.
  • Conda lock files have been updated if dependencies have changed.
  • Attributed any Generative AI, such as GitHub Copilot, used in this PR.
  • Marked the PR as ready to review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Coverage

Uses the suggestion from Scott Wales in issue 1985, does not
close the issue..
@daflack
Copy link
Copy Markdown
Collaborator Author

David Flack (daflack) commented Mar 25, 2026

The cloud base altitude callback alters the function to use that given in #1985 by Scott Wales (@ScottWales) . Does not close #1985.

@ScottWales
Copy link
Copy Markdown

Thanks, can we have a test showing that cube.has_lazy_data() is true before and after running each callback?

@daflack
Copy link
Copy Markdown
Collaborator Author

Great idea on the tests for lazy data before and after each callback. I'm just wondering about the data and size (a lot of the test data is currently not lazy when loading directly with iris and no callbacks) so we may need to add new data in a cube for each callback that is lazy. I'll have a chat to James Frost (@jfrost-mo) about this and then start doing the tests.

Copy link
Copy Markdown
Member

@jfrost-mo James Frost (jfrost-mo) left a comment

Choose a reason for hiding this comment

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

Looks like a sensible change, and avoiding realizing data would be a great enhancement. I agree that Scott's test suggestion would be a good way to both test this change and to prevent regressions in the callbacks going forwards, so I would like to see it before this is merged.

from pathlib import Path
from typing import Literal

import dask
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since we are now explicitly importing dask we need to add it as a new dependency.

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.

Convert wind and cloud base callbacks to lazy data

3 participants