Пример #1
0
class TestGpp(unittest.TestCase):
    """Tests for gpp."""
    def setUp(self):
        """Prepare tests."""
        self.cube = Cube([1.0, 1.0e33, 2.0])
        self.fix = Gpp()

    def test_get(self):
        """Test fix get"""
        self.assertListEqual(Fix.get_fixes('CMIP5', 'CESM1-BGC', 'gpp'),
                             [Gpp()])

    def test_fix_data(self):
        """Test fix to set missing values correctly."""
        cube = self.fix.fix_data(self.cube)
        np.testing.assert_allclose(cube.data[0], 1.0)
        np.testing.assert_allclose(cube.data[2], 2.0)
        assert not np.ma.is_masked(cube.data[0])
        assert np.ma.is_masked(cube.data[1])
        assert not np.ma.is_masked(cube.data[2])
Пример #2
0
 def test_get_fixes_with_generic(self):
     self.assertListEqual(
         Fix.get_fixes('CMIP5', 'CESM1-BGC', 'Amon', 'gpp'), [Gpp(None)])
Пример #3
0
 def test_get(self):
     """Test fix get"""
     self.assertListEqual(Fix.get_fixes('CMIP5', 'CESM1-BGC', 'gpp'),
                          [Gpp()])
Пример #4
0
 def setUp(self):
     """Prepare tests."""
     self.cube = Cube([1.0, 1.0e33, 2.0])
     self.fix = Gpp()