|
1 | 1 | """Unit tests for the :func:`esmvalcore.preprocessor.regrid.regrid`
|
2 | 2 | function."""
|
3 | 3 |
|
4 |
| -import logging |
5 | 4 | import unittest
|
6 | 5 | from unittest import mock
|
7 | 6 |
|
|
16 | 15 | from esmvalcore.preprocessor._regrid import (
|
17 | 16 | _CACHE,
|
18 | 17 | HORIZONTAL_SCHEMES,
|
19 |
| - _check_grid_discontiguities, |
20 | 18 | _horizontal_grid_is_close,
|
21 | 19 | _rechunk,
|
22 | 20 | )
|
@@ -269,62 +267,6 @@ def test_regrid_is_skipped_if_grids_are_the_same():
|
269 | 267 | assert expected_different_cube is not cube
|
270 | 268 |
|
271 | 269 |
|
272 |
| -def test_no_discontiguities_in_coords(): |
273 |
| - """Test that no mask is used if there are no discontinuities in coords.""" |
274 |
| - cube = _make_cube(lat=LAT_SPEC1, lon=LON_SPEC1) |
275 |
| - scheme = {} |
276 |
| - scheme = _check_grid_discontiguities(cube, scheme) |
277 |
| - assert scheme == {} |
278 |
| - |
279 |
| - |
280 |
| -def test_use_mask_if_discontiguities_in_coords(caplog): |
281 |
| - """Test use_src_mask is added to the scheme.""" |
282 |
| - lat_bounds = np.array( |
283 |
| - [[[-43.48076211, -34.01923789, -22.00961894, -31.47114317], |
284 |
| - [-34.01923789, -10.0, 2.00961894, -22.00961894], |
285 |
| - [-10.0, -0.53847577, 11.47114317, 2.00961894]], |
286 |
| - [[-31.47114317, -22.00961894, -10.0, -19.46152423], |
287 |
| - [-22.00961894, 2.00961894, 14.01923789, -10.0], |
288 |
| - [2.00961894, 11.47114317, 23.48076211, 14.01923789]]]) |
289 |
| - lat_coord = iris.coords.AuxCoord( |
290 |
| - [[-40.0, -20.0, 0.0], [-20.0, 0.0, 20.0]], |
291 |
| - var_name='lat', |
292 |
| - standard_name='latitude', |
293 |
| - units='degrees_north', |
294 |
| - bounds=lat_bounds, |
295 |
| - ) |
296 |
| - lon_bounds = np.array([[[140.625, 99.375, 99.375, 140.625], |
297 |
| - [99.375, 140.625, 140.625, 99.375], |
298 |
| - [140.625, 99.375, 99.375, 140.625]], |
299 |
| - [[140., 99.375, 99.375, 140.], |
300 |
| - [99.375, 140.625, 140.625, 99.375], |
301 |
| - [140., 99.375, 99.375, 140.]]]) |
302 |
| - lon_coord = iris.coords.AuxCoord( |
303 |
| - [[100.0, 140.0, 180.0], [80.0, 100.0, 120.0]], |
304 |
| - var_name='lon', |
305 |
| - standard_name='longitude', |
306 |
| - units='degrees_east', |
307 |
| - bounds=lon_bounds, |
308 |
| - ) |
309 |
| - data = np.ma.array( |
310 |
| - [[-40.0, -20.0, 0.0], [-20.0, 0.0, 20.0]], |
311 |
| - mask=[[True, False, True], [False, True, False]], |
312 |
| - ) |
313 |
| - cube = iris.cube.Cube( |
314 |
| - data, |
315 |
| - aux_coords_and_dims=[(lat_coord, (0, 1)), (lon_coord, (0, 1))], |
316 |
| - ) |
317 |
| - |
318 |
| - scheme = {} |
319 |
| - with caplog.at_level(logging.DEBUG): |
320 |
| - scheme = _check_grid_discontiguities(cube, scheme) |
321 |
| - assert scheme == {'use_src_mask': True} |
322 |
| - |
323 |
| - msg = ('Grid discontinuities were found in the source grid. ' |
324 |
| - 'Setting scheme argument `use_src_mask` to True.') |
325 |
| - assert msg in caplog.text |
326 |
| - |
327 |
| - |
328 | 270 | def make_test_cube(shape):
|
329 | 271 | data = da.empty(shape, dtype=np.float32)
|
330 | 272 | cube = iris.cube.Cube(data)
|
|
0 commit comments