Code Duplication    Length = 29-32 lines in 2 locations

aacgmv2/tests/test_py_aacgmv2.py 2 locations

@@ 678-709 (lines=32) @@
675
        np.testing.assert_allclose(self.mlt_out,
676
                                   [0.18891995, 0.21870017], rtol=1e-4)
677
678
    def test_get_aacgm_coord_arr_mult_arr_mix(self):
679
        """Test array AACGMV2 calculation for a multi-dim array and
680
        floats"""
681
        mlat_in = np.array([[60, 61, 62], [63, 64, 65]])
682
        (self.mlat_out, self.mlon_out,
683
         self.mlt_out) = aacgmv2.get_aacgm_coord_arr(mlat_in, 0, 300,
684
                                                     self.dtime)
685
686
        if not isinstance(self.mlat_out, np.ndarray):
687
            raise AssertionError()
688
        if not isinstance(self.mlon_out, np.ndarray):
689
            raise AssertionError()
690
        if not isinstance(self.mlt_out, np.ndarray):
691
            raise AssertionError()
692
        if not (self.mlt_out.shape == self.mlon_out.shape and
693
                self.mlat_out.shape == self.mlt_out.shape and
694
                self.mlt_out.shape == (2, 3)):
695
            raise AssertionError()
696
697
        np.testing.assert_allclose(self.mlat_out,
698
                                   [[58.2247461, 59.3164801, 60.4008651],
699
                                    [61.4780560, 62.5481858, 63.6113609]],
700
                                   rtol=1e-4)
701
        np.testing.assert_allclose(self.mlon_out,
702
                                   [[81.1761103, 81.6228136, 82.0969646],
703
                                    [82.6013918, 83.1393547, 83.7146224]],
704
                                   rtol=1e-4)
705
        np.testing.assert_allclose(self.mlt_out,
706
                                   [[0.18891995, 0.21870017, 0.25031024],
707
                                    [0.28393872, 0.31980291, 0.35815409]],
708
                                   rtol=1e-4)
709
        del mlat_in
710
711
    def test_get_aacgm_coord_arr_arr_unequal(self):
712
        """Test array AACGMV2 calculation for unequal arrays"""
@@ 711-739 (lines=29) @@
708
                                   rtol=1e-4)
709
        del mlat_in
710
711
    def test_get_aacgm_coord_arr_arr_unequal(self):
712
        """Test array AACGMV2 calculation for unequal arrays"""
713
        mlat_in = np.array([[60, 61, 62], [63, 64, 65]])
714
        (self.mlat_out, self.mlon_out,
715
         self.mlt_out) = aacgmv2.get_aacgm_coord_arr(mlat_in, np.array([0]),
716
                                                     np.array([300]),
717
                                                     self.dtime)
718
719
        if not isinstance(self.mlat_out, np.ndarray):
720
            raise AssertionError()
721
        if not isinstance(self.mlon_out, np.ndarray):
722
            raise AssertionError()
723
        if not isinstance(self.mlt_out, np.ndarray):
724
            raise AssertionError()
725
        if not (self.mlt_out.shape == self.mlon_out.shape and
726
                self.mlat_out.shape == self.mlt_out.shape and
727
                self.mlt_out.shape == (2, 3)):
728
            raise AssertionError()
729
730
        np.testing.assert_allclose(self.mlat_out,
731
                                   [[58.2247, 59.3165, 60.4009],
732
                                    [61.4781, 62.5482, 63.6114]], rtol=1e-3)
733
        np.testing.assert_allclose(self.mlon_out,
734
                                   [[81.1761, 81.6228, 82.0970],
735
                                    [82.6014, 83.1394, 83.7146]], rtol=1e-3)
736
        np.testing.assert_allclose(self.mlt_out,
737
                                   [[0.1889, 0.2187, 0.2503],
738
                                    [0.2839, 0.3198, 0.3582]], rtol=1e-3)
739
        del mlat_in
740
741
    def test_get_aacgm_coord_arr_badidea(self):
742
        """Test array AACGMV2 calculation for BADIDEA"""