Skip to content

Commit c172cf4

Browse files
bouweandelapp-mo
authored andcommitted
Use realized data in benchmarks when requested
1 parent a9e1dad commit c172cf4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

benchmarks/benchmarks/generate_data/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,14 @@ def load_realised():
106106
file loading, but some benchmarks are only meaningful if starting with real
107107
arrays.
108108
"""
109+
from iris.fileformats._nc_load_rules import helpers
109110
from iris.fileformats.netcdf.loader import _get_cf_var_data as pre_patched
110111

111112
def patched(cf_var, filename):
112113
return as_concrete_data(pre_patched(cf_var, filename))
113114

114-
netcdf._get_cf_var_data = patched
115-
yield netcdf
116-
netcdf._get_cf_var_data = pre_patched
115+
netcdf.loader._get_cf_var_data = patched
116+
helpers._get_cf_var_data = patched
117+
yield
118+
netcdf.loader._get_cf_var_data = pre_patched
119+
helpers._get_cf_var_data = pre_patched

benchmarks/benchmarks/generate_data/stock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ def realistic_4d_w_everything(w_mesh=False, lazy=False) -> iris.cube.Cube:
162162
lazy : bool
163163
If True, the Cube will be returned with all arrays as they would
164164
normally be loaded from file (i.e. most will still be lazy Dask
165-
arrays). If False, all arrays will be realised NumPy arrays.
165+
arrays). If False, all arrays (except derived coordinates) will be
166+
realised NumPy arrays.
166167
167168
"""
168169

0 commit comments

Comments
 (0)