def test_no_weights(self):
     # Check we can use the regridder without weights.
     src_grid = self.src_grid
     target_grid = self.tgt_grid
     regridder = Regridder(src_grid, target_grid)
     with mock.patch(self.func_setup,
                     return_value=mock.sentinel.regrid_info) as patch_setup:
         with mock.patch(
                 self.func_operate,
                 return_value=self.dummy_slice_result) as patch_operate:
             result = regridder(src_grid)
     patch_setup.assert_called_once_with(src_grid, None, target_grid)
Exemplo n.º 2
0
    def test_same_src_as_init(self):
        # Modify the names so we can tell them apart.
        src_grid = self.ok.copy()
        src_grid.rename('src_grid')
        target_grid = self.ok.copy()
        target_grid.rename('TARGET_GRID')
        regridder = Regridder(src_grid, target_grid, self.weights)
        with mock.patch(self.func,
                        return_value=mock.sentinel.regridded) as clr:
            result = regridder(src_grid)

        clr.assert_called_once_with(src_grid, self.weights, target_grid)
        self.assertIs(result, mock.sentinel.regridded)