14
14
15
15
import iris
16
16
from iris import cube
17
- from iris .experimental . ugrid import PARSE_UGRID_ON_LOAD , load_mesh
17
+ from iris .mesh import load_mesh
18
18
19
19
from . import BENCHMARK_DATA , REUSE_DATA , load_realised , run_function_elsewhere
20
20
@@ -90,7 +90,7 @@ def sample_mesh(n_nodes=None, n_faces=None, n_edges=None, lazy_values=False):
90
90
"""Sample mesh wrapper for :meth:iris.tests.stock.mesh.sample_mesh`."""
91
91
92
92
def _external (* args , ** kwargs ):
93
- from iris .experimental . ugrid import save_mesh
93
+ from iris .mesh import save_mesh
94
94
from iris .tests .stock .mesh import sample_mesh
95
95
96
96
save_path_ = kwargs .pop ("save_path" )
@@ -104,21 +104,20 @@ def _external(*args, **kwargs):
104
104
save_path = (BENCHMARK_DATA / f"sample_mesh_{ args_hash } " ).with_suffix (".nc" )
105
105
if not REUSE_DATA or not save_path .is_file ():
106
106
_ = run_function_elsewhere (_external , * arg_list , save_path = str (save_path ))
107
- with PARSE_UGRID_ON_LOAD .context ():
108
- if not lazy_values :
109
- # Realise everything.
110
- with load_realised ():
111
- mesh = load_mesh (str (save_path ))
112
- else :
107
+ if not lazy_values :
108
+ # Realise everything.
109
+ with load_realised ():
113
110
mesh = load_mesh (str (save_path ))
111
+ else :
112
+ mesh = load_mesh (str (save_path ))
114
113
return mesh
115
114
116
115
117
116
def sample_meshcoord (sample_mesh_kwargs = None , location = "face" , axis = "x" ):
118
117
"""Sample meshcoord wrapper for :meth:`iris.tests.stock.mesh.sample_meshcoord`.
119
118
120
119
Parameters deviate from the original as cannot pass a
121
- :class:`iris.experimental.ugrid .Mesh to the separate Python instance - must
120
+ :class:`iris.mesh .Mesh to the separate Python instance - must
122
121
instead generate the Mesh as well.
123
122
124
123
MeshCoords cannot be saved to file, so the _external method saves the
@@ -127,7 +126,7 @@ def sample_meshcoord(sample_mesh_kwargs=None, location="face", axis="x"):
127
126
"""
128
127
129
128
def _external (sample_mesh_kwargs_ , save_path_ ):
130
- from iris .experimental . ugrid import save_mesh
129
+ from iris .mesh import save_mesh
131
130
from iris .tests .stock .mesh import sample_mesh , sample_meshcoord
132
131
133
132
if sample_mesh_kwargs_ :
@@ -147,9 +146,8 @@ def _external(sample_mesh_kwargs_, save_path_):
147
146
sample_mesh_kwargs_ = sample_mesh_kwargs ,
148
147
save_path_ = str (save_path ),
149
148
)
150
- with PARSE_UGRID_ON_LOAD .context ():
151
- with load_realised ():
152
- source_mesh = load_mesh (str (save_path ))
149
+ with load_realised ():
150
+ source_mesh = load_mesh (str (save_path ))
153
151
# Regenerate MeshCoord from its Mesh, which we saved.
154
152
return source_mesh .to_MeshCoord (location = location , axis = axis )
155
153
@@ -180,7 +178,6 @@ def _external(w_mesh_: str, save_path_: str):
180
178
)
181
179
if not REUSE_DATA or not save_path .is_file ():
182
180
_ = run_function_elsewhere (_external , w_mesh_ = w_mesh , save_path_ = str (save_path ))
183
- with PARSE_UGRID_ON_LOAD .context ():
184
- context = nullcontext () if lazy else load_realised ()
185
- with context :
186
- return iris .load_cube (save_path , "air_potential_temperature" )
181
+ context = nullcontext () if lazy else load_realised ()
182
+ with context :
183
+ return iris .load_cube (save_path , "air_potential_temperature" )
0 commit comments