Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarks generate_data.stock.realistic_4d_w_everything laziness not working #6137

Open
trexfeathers opened this issue Sep 3, 2024 · 0 comments

Comments

@trexfeathers
Copy link
Contributor

🐛 Bug Report

Reported here: #5926 (comment)

How To Reproduce

Steps to reproduce the behaviour:

  1. Call the function: my_cube = realistic_4d_w_everything(lazy=False)
  2. Check laziness: print(my_cube.has_lazy_data())

Expected behaviour

Step 2 should print False, but currently prints True.

Environment

  • OS & Version: [e.g., Ubuntu 20.04 LTS]
  • Iris Version: [e.g., From the command line run python -c "import iris; print(iris.__version__)"]

Observed during GHA CI, and locally by @bouweandela

Additional context

def realistic_4d_w_everything(w_mesh=False, lazy=False) -> iris.cube.Cube:
"""Run :func:`iris.tests.stock.realistic_4d_w_everything` in ``DATA_GEN_PYTHON``.
Parameters
----------
w_mesh : bool
See :func:`iris.tests.stock.realistic_4d_w_everything` for details.
lazy : bool
If True, the Cube will be returned with all arrays as they would
normally be loaded from file (i.e. most will still be lazy Dask
arrays). If False, all arrays will be realised NumPy arrays.
"""
def _external(w_mesh_: str, save_path_: str):
import iris
from iris.tests.stock import realistic_4d_w_everything
cube = realistic_4d_w_everything(w_mesh=bool(w_mesh_))
iris.save(cube, save_path_)
save_path = (BENCHMARK_DATA / f"realistic_4d_w_everything_{w_mesh}").with_suffix(
".nc"
)
if not REUSE_DATA or not save_path.is_file():
_ = run_function_elsewhere(_external, w_mesh_=w_mesh, save_path_=str(save_path))
context = nullcontext() if lazy else load_realised()
with context:
return iris.load_cube(save_path, "air_potential_temperature")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant