9
9
# importing anything else.
10
10
import iris .tests as tests # isort:skip
11
11
12
- import tempfile
13
-
14
12
import iris
15
13
from iris .analysis import AreaWeighted
16
14
@@ -37,8 +35,8 @@ def test_regrid_area_w_lazy(self):
37
35
self .assertTrue (self .cube .has_lazy_data ())
38
36
self .assertTrue (out .has_lazy_data ())
39
37
# Save the data
40
- with tempfile . TemporaryFile (suffix = ".nc" ) as fp :
41
- iris .save (out , fp )
38
+ with self . temp_filename (suffix = ".nc" ) as fname :
39
+ iris .save (out , fname )
42
40
43
41
def test_regrid_area_w_lazy_chunked (self ):
44
42
# Chunked data makes the regridder run repeatedly
@@ -49,8 +47,8 @@ def test_regrid_area_w_lazy_chunked(self):
49
47
self .assertTrue (self .cube .has_lazy_data ())
50
48
self .assertTrue (out .has_lazy_data ())
51
49
# Save the data
52
- with tempfile . TemporaryFile (suffix = ".nc" ) as fp :
53
- iris .save (out , fp )
50
+ with self . temp_filename (suffix = ".nc" ) as fname :
51
+ iris .save (out , fname )
54
52
55
53
def test_regrid_area_w_real_save (self ):
56
54
real_cube = self .cube .copy ()
@@ -60,17 +58,17 @@ def test_regrid_area_w_real_save(self):
60
58
# Realise the data
61
59
out .data
62
60
# Save the data
63
- with tempfile . TemporaryFile (suffix = ".nc" ) as fp :
64
- iris .save (out , fp )
61
+ with self . temp_filename (suffix = ".nc" ) as fname :
62
+ iris .save (out , fname )
65
63
66
64
def test_regrid_area_w_real_start (self ):
67
65
real_cube = self .cube .copy ()
68
66
real_cube .data
69
67
# Regrid the cube onto the template.
70
68
out = real_cube .regrid (self .template_cube , AreaWeighted ())
71
69
# Save the data
72
- with tempfile . TemporaryFile (suffix = ".nc" ) as fp :
73
- iris .save (out , fp )
70
+ with self . temp_filename (suffix = ".nc" ) as fname :
71
+ iris .save (out , fname )
74
72
75
73
76
74
if __name__ == "__main__" :
0 commit comments