Code Duplication    Length = 29-32 lines in 2 locations

aacgmv2/tests/test_py_aacgmv2.py 2 locations

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