Code Duplication    Length = 29-32 lines in 2 locations

aacgmv2/tests/test_py_aacgmv2.py 2 locations

@@ 695-726 (lines=32) @@
692
        np.testing.assert_allclose(self.mlt_out,
693
                                   [0.18891995, 0.21870017], rtol=1e-4)
694
695
    def test_get_aacgm_coord_arr_mult_arr_mix(self):
696
        """Test array AACGMV2 calculation for a multi-dim array and
697
        floats"""
698
        mlat_in = np.array([[60, 61, 62], [63, 64, 65]])
699
        (self.mlat_out, self.mlon_out,
700
         self.mlt_out) = aacgmv2.get_aacgm_coord_arr(mlat_in, 0, 300,
701
                                                     self.dtime)
702
703
        if not isinstance(self.mlat_out, np.ndarray):
704
            raise AssertionError()
705
        if not isinstance(self.mlon_out, np.ndarray):
706
            raise AssertionError()
707
        if not isinstance(self.mlt_out, np.ndarray):
708
            raise AssertionError()
709
        if not (self.mlt_out.shape == self.mlon_out.shape and
710
                self.mlat_out.shape == self.mlt_out.shape and
711
                self.mlt_out.shape == (2, 3)):
712
            raise AssertionError()
713
714
        np.testing.assert_allclose(self.mlat_out,
715
                                   [[58.2247461, 59.3164801, 60.4008651],
716
                                    [61.4780560, 62.5481858, 63.6113609]],
717
                                   rtol=1e-4)
718
        np.testing.assert_allclose(self.mlon_out,
719
                                   [[81.1761103, 81.6228136, 82.0969646],
720
                                    [82.6013918, 83.1393547, 83.7146224]],
721
                                   rtol=1e-4)
722
        np.testing.assert_allclose(self.mlt_out,
723
                                   [[0.18891995, 0.21870017, 0.25031024],
724
                                    [0.28393872, 0.31980291, 0.35815409]],
725
                                   rtol=1e-4)
726
        del mlat_in
727
728
    def test_get_aacgm_coord_arr_arr_unequal(self):
729
        """Test array AACGMV2 calculation for unequal arrays"""
@@ 728-756 (lines=29) @@
725
                                   rtol=1e-4)
726
        del mlat_in
727
728
    def test_get_aacgm_coord_arr_arr_unequal(self):
729
        """Test array AACGMV2 calculation for unequal arrays"""
730
        mlat_in = np.array([[60, 61, 62], [63, 64, 65]])
731
        (self.mlat_out, self.mlon_out,
732
         self.mlt_out) = aacgmv2.get_aacgm_coord_arr(mlat_in, np.array([0]),
733
                                                     np.array([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.2247, 59.3165, 60.4009],
749
                                    [61.4781, 62.5482, 63.6114]], rtol=1e-3)
750
        np.testing.assert_allclose(self.mlon_out,
751
                                   [[81.1761, 81.6228, 82.0970],
752
                                    [82.6014, 83.1394, 83.7146]], rtol=1e-3)
753
        np.testing.assert_allclose(self.mlt_out,
754
                                   [[0.1889, 0.2187, 0.2503],
755
                                    [0.2839, 0.3198, 0.3582]], rtol=1e-3)
756
        del mlat_in
757
758
    def test_get_aacgm_coord_arr_badidea(self):
759
        """Test array AACGMV2 calculation for BADIDEA"""