|
@@ 604-628 (lines=25) @@
|
| 601 |
|
np.testing.assert_almost_equal(self.mlon_out, 81.1761, decimal=4) |
| 602 |
|
np.testing.assert_almost_equal(self.mlt_out, 0.1889, decimal=4) |
| 603 |
|
|
| 604 |
|
def test_get_aacgm_coord_arr_arr(self): |
| 605 |
|
"""Test array AACGMV2 calculation for an array""" |
| 606 |
|
(self.mlat_out, self.mlon_out, |
| 607 |
|
self.mlt_out) = aacgmv2.get_aacgm_coord_arr(np.array([60, 61]), |
| 608 |
|
np.array([0, 0]), |
| 609 |
|
np.array([300, 300]), |
| 610 |
|
self.dtime) |
| 611 |
|
|
| 612 |
|
if not isinstance(self.mlat_out, np.ndarray): |
| 613 |
|
raise AssertionError() |
| 614 |
|
if not isinstance(self.mlon_out, np.ndarray): |
| 615 |
|
raise AssertionError() |
| 616 |
|
if not isinstance(self.mlt_out, np.ndarray): |
| 617 |
|
raise AssertionError() |
| 618 |
|
if not (self.mlt_out.shape == self.mlon_out.shape and |
| 619 |
|
self.mlat_out.shape == self.mlt_out.shape and |
| 620 |
|
self.mlt_out.shape == (2,)): |
| 621 |
|
raise AssertionError() |
| 622 |
|
|
| 623 |
|
np.testing.assert_allclose(self.mlat_out, |
| 624 |
|
[58.22474610, 59.31648007], rtol=1e-4) |
| 625 |
|
np.testing.assert_allclose(self.mlon_out, |
| 626 |
|
[81.17611033, 81.62281360], rtol=1e-4) |
| 627 |
|
np.testing.assert_allclose(self.mlt_out, |
| 628 |
|
[0.18891995, 0.21870017], rtol=1e-4) |
| 629 |
|
|
| 630 |
|
def test_get_aacgm_coord_arr_list_mix(self): |
| 631 |
|
"""Test array AACGMV2 calculation for a list and floats""" |
|
@@ 557-579 (lines=23) @@
|
| 554 |
|
np.testing.assert_allclose(self.mlon_out, [81.17611033], rtol=1e-4) |
| 555 |
|
np.testing.assert_allclose(self.mlt_out, [0.18891995], rtol=1e-4) |
| 556 |
|
|
| 557 |
|
def test_get_aacgm_coord_arr_list(self): |
| 558 |
|
"""Test array AACGMV2 calculation for list input""" |
| 559 |
|
(self.mlat_out, self.mlon_out, |
| 560 |
|
self.mlt_out) = aacgmv2.get_aacgm_coord_arr([60, 61], [0, 0], |
| 561 |
|
[300, 300], self.dtime) |
| 562 |
|
|
| 563 |
|
if not isinstance(self.mlat_out, np.ndarray): |
| 564 |
|
raise AssertionError() |
| 565 |
|
if not isinstance(self.mlon_out, np.ndarray): |
| 566 |
|
raise AssertionError() |
| 567 |
|
if not isinstance(self.mlt_out, np.ndarray): |
| 568 |
|
raise AssertionError() |
| 569 |
|
if not (self.mlt_out.shape == self.mlon_out.shape and |
| 570 |
|
self.mlat_out.shape == self.mlt_out.shape and |
| 571 |
|
self.mlt_out.shape == (2,)): |
| 572 |
|
raise AssertionError() |
| 573 |
|
|
| 574 |
|
np.testing.assert_allclose(self.mlat_out, |
| 575 |
|
[58.22474610, 59.31648007], rtol=1e-4) |
| 576 |
|
np.testing.assert_allclose(self.mlon_out, |
| 577 |
|
[81.17611033, 81.62281360], rtol=1e-4) |
| 578 |
|
np.testing.assert_allclose(self.mlt_out, |
| 579 |
|
[0.18891995, 0.21870017], rtol=1e-4) |
| 580 |
|
|
| 581 |
|
def test_get_aacgm_coord_arr_arr_single(self): |
| 582 |
|
"""Test array AACGMV2 calculation for array with a single value""" |
|
@@ 536-555 (lines=20) @@
|
| 533 |
|
np.testing.assert_allclose(self.mlon_out, [81.17611033], rtol=1e-4) |
| 534 |
|
np.testing.assert_allclose(self.mlt_out, [0.18891995], rtol=1e-4) |
| 535 |
|
|
| 536 |
|
def test_get_aacgm_coord_arr_list_single(self): |
| 537 |
|
"""Test array AACGMV2 calculation for list input of single values""" |
| 538 |
|
(self.mlat_out, self.mlon_out, |
| 539 |
|
self.mlt_out) = aacgmv2.get_aacgm_coord_arr([60], [0], [300], |
| 540 |
|
self.dtime) |
| 541 |
|
|
| 542 |
|
if not isinstance(self.mlat_out, np.ndarray): |
| 543 |
|
raise AssertionError() |
| 544 |
|
if not isinstance(self.mlon_out, np.ndarray): |
| 545 |
|
raise AssertionError() |
| 546 |
|
if not isinstance(self.mlt_out, np.ndarray): |
| 547 |
|
raise AssertionError() |
| 548 |
|
if not (self.mlt_out.shape == self.mlon_out.shape and |
| 549 |
|
self.mlat_out.shape == self.mlt_out.shape and |
| 550 |
|
self.mlt_out.shape == (1,)): |
| 551 |
|
raise AssertionError() |
| 552 |
|
|
| 553 |
|
np.testing.assert_allclose(self.mlat_out, [58.22474610], rtol=1e-4) |
| 554 |
|
np.testing.assert_allclose(self.mlon_out, [81.17611033], rtol=1e-4) |
| 555 |
|
np.testing.assert_allclose(self.mlt_out, [0.18891995], rtol=1e-4) |
| 556 |
|
|
| 557 |
|
def test_get_aacgm_coord_arr_list(self): |
| 558 |
|
"""Test array AACGMV2 calculation for list input""" |