Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1253 from dopplershift/fix-smooth-units
Fix smoothing unit-handling
- Loading branch information
Showing
4 changed files
with
91 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2019 MetPy Developers. | ||
# Distributed under the terms of the BSD 3-Clause License. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
"""Test MetPy's testing utilities.""" | ||
|
||
import numpy as np | ||
import pytest | ||
|
||
from metpy.testing import assert_array_almost_equal | ||
|
||
|
||
# Test #1183: numpy.testing.assert_array* ignores any masked value, so work-around | ||
def test_masked_arrays(): | ||
"""Test that we catch masked arrays with different masks.""" | ||
with pytest.raises(AssertionError): | ||
assert_array_almost_equal(np.array([10, 20]), | ||
np.ma.array([10, np.nan], mask=[False, True]), 2) | ||
|
||
|
||
def test_masked_and_no_mask(): | ||
"""Test that we can compare a masked array with no masked values and a regular array.""" | ||
a = np.array([10, 20]) | ||
b = np.ma.array([10, 20], mask=[False, False]) | ||
assert_array_almost_equal(a, b) |