Code Duplication    Length = 29-32 lines in 2 locations

aacgmv2/tests/test_py_aacgmv2.py 2 locations

@@ 726-757 (lines=32) @@
723
        np.testing.assert_allclose(self.mlt_out,
724
                                   [0.18891995, 0.21870017], rtol=1e-4)
725
726
    def test_get_aacgm_coord_arr_mult_arr_mix(self):
727
        """Test array AACGMV2 calculation for a multi-dim array and
728
        floats"""
729
        mlat_in = np.array([[60, 61, 62], [63, 64, 65]])
730
        (self.mlat_out, self.mlon_out,
731
         self.mlt_out) = aacgmv2.get_aacgm_coord_arr(mlat_in, 0, 300,
732
                                                     self.dtime)
733
734
        if not isinstance(self.mlat_out, np.ndarray):
735
            raise AssertionError()
736
        if not isinstance(self.mlon_out, np.ndarray):
737
            raise AssertionError()
738
        if not isinstance(self.mlt_out, np.ndarray):
739
            raise AssertionError()
740
        if not (self.mlt_out.shape == self.mlon_out.shape and
741
                self.mlat_out.shape == self.mlt_out.shape and
742
                self.mlt_out.shape == (2, 3)):
743
            raise AssertionError()
744
745
        np.testing.assert_allclose(self.mlat_out,
746
                                   [[58.2247461, 59.3164801, 60.4008651],
747
                                    [61.4780560, 62.5481858, 63.6113609]],
748
                                   rtol=1e-4)
749
        np.testing.assert_allclose(self.mlon_out,
750
                                   [[81.1761103, 81.6228136, 82.0969646],
751
                                    [82.6013918, 83.1393547, 83.7146224]],
752
                                   rtol=1e-4)
753
        np.testing.assert_allclose(self.mlt_out,
754
                                   [[0.18891995, 0.21870017, 0.25031024],
755
                                    [0.28393872, 0.31980291, 0.35815409]],
756
                                   rtol=1e-4)
757
        del mlat_in
758
759
    def test_get_aacgm_coord_arr_arr_unequal(self):
760
        """Test array AACGMV2 calculation for unequal arrays"""
@@ 759-787 (lines=29) @@
756
                                   rtol=1e-4)
757
        del mlat_in
758
759
    def test_get_aacgm_coord_arr_arr_unequal(self):
760
        """Test array AACGMV2 calculation for unequal arrays"""
761
        mlat_in = np.array([[60, 61, 62], [63, 64, 65]])
762
        (self.mlat_out, self.mlon_out,
763
         self.mlt_out) = aacgmv2.get_aacgm_coord_arr(mlat_in, np.array([0]),
764
                                                     np.array([300]),
765
                                                     self.dtime)
766
767
        if not isinstance(self.mlat_out, np.ndarray):
768
            raise AssertionError()
769
        if not isinstance(self.mlon_out, np.ndarray):
770
            raise AssertionError()
771
        if not isinstance(self.mlt_out, np.ndarray):
772
            raise AssertionError()
773
        if not (self.mlt_out.shape == self.mlon_out.shape and
774
                self.mlat_out.shape == self.mlt_out.shape and
775
                self.mlt_out.shape == (2, 3)):
776
            raise AssertionError()
777
778
        np.testing.assert_allclose(self.mlat_out,
779
                                   [[58.2247, 59.3165, 60.4009],
780
                                    [61.4781, 62.5482, 63.6114]], rtol=1e-3)
781
        np.testing.assert_allclose(self.mlon_out,
782
                                   [[81.1761, 81.6228, 82.0970],
783
                                    [82.6014, 83.1394, 83.7146]], rtol=1e-3)
784
        np.testing.assert_allclose(self.mlt_out,
785
                                   [[0.1889, 0.2187, 0.2503],
786
                                    [0.2839, 0.3198, 0.3582]], rtol=1e-3)
787
        del mlat_in
788
789
    def test_get_aacgm_coord_arr_badidea(self):
790
        """Test array AACGMV2 calculation for BADIDEA"""