예제 #1
0
 def test_not_converged_warning(self):
     with warnings.catch_warnings(record=True) as w:
         warnings.simplefilter("always")  # always trigger all warnings
         fill_cube(self.cube, self.eps / 1E7, relax=self.relax,
                   itermax=self.itermax, initzonal=self.initzonal,
                   verbose=False)
         assert str(w[-1].message) == ("gridfill did not converge on 3 out "
                                       "of 3 slices")
         assert issubclass(w[-1].category, UserWarning)
예제 #2
0
 def test_multi_grid_inplace(self):
     cube = self.cube.copy()
     filled = fill_cube(cube, self.eps, relax=self.relax,
                        itermax=self.itermax, initzonal=self.initzonal,
                        verbose=False, inplace=True)
     self.assert_array_almost_equal(filled.data, self.soln)
     self.assert_array_almost_equal(filled.data, cube.data)
     assert not hasattr(filled.data, 'mask')
     assert not hasattr(cube.data, 'mask')
예제 #3
0
 def test_not_converged_result(self):
     with warnings.catch_warnings(record=True) as w:
         warnings.simplefilter("always")  # always trigger all warnings
         filled, notconverged = fill_cube(self.cube, self.eps / 1E7,
                                          relax=self.relax,
                                          itermax=self.itermax,
                                          initzonal=self.initzonal,
                                          full_output=True, verbose=False)
     self.assert_array_almost_equal(notconverged, np.ones(3, dtype=bool))
예제 #4
0
 def test_not_masked(self):
     cube = self.cube.copy(data=self.cube.data.filled(fill_value=np.nan))
     fill_cube(cube, self.eps, relax=self.relax, itermax=self.itermax,
               initzonal=self.initzonal, verbose=False)
예제 #5
0
 def test_multi_grid(self):
     filled = fill_cube(self.cube, self.eps, relax=self.relax,
                        itermax=self.itermax, initzonal=self.initzonal,
                        verbose=False)
     self.assert_array_almost_equal(filled.data, self.soln)