def assert_masked_array_equal(x, y, err_msg='', verbose=True):
    '''
    Checks the elementwise equality of two masked arrays. Also checks that the
    masks are equivalent.
    '''
    compare = operator.__eq__
    assert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
                         header='Arrays are not equal')
    assert_mask_equivalent(x.mask, y.mask, err_msg='Masks are not equivalent')
def assert_masked_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True):
    '''
    Checks the elementwise equality of two masked arrays, up to a given
    number of decimals. Also checks that the masks are equivalent.
    '''
    compare = lambda x, y: almost(x, y, decimal)
    assert_array_compare(compare, x, y, err_msg=err_msg, verbose=verbose,
                         header='Arrays are not almost equal')
    assert_mask_equivalent(x.mask, y.mask, err_msg='Masks are not equivalent')
def assert_masked_array_equal(x, y, err_msg='', verbose=True):
    '''
    Checks the elementwise equality of two masked arrays. Also checks that the
    masks are equivalent.
    '''
    compare = operator.__eq__
    assert_array_compare(compare,
                         x,
                         y,
                         err_msg=err_msg,
                         verbose=verbose,
                         header='Arrays are not equal')
    assert_mask_equivalent(x.mask, y.mask, err_msg='Masks are not equivalent')
def assert_masked_array_almost_equal(x,
                                     y,
                                     decimal=6,
                                     err_msg='',
                                     verbose=True):
    '''
    Checks the elementwise equality of two masked arrays, up to a given
    number of decimals. Also checks that the masks are equivalent.
    '''
    compare = lambda x, y: almost(x, y, decimal)
    assert_array_compare(compare,
                         x,
                         y,
                         err_msg=err_msg,
                         verbose=verbose,
                         header='Arrays are not almost equal')
    assert_mask_equivalent(x.mask, y.mask, err_msg='Masks are not equivalent')