コード例 #1
0
 def test_split_by_daybreak_same_day_of_year(self):
     traj = make_traj([Node(), Node(second=1), Node(year=2000), Node(year=2000, second=1)])
     split = TemporalSplitter(traj).split()
     assert type(split) == TrajectoryCollection
     assert len(split) == 2
     assert split.trajectories[0] == make_traj([Node(), Node(second=1)], id='1_1970-01-01 00:00:00')
     assert split.trajectories[1] == make_traj([Node(year=2000), Node(year=2000, second=1)], id='1_2000-01-01 00:00:00')
コード例 #2
0
 def test_split_by_date_ignores_single_node_sgements(self):
     traj = make_traj([Node(), Node(second=1), Node(day=2)])
     split = TemporalSplitter(traj).split()
     assert type(split) == TrajectoryCollection
     assert len(split) == 1
     assert split.trajectories[0] == make_traj(
         [Node(), Node(second=1)], id="1_1970-01-01 00:00:00")
コード例 #3
0
 def test_split_by_year(self):
     traj = make_traj([Node(), Node(second=1), Node(day=2), Node(day=2, second=1),
                       Node(year=2000), Node(year=2000, second=1)])
     split = TemporalSplitter(traj).split(mode='year')
     assert type(split) == TrajectoryCollection
     assert len(split) == 2
     assert split.trajectories[0] == make_traj([Node(), Node(second=1), Node(day=2), Node(day=2, second=1)], id='1_1970-12-31 00:00:00')
     assert split.trajectories[1] == make_traj([Node(year=2000), Node(year=2000, second=1)], id='1_2000-12-31 00:00:00')
コード例 #4
0
 def test_split_by_month(self):
     traj = make_traj([Node(), Node(second=1), Node(day=2), Node(day=2, second=1),
                       Node(month=2), Node(month=2, second=1)])
     split = TemporalSplitter(traj).split(mode='month')
     assert type(split) == TrajectoryCollection
     assert len(split) == 2
     assert split.trajectories[0] == make_traj([Node(), Node(second=1), Node(day=2), Node(day=2, second=1)], id='1_1970-01-31 00:00:00')
     assert split.trajectories[1] == make_traj([Node(month=2), Node(month=2, second=1)], id='1_1970-02-28 00:00:00')
コード例 #5
0
 def test_split_by_daybreak(self):
     traj = make_traj(
         [Node(),
          Node(second=1),
          Node(day=2),
          Node(day=2, second=1)])
     split = TemporalSplitter(traj).split()
     assert type(split) == TrajectoryCollection
     assert len(split) == 2
     assert split.trajectories[0] == make_traj(
         [Node(), Node(second=1)], id="1_1970-01-01 00:00:00")
     assert split.trajectories[1] == make_traj(
         [Node(day=2), Node(day=2, second=1)], id="1_1970-01-02 00:00:00")
コード例 #6
0
 def test_split_by_hour(self):
     traj = make_traj(
         [Node(),
          Node(second=1),
          Node(hour=1),
          Node(hour=1, second=1)])
     split = TemporalSplitter(traj).split(mode="hour")
     assert type(split) == TrajectoryCollection
     assert len(split) == 2
     assert split.trajectories[0] == make_traj(
         [Node(), Node(second=1)], id="1_1970-01-01 00:00:00")
     assert split.trajectories[1] == make_traj(
         [Node(hour=1), Node(hour=1, second=1)], id="1_1970-01-01 01:00:00")
コード例 #7
0
 def test_collection_split_by_date(self):
     split = TemporalSplitter(self.collection).split(mode="day")
     assert type(split) == TrajectoryCollection
     assert len(split) == 3