Code Duplication    Length = 13-14 lines in 4 locations

aacgmv2/tests/test_c_aacgmv2.py 4 locations

@@ 239-252 (lines=14) @@
236
237
        del code
238
239
    def test_convert_GEOCENTRIC_A2G_TRACE(self):
240
        """Test convert from magnetic to geographic coordinates using trace"""
241
        code = aacgmv2._aacgmv2.A2G + aacgmv2._aacgmv2.TRACE + \
242
               aacgmv2._aacgmv2.GEOCENTRIC
243
        aacgmv2._aacgmv2.set_datetime(*self.date_args[0])
244
        (self.mlat, self.mlon,
245
         self.rshell) = aacgmv2._aacgmv2.convert(self.lat_in[0], self.lon_in[0],
246
                                                 self.alt_in[0], code,
247
                                                 aacgmv2.IGRF_12_COEFFS)
248
        np.testing.assert_almost_equal(self.mlat, 30.6211, decimal=4)
249
        np.testing.assert_almost_equal(self.mlon, -94.1809, decimal=4)
250
        np.testing.assert_almost_equal(self.rshell, 1135.0000, decimal=4)
251
252
        del code
253
254
    def test_forbidden(self):
255
        """Test convert failure"""
@@ 224-237 (lines=14) @@
221
222
        del code
223
224
    def test_convert_GEOCENTRIC_G2A_TRACE(self):
225
        """Test convert from geographic to magnetic coordinates using trace"""
226
        code = aacgmv2._aacgmv2.G2A + aacgmv2._aacgmv2.TRACE + \
227
               aacgmv2._aacgmv2.GEOCENTRIC
228
        aacgmv2._aacgmv2.set_datetime(*self.date_args[0])
229
        (self.mlat, self.mlon,
230
         self.rshell) = aacgmv2._aacgmv2.convert(self.lat_in[0], self.lon_in[0],
231
                                                 self.alt_in[0], code,
232
                                                 aacgmv2.IGRF_12_COEFFS)
233
        np.testing.assert_almost_equal(self.mlat, 48.3830, decimal=4)
234
        np.testing.assert_almost_equal(self.mlon, 57.7926, decimal=4)
235
        np.testing.assert_almost_equal(self.rshell, 1.1781, decimal=4)
236
237
        del code
238
239
    def test_convert_GEOCENTRIC_A2G_TRACE(self):
240
        """Test convert from magnetic to geographic coordinates using trace"""
@@ 210-222 (lines=13) @@
207
208
        del code
209
        
210
    def test_convert_GEOCENTRIC_A2G_coeff(self):
211
        """Test convert from magnetic to geocentric coordinates"""
212
        code = aacgmv2._aacgmv2.A2G + aacgmv2._aacgmv2.GEOCENTRIC
213
        aacgmv2._aacgmv2.set_datetime(*self.date_args[0])
214
        (self.mlat, self.mlon,
215
         self.rshell) = aacgmv2._aacgmv2.convert(self.lat_in[0], self.lon_in[0],
216
                                                 self.alt_in[0], code,
217
                                                 aacgmv2.IGRF_12_COEFFS)
218
        np.testing.assert_almost_equal(self.mlat, 30.6101, decimal=4)
219
        np.testing.assert_almost_equal(self.mlon, -94.1806, decimal=4)
220
        np.testing.assert_almost_equal(self.rshell, 1135.0000, decimal=4)
221
222
        del code
223
224
    def test_convert_GEOCENTRIC_G2A_TRACE(self):
225
        """Test convert from geographic to magnetic coordinates using trace"""
@@ 196-208 (lines=13) @@
193
194
        del code
195
196
    def test_convert_GEOCENTRIC_G2A_coeff(self):
197
        """Test convert from geographic to magnetic coordinates"""
198
        code = aacgmv2._aacgmv2.G2A + aacgmv2._aacgmv2.GEOCENTRIC
199
        aacgmv2._aacgmv2.set_datetime(*self.date_args[0])
200
        (self.mlat, self.mlon,
201
         self.rshell) = aacgmv2._aacgmv2.convert(self.lat_in[0], self.lon_in[0],
202
                                                 self.alt_in[0], code,
203
                                                 aacgmv2.IGRF_12_COEFFS)
204
        np.testing.assert_almost_equal(self.mlat, 48.3779, decimal=4)
205
        np.testing.assert_almost_equal(self.mlon, 57.7974, decimal=4)
206
        np.testing.assert_almost_equal(self.rshell, 1.1781, decimal=4)
207
208
        del code
209
        
210
    def test_convert_GEOCENTRIC_A2G_coeff(self):
211
        """Test convert from magnetic to geocentric coordinates"""