25
25
except ImportError :
26
26
pass
27
27
28
- disallowed_methods = (
29
- "conservative" ,
30
- "conservative_2nd" ,
31
- # "nearest_dtos",
32
- )
33
-
34
28
methods = (
35
29
"linear" ,
36
30
"nearest_stod" ,
@@ -162,7 +156,7 @@ def test_Field_regrid_grid_to_featureType_3d(self):
162
156
y = esmpy_regrid (coord_sys , method , src , dst , ** kwargs )
163
157
164
158
self .assertEqual (y .size , a .size )
165
- self .assertTrue (np .allclose (y , a , atol = 4e-3 , rtol = rtol ))
159
+ self .assertTrue (np .allclose (y , a , atol = atol , rtol = rtol ))
166
160
167
161
if isinstance (a , np .ma .MaskedArray ):
168
162
self .assertTrue ((y .mask == a .mask ).all ())
@@ -173,6 +167,7 @@ def test_Field_regrid_grid_to_featureType_3d(self):
173
167
def test_Field_regrid_featureType_to_grid_2d (self ):
174
168
self .assertFalse (cf .regrid_logging ())
175
169
170
+ # Create some nice data
176
171
src = self .dst_featureType
177
172
src .del_construct ("cellmethod0" )
178
173
src = src [:12 ]
@@ -191,6 +186,7 @@ def test_Field_regrid_featureType_to_grid_2d(self):
191
186
# Mask some destination grid points
192
187
dst [0 , 0 , 1 , 2 ] = cf .masked
193
188
189
+ # Expected destination regridded values
194
190
y0 = np .ma .array (
195
191
[[0 , 0 , 0 , 0 ], [0 , 0 , 1122 , 0 ], [0 , 1114 , 0 , 0 ], [1106 , 0 , 0 , 0 ]],
196
192
mask = [
@@ -201,13 +197,14 @@ def test_Field_regrid_featureType_to_grid_2d(self):
201
197
],
202
198
)
203
199
204
- coord_sys = "spherical"
205
-
206
200
for src_masked in (False , True ):
207
201
y = y0 .copy ()
208
202
if src_masked :
209
203
src = src .copy ()
210
204
src [6 :8 ] = cf .masked
205
+ # This following element should be smaller, because it
206
+ # now only has two source cells conrtibuting to it,
207
+ # rather than four.
211
208
y [3 , 0 ] = 547
212
209
213
210
# Loop over whether or not to use the destination grid
@@ -327,7 +324,7 @@ def test_Field_regrid_featureType_bad_methods(self):
327
324
dst = self .dst_featureType .copy ()
328
325
src = self .src_grid .copy ()
329
326
330
- for method in disallowed_methods :
327
+ for method in ( "conservative" , "conservative_2nd" ) :
331
328
with self .assertRaises (ValueError ):
332
329
src .regrids (dst , method = method )
333
330
0 commit comments