Code Duplication    Length = 25-28 lines in 2 locations

aacgmv2/tests/test_py_aacgmv2.py 2 locations

@@ 640-667 (lines=28) @@
637
        np.testing.assert_allclose(self.mlt_out,
638
                                   [0.18891995, 0.21870017], rtol=1e-4)
639
640
    def test_get_aacgm_coord_arr_mult_arr_mix(self):
641
        """Test array AACGMV2 calculation for a multi-dim array and
642
        floats"""
643
        mlat_in = np.array([[60, 61, 62], [63, 64, 65]])
644
        (self.mlat_out, self.mlon_out,
645
         self.mlt_out) = aacgmv2.get_aacgm_coord_arr(mlat_in, 0, 300,
646
                                                     self.dtime)
647
648
        assert isinstance(self.mlat_out, np.ndarray)
649
        assert isinstance(self.mlon_out, np.ndarray)
650
        assert isinstance(self.mlt_out, np.ndarray)
651
        assert (self.mlt_out.shape == self.mlon_out.shape and
652
                self.mlat_out.shape == self.mlt_out.shape and
653
                self.mlt_out.shape == (2, 3))
654
655
        np.testing.assert_allclose(self.mlat_out,
656
                                   [[58.2247461, 59.3164801, 60.4008651],
657
                                    [61.4780560, 62.5481858, 63.6113609]],
658
                                   rtol=1e-4)
659
        np.testing.assert_allclose(self.mlon_out,
660
                                   [[81.1761103, 81.6228136, 82.0969646],
661
                                    [82.6013918, 83.1393547, 83.7146224]],
662
                                   rtol=1e-4)
663
        np.testing.assert_allclose(self.mlt_out,
664
                                   [[0.18891995, 0.21870017, 0.25031024],
665
                                    [0.28393872, 0.31980291, 0.35815409]],
666
                                   rtol=1e-4)
667
        del mlat_in
668
669
    def test_get_aacgm_coord_arr_arr_unequal(self):
670
        """Test array AACGMV2 calculation for unequal arrays"""
@@ 669-693 (lines=25) @@
666
                                   rtol=1e-4)
667
        del mlat_in
668
669
    def test_get_aacgm_coord_arr_arr_unequal(self):
670
        """Test array AACGMV2 calculation for unequal arrays"""
671
        mlat_in = np.array([[60, 61, 62], [63, 64, 65]])
672
        (self.mlat_out, self.mlon_out,
673
         self.mlt_out) = aacgmv2.get_aacgm_coord_arr(mlat_in, np.array([0]),
674
                                                     np.array([300]),
675
                                                     self.dtime)
676
677
        assert isinstance(self.mlat_out, np.ndarray)
678
        assert isinstance(self.mlon_out, np.ndarray)
679
        assert isinstance(self.mlt_out, np.ndarray)
680
        assert (self.mlt_out.shape == self.mlon_out.shape and
681
                self.mlat_out.shape == self.mlt_out.shape and
682
                self.mlt_out.shape == (2, 3))
683
684
        np.testing.assert_allclose(self.mlat_out,
685
                                   [[58.2247, 59.3165, 60.4009],
686
                                    [61.4781, 62.5482, 63.6114]], rtol=1e-3)
687
        np.testing.assert_allclose(self.mlon_out,
688
                                   [[81.1761, 81.6228, 82.0970],
689
                                    [82.6014, 83.1394, 83.7146]], rtol=1e-3)
690
        np.testing.assert_allclose(self.mlt_out,
691
                                   [[0.1889, 0.2187, 0.2503],
692
                                    [0.2839, 0.3198, 0.3582]], rtol=1e-3)
693
        del mlat_in
694
695
    def test_get_aacgm_coord_arr_badidea_failure(self):
696
        """Test array AACGMV2 calculation failure for BADIDEA"""