diff --git a/tests/analysis/test_location_identification.py b/tests/analysis/test_location_identification.py index 0643c9a8..860d1f55 100644 --- a/tests/analysis/test_location_identification.py +++ b/tests/analysis/test_location_identification.py @@ -90,14 +90,14 @@ def test_tresh_loc_time(self, example_staypoints, default_kwargs): def test_loc_period(self, example_staypoints, default_kwargs): """Test the minimum period per location parameter.""" - default_kwargs["thresh_loc_period"] = "2d" + default_kwargs["thresh_loc_period"] = "2D" f = pre_filter_locations(example_staypoints, **default_kwargs) assert all(f == (example_staypoints["location_id"] == 0)) def test_agg_level(self, example_staypoints, default_kwargs): """Test if different aggregation works.""" default_kwargs["agg_level"] = "user" - default_kwargs["thresh_loc_period"] = pd.Timedelta("1d") + default_kwargs["thresh_loc_period"] = pd.Timedelta("1D") f = pre_filter_locations(example_staypoints, **default_kwargs) assert all(f == (example_staypoints[["user_id", "location_id"]] == [0, 1]).all(axis=1)) diff --git a/tests/analysis/test_tracking_quality.py b/tests/analysis/test_tracking_quality.py index 90197ef6..61721073 100644 --- a/tests/analysis/test_tracking_quality.py +++ b/tests/analysis/test_tracking_quality.py @@ -306,7 +306,7 @@ def test_split_overlaps_hours_case2(self, testdata_sp_tpls_geolife_long): head2 = testdata_sp_tpls_geolife_long.head(2).copy() # construct the finished_at exactly one day after started_at - head2["finished_at"] = head2["started_at"] + pd.Timedelta("1d") + head2["finished_at"] = head2["started_at"] + pd.Timedelta("1D") # the records have the same hour hour_diff = (head2["finished_at"] - pd.Timestamp.resolution).dt.hour - head2["started_at"].dt.hour diff --git a/tests/preprocessing/test_trips.py b/tests/preprocessing/test_trips.py index 0043423e..9cabb774 100644 --- a/tests/preprocessing/test_trips.py +++ b/tests/preprocessing/test_trips.py @@ -186,11 +186,11 @@ def test_tours_with_gap(self, example_trip_data): def test_tour_times(self, example_trip_data): """Check whether the start and end times of generated tours are correct""" trips, _ = example_trip_data - _, tours = ti.preprocessing.trips.generate_tours(trips, max_nr_gaps=1, max_time="1d") + _, tours = ti.preprocessing.trips.generate_tours(trips, max_nr_gaps=1, max_time="1D") # check that all times are below the max time for i, row in tours.iterrows(): time_diff = row["finished_at"] - row["started_at"] - assert time_diff > pd.to_timedelta("0m") and time_diff < pd.to_timedelta("1d") + assert time_diff > pd.to_timedelta("0m") and time_diff < pd.to_timedelta("1D") # group trips by tour and check that start and end of each tour are correct grouped_trips = ti.preprocessing.trips.get_trips_grouped(trips, tours) diff --git a/tests/visualization/test_plotting.py b/tests/visualization/test_plotting.py index 834b98bd..c292ebf5 100644 --- a/tests/visualization/test_plotting.py +++ b/tests/visualization/test_plotting.py @@ -79,7 +79,7 @@ def test_parameter(self, caplog): class TestPlot_modal_split: def test_create_plot_geolife(self, geolife_triplegs_with_modes): """Check if we can run the plot function with geolife data without error""" - modal_split = calculate_modal_split(geolife_triplegs_with_modes, freq="d", per_user=False) + modal_split = calculate_modal_split(geolife_triplegs_with_modes, freq="D", per_user=False) plot_modal_split(modal_split) def test_check_dtype_error(self, geolife_triplegs_with_modes): @@ -93,19 +93,19 @@ def test_check_dtype_error(self, geolife_triplegs_with_modes): def test_multi_user_error(self, triplegs_with_modes): """Create a modal split plot based on randomly generated test data""" - modal_split = calculate_modal_split(triplegs_with_modes, freq="d", per_user=True, norm=True) + modal_split = calculate_modal_split(triplegs_with_modes, freq="D", per_user=True, norm=True) with pytest.raises(ValueError): plot_modal_split(modal_split) # make sure that there is no error if the data was correctly created - modal_split = calculate_modal_split(triplegs_with_modes, freq="d", per_user=False, norm=True) + modal_split = calculate_modal_split(triplegs_with_modes, freq="D", per_user=False, norm=True) plot_modal_split(modal_split) def test_create_plot_testdata(self, triplegs_with_modes): """Create a modal split plot based on randomly generated test data""" tmp_file = os.path.join("tests", "data", "modal_split_plot.png") - modal_split = calculate_modal_split(triplegs_with_modes, freq="d", per_user=False, norm=True) + modal_split = calculate_modal_split(triplegs_with_modes, freq="D", per_user=False, norm=True) modal_split = modal_split[["walk", "bike", "train", "car", "bus"]] # change order for the looks of the plot plot_modal_split( @@ -119,7 +119,7 @@ def test_create_plot_testdata(self, triplegs_with_modes): def test_ax_arg(self, triplegs_with_modes): """Test if ax is augmented if passed to function.""" _, axis = regular_figure() - modal_split = calculate_modal_split(triplegs_with_modes, freq="d", norm=True) + modal_split = calculate_modal_split(triplegs_with_modes, freq="D", norm=True) xlabel, ylabel, title = "xlabel", "ylabel", "title" dateformat = "%d" _, ax = plot_modal_split( @@ -132,7 +132,7 @@ def test_ax_arg(self, triplegs_with_modes): def test_skip_xticks(self, triplegs_with_modes): """Test if function set right ticks invisible.""" - modal_split = calculate_modal_split(triplegs_with_modes, freq="d", norm=True) + modal_split = calculate_modal_split(triplegs_with_modes, freq="D", norm=True) mod = 4 # remove all but the mod 4 ticks _, ax = regular_figure() _, ax = plot_modal_split(modal_split) diff --git a/trackintel/preprocessing/trips.py b/trackintel/preprocessing/trips.py index bf354399..8370451d 100644 --- a/trackintel/preprocessing/trips.py +++ b/trackintel/preprocessing/trips.py @@ -55,7 +55,7 @@ def generate_tours( trips, staypoints=None, max_dist=100, - max_time="1d", + max_time="1D", max_nr_gaps=0, print_progress=False, n_jobs=1, @@ -76,7 +76,7 @@ def generate_tours( This is parameter is only used if staypoints is `None`! Also, if `max_nr_gaps > 0`, a tour can contain larger spatial gaps (see Notes below for more detail) - max_time: str or pd.Timedelta, default "1d" (1 day) + max_time: str or pd.Timedelta, default "1D" (1 day) Maximum time that a tour is allowed to take max_nr_gaps: int, default 0