Skip to content

Revert the default behaviour of coordinate realisation during pp load#7134

Open
HGWright wants to merge 3 commits into
SciTools:mainfrom
HGWright:undo_lasy_refs
Open

Revert the default behaviour of coordinate realisation during pp load#7134
HGWright wants to merge 3 commits into
SciTools:mainfrom
HGWright:undo_lasy_refs

Conversation

@HGWright

@HGWright HGWright commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Pull Request

Description

In #6767 we added a temporary fix, but we set the default to be lazy loading. We have since seen that this can cause some performance problems in some cases, so here we have reverted the default behaviour back to realising the data.

Part of the work needed to fix #7094. To complete that we would want a more permanent solution to this problem.


Consult Iris pull request check list


Add any of the below labels to trigger actions on this PR:

  • benchmark_this Request that this pull request be benchmarked to check if it introduces performance shifts

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.14%. Comparing base (fe718ab) to head (0f15b07).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7134   +/-   ##
=======================================
  Coverage   90.14%   90.14%           
=======================================
  Files          91       91           
  Lines       24967    24967           
  Branches     4684     4684           
=======================================
  Hits        22506    22506           
  Misses       1683     1683           
  Partials      778      778           

☔ View full report in Codecov by Harness.
📢 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.

@HGWright HGWright requested a review from pp-mo June 4, 2026 13:27

@pp-mo pp-mo left a comment

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.

This all looks OK, except for 1 suggestion to improve a test clarity.

And.. I think you need to provide a whatsnew entry.
I think it needs to be fairly carefully worded, given the potential for confusion!
I also don't think we can afford to keep this quiet, as I see we did announce the original change
-- see in this whatsnew section.

Comment on lines +288 to 296
assert not data_cube.coord("surface_air_pressure").has_lazy_points()

# TODO: _CONCRETE_DERIVED_LOADING is a temporary fix, remove from test when a permanent fix exists
# TODO: _LAZY_DERIVED_LOADING is a temporary fix, remove from test when a permanent fix exists
load = mocker.Mock(return_value=iter([pressure_field, data_field]))
mocker.patch("iris.fileformats.pp.load", new=load)
with _CONCRETE_DERIVED_LOADING.context():
_, realised_data_cube = iris.fileformats.pp.load_cubes("DUMMY")
assert not realised_data_cube.coord("surface_air_pressure").has_lazy_points()
with _LAZY_DERIVED_LOADING.context(load_lazy=True):
_, lazy_data_cube = iris.fileformats.pp.load_cubes("DUMMY")
assert lazy_data_cube.coord("surface_air_pressure").has_lazy_points()

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.

I know it isn't your doing, but this test would be a lot clearer if it didn't test 2 things in 1.
Could we parametrise it?
Something like:

@pytest.mark.parametrize("islazy", [False, True], ids=["real", "lazy]")
    ...
    with _LAZY_DERIVED_LOADING.context(load_lazy=islazy)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

More problems with lazy references

2 participants