test_trajectory_ingestor.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:DGP 作者: DynamicGravitySystems 项目源码 文件源码
def test_import_trajectory_interp_nans(self):
        fields = ['mdy', 'hms', 'lat', 'long', 'ell_ht', 'ortho_ht', 'num_sats', 'pdop']
        df = ti.import_trajectory(os.path.abspath('tests/sample_trajectory.txt'),
                                  columns=fields, skiprows=1, timeformat='hms',
                                  interp=True)

        # Test and verify an arbitrary line of data against the same line in the pandas DataFrame
        line11 = ['3/22/2017', '9:59:00.20', 76.5350241071, -68.7218956324, 65.898, 82.778, 11, 2.00]
        sample_line = dict(zip(fields, line11))

        np.testing.assert_almost_equal(df.lat[10], sample_line['lat'], decimal=10)
        np.testing.assert_almost_equal(df.long[10], sample_line['long'], decimal=10)
        numeric = df.select_dtypes(include=[np.number])

        # check whether NaNs were interpolated for numeric type fields
        self.assertTrue(numeric.iloc[[2]].notnull().values.all())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号