def test_masked_array(self):
        """
        Test to make sure that if the original array is masked, its mask is
        applied by MaskValueArray.masked_array()

        """
        orig = np.ma.MaskedArray(np.arange(3), [True, False, False])
        array = MaskValueArray(orig, 2)
        expected = np.ma.MaskedArray([0, 1, 2], [True, False, True])
        self.assertIsInstance(array.masked_array(), np.ma.MaskedArray)
        assert_array_equal(array.masked_array(), expected)
Esempio n. 2
0
    def test_masked_array(self):
        """
        Test to make sure that if the original array is masked, its mask is
        applied by MaskValueArray.masked_array()

        """
        orig = np.ma.MaskedArray(np.arange(3), [True, False, False])
        array = MaskValueArray(orig, 2)
        expected = np.ma.MaskedArray([0, 1, 2], [True, False, True])
        self.assertIsInstance(array.masked_array(), np.ma.MaskedArray)
        assert_array_equal(array.masked_array(), expected)
Esempio n. 3
0
 def test_basic(self):
     array = MaskValueArray(np.arange(3), 2)
     expected = np.ma.MaskedArray([0, 1, 2], [False, False, True])
     self.assertIsInstance(array.masked_array(), np.ma.MaskedArray)
     assert_array_equal(array.masked_array(), expected)
Esempio n. 4
0
 def test_nd_array(self):
     array = MaskValueArray(np.arange(3), 2)
     assert_array_equal(array.ndarray(), np.array([0, 1, 2]))
Esempio n. 5
0
 def test_mask_preserved(self):
     sliced = MaskValueArray(np.arange(5), 3)[2:]
     expected = np.ma.MaskedArray([2, 3, 4], [False, True, False])
     assert_array_equal(sliced.masked_array(), expected)
 def test_basic(self):
     array = MaskValueArray(np.arange(3), 2)
     expected = np.ma.MaskedArray([0, 1, 2], [False, False, True])
     self.assertIsInstance(array.masked_array(), np.ma.MaskedArray)
     assert_array_equal(array.masked_array(), expected)
 def test_nd_array(self):
     array = MaskValueArray(np.arange(3), 2)
     assert_array_equal(array.ndarray(), np.array([0, 1, 2]))
 def test_mask_preserved(self):
     sliced = MaskValueArray(np.arange(5), 3)[2:]
     expected = np.ma.MaskedArray([2, 3, 4], [False, True, False])
     assert_array_equal(sliced.masked_array(), expected)
 def test_nd_array(self):
     orig = np.arange(24)
     array = MaskValueArray(orig, 3)
     self.assertIs(array.array, orig)