def test_GEO_GSE(self): """regression test on GEO_TO_GSM""" expected = [-1.4268697964755936, -0.6973756761170802, 3.3878768794432226] numpy.testing.assert_allclose(expected, magcoords.coordTrans([1,2,3], datetime.datetime(2012, 3, 4), 'GEO', 'GSE')) numpy.testing.assert_allclose([1,2,3], magcoords.coordTrans(expected, datetime.datetime(2012, 3, 4), 'GSE', 'GEO'))
def test_end2end(self): """quick functional tests (regression)""" ans = [-3.608026916281572, 4.163336342344337e-17, -1.7268878861662331] numpy.testing.assert_allclose(ans, magcoords.coordTrans([-4, 0, 0], datetime.datetime( 2009, 1, 1), 'SM', 'GSM'), atol=1e-8) ans = [-3.9999999999999991, 1.87350135e-16, 0.00000000e+00] numpy.testing.assert_allclose( ans, magcoords.coordTrans([ -3.608026916281573, 2.5673907444456745e-16, -1.7268878861662329 ], datetime.datetime(2009, 1, 1), 'GSM', 'SM'), atol=1e-8) ans = [-0.8908435824705201, 0.09891125760552615, -0.4434120822553017] numpy.testing.assert_allclose(ans, magcoords.coordTrans([-4, 0, 1], datetime.datetime( 2009, 1, 1), 'WGS84', 'GSM'), rtol=1e-6) ans = [36.7677624344546, -2.329852593118382, 4.12310562561766] numpy.testing.assert_allclose(ans, magcoords.coordTrans([-4, 0, 1], datetime.datetime( 2009, 1, 1), 'GSM', 'WGS84'), rtol=1e-6)
def test_GEO_GSE(self): """regression test on GEO_TO_GSM""" expected = [ -1.4268697964755936, -0.6973756761170802, 3.3878768794432226 ] numpy.testing.assert_allclose( expected, magcoords.coordTrans([1, 2, 3], datetime.datetime(2012, 3, 4), 'GEO', 'GSE')) numpy.testing.assert_allclose([1, 2, 3], magcoords.coordTrans( expected, datetime.datetime(2012, 3, 4), 'GSE', 'GEO'))
def test_end2end(self): """quick functional tests (regression)""" ans = [-3.608026916281572, 4.163336342344337e-17, -1.7268878861662331] numpy.testing.assert_allclose(ans, magcoords.coordTrans([-4,0,0], datetime.datetime(2009,1,1), 'SM','GSM'), atol=1e-8) ans = [-3.9999999999999991, 1.87350135e-16, 0.00000000e+00] numpy.testing.assert_allclose(ans, magcoords.coordTrans([-3.608026916281573, 2.5673907444456745e-16, -1.7268878861662329], datetime.datetime(2009,1,1),'GSM','SM'), atol=1e-8) ans = [-0.8908435824705201, 0.09891125760552615, -0.4434120822553017] numpy.testing.assert_allclose(ans, magcoords.coordTrans([-4, 0, 1], datetime.datetime(2009,1,1), 'WGS84', 'GSM'), rtol=1e-6) ans = [36.7677624344546, -2.329852593118382, 4.12310562561766] numpy.testing.assert_allclose(ans, magcoords.coordTrans([-4, 0, 1], datetime.datetime(2009,1,1), 'GSM', 'WGS84'), rtol=1e-6)
def test_Pin_pos_in(self): """I don't understand why this is here but here is a regression test""" in_pos = Lgm_Vector.Lgm_Vector(-4, 0, 0) ans = [-3.608026916281572, 4.163336342344337e-17, -1.7268878861662331] numpy.testing.assert_allclose( ans, magcoords.coordTrans(in_pos, datetime.datetime(2009, 1, 1), 'SM', 'GSM'), atol=1e-8)
def convert_cdmag_gsm(row, frm="CDMAG", to="GSM"): """ All the data in CDMAG from the web database are converted GSM coordinates """ a = [row["CDMAG_R"], row["CDMAG_MLAT"], row["CDMAG_MLON"]] x = magcoords.coordTrans(a, row["epoch"], frm, to) row["R"], row["MLAT"], row["MLON"] = x[0], x[1], x[2] row["MLT"] = aacgmv2.convert_mlt([x[2]], row["epoch"], m2a=False)[0] return row
def test_Pin_pos_in(self): """I don't understand why this is here but here is a regression test""" in_pos = Lgm_Vector.Lgm_Vector(-4,0,0) ans = [-3.608026916281572, 4.163336342344337e-17, -1.7268878861662331] numpy.testing.assert_allclose(ans, magcoords.coordTrans(in_pos, datetime.datetime(2009,1,1),'SM','GSM'), atol=1e-8)