Example #1
0
    def test_imt_calculated_metadata(self):
        with IncompleteMultidimensionalTrajectory(self.single) as ncd:
            s = ncd.calculated_metadata()
            assert s.min_t == dtparse('1990-01-01 00:00:00')
            assert s.max_t == dtparse('1990-01-05 03:00:00')
            traj1 = s.trajectories["Trajectory1"]
            assert traj1.min_z == 0
            assert traj1.max_z == 99
            assert traj1.min_t == dtparse('1990-01-01 00:00:00')
            assert traj1.max_t == dtparse('1990-01-05 03:00:00')
            assert np.isclose(traj1.first_loc.x, -7.9336)
            assert np.isclose(traj1.first_loc.y, 42.00339)

        with IncompleteMultidimensionalTrajectory(self.multi) as ncd:
            m = ncd.calculated_metadata()
            assert m.min_t == dtparse('1990-01-01 00:00:00')
            assert m.max_t == dtparse('1990-01-02 12:00:00')
            assert len(m.trajectories) == 4
            traj0 = m.trajectories["Trajectory0"]
            assert traj0.min_z == 0
            assert traj0.max_z == 35
            assert traj0.min_t == dtparse('1990-01-01 00:00:00')
            assert traj0.max_t == dtparse('1990-01-02 11:00:00')
            assert np.isclose(traj0.first_loc.x, -35.07884)
            assert np.isclose(traj0.first_loc.y, 2.15286)

            traj3 = m.trajectories["Trajectory3"]
            assert traj3.min_z == 0
            assert traj3.max_z == 36
            assert traj3.min_t == dtparse('1990-01-01 00:00:00')
            assert traj3.max_t == dtparse('1990-01-02 12:00:00')
            assert np.isclose(traj3.first_loc.x, -73.3026)
            assert np.isclose(traj3.first_loc.y, 1.95761)
Example #2
0
    def test_imt_dataframe(self):
        single_tmp = tempfile.mkstemp(suffix='.nc')[-1]
        with IncompleteMultidimensionalTrajectory(self.single) as ncd:
            single_df = ncd.to_dataframe(clean_rows=False)
            single_nc = IncompleteMultidimensionalTrajectory.from_dataframe(
                single_df, single_tmp)
            single_nc.close()
        os.remove(single_tmp)

        multip_tmp = tempfile.mkstemp(suffix='.nc')[-1]
        with IncompleteMultidimensionalTrajectory(self.multi) as ncd:
            multip_df = ncd.to_dataframe(clean_rows=False)
            multip_nc = IncompleteMultidimensionalTrajectory.from_dataframe(
                multip_df, multip_tmp)
            multip_nc.close()
        os.remove(multip_tmp)
Example #3
0
    def test_json_attributes(self):
        with IncompleteMultidimensionalTrajectory(self.single) as s:
            s.json_attributes()

        with IncompleteMultidimensionalTrajectory(self.multi) as m:
            m.json_attributes()
Example #4
0
 def test_imt_load(self):
     IncompleteMultidimensionalTrajectory(self.single).close()
     IncompleteMultidimensionalTrajectory(self.multi).close()