-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
58 additions
and
112 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
27 changes: 27 additions & 0 deletions
27
improver_tests/utilities/complex_conversion/test_integration.py
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,27 @@ | ||
# (C) Crown copyright, Met Office. All rights reserved. | ||
# | ||
# This file is part of IMPROVER and is released under a BSD 3-Clause license. | ||
# See LICENSE in the root of the repository for full licensing details. | ||
import numpy as np | ||
from numpy.testing import assert_array_almost_equal | ||
|
||
from improver.utilities.complex_conversion import deg_to_complex, complex_to_deg | ||
|
||
from . import COMPLEX_ANGLES | ||
|
||
|
||
def test_roundtrip_complex_deg_complex(): | ||
"""Tests that array of values are converted to degrees and back.""" | ||
tmp_degrees = complex_to_deg(COMPLEX_ANGLES) | ||
result = deg_to_complex(tmp_degrees) | ||
assert_array_almost_equal(result, COMPLEX_ANGLES) | ||
|
||
|
||
def test_roundtrip_deg_complex_deg(): | ||
"""Tests that array of values are converted to complex and back.""" | ||
src_degrees = np.arange(0., 360, 10) | ||
tmp_complex = deg_to_complex(src_degrees) | ||
result = complex_to_deg(tmp_complex) | ||
assert_array_almost_equal(result, src_degrees) | ||
|
||
|
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