@@ -185,7 +185,7 @@ def dist_measure(traj, this, latitude, longitude, datetime):
185185def _datetime_filter (
186186 row : DataFrame ,
187187 move_df : DataFrame ,
188- minimum_distance : TimeDelta
188+ minimum_distance : timedelta
189189):
190190 """
191191 Returns all the points of the DataFrame which are in a temporal distance.
@@ -211,6 +211,22 @@ def _datetime_filter(
211211 dataframe with all the points of move_df which are in
212212 a temporal distance equal or smaller than the minimum
213213 distance parameter.
214+
215+ Examples
216+ --------
217+ >>> from pymove.query.query import _datetime_filter
218+ >>> point
219+ lat lon datetime id
220+ 0 16.4 -54.9 2014-10-11 18:00:00 1
221+ >>> move_df
222+ lat lon datetime id
223+ 0 33.1 -77.0 2012-05-19 00:00:00 2
224+ 1 32.8 -77.1 2012-05-19 06:00:00 3
225+ 2 32.5 -77.3 2012-05-19 12:00:00 4
226+ >>> _datetime_filter(point, move_df, timedelta(hours=21010))
227+ lat lon datetime id temporal_distance target_id target_lat target_lon target_datetime
228+ 0 32.5 -77.3 2012-05-19 12:00:00 4 875 days 06:00:00 1 16.4 -54.9 2014-10-11 18:00:00
229+
214230 """
215231 datetime = row ['datetime' ]
216232 move_df ['temporal_distance' ] = (move_df ['datetime' ] - datetime ).abs ()
@@ -256,6 +272,21 @@ def _meters_filter(
256272 dataframe with all the points of move_df which are in
257273 a spatial distance equal or smaller than the minimum
258274 distance parameter.
275+
276+ Examples
277+ --------
278+ >>> from pymove.query.query import _meters_filter
279+ >>> point
280+ lat lon datetime id
281+ 0 16.4 -54.9 2014-10-11 18:00:00 1
282+ >>> move_df
283+ lat lon datetime id
284+ 0 33.1 -77.0 2012-05-19 00:00:00 2
285+ 1 32.8 -77.1 2012-05-19 06:00:00 3
286+ 2 32.5 -77.3 2012-05-19 12:00:00 4
287+ >>> _meters_filter(firstpoint, move_df, 3190000)
288+ lat lon datetime id spatial_distance target_id target_lat target_lon target_datetime
289+ 0 32.5 -77.3 2012-05-19 12:00:00 4 3.182834e+06 1 16.4 -54.9 2014-10-11 18:00:00
259290 """
260291 lat = row ['lat' ]
261292 lon = row ['lon' ]
@@ -277,7 +308,7 @@ def query_all_points_by_range(
277308 traj1 : DataFrame ,
278309 move_df : DataFrame ,
279310 minimum_meters : Optional [float ] = 100 ,
280- minimum_time : Optional [TimeDelta ] = timedelta (minutes = 2 ),
311+ minimum_time : Optional [timedelta ] = timedelta (minutes = 2 ),
281312 datetime_label : Optional [Text ] = DATETIME ):
282313 """
283314 Queries closest point within a spatial range based on meters and a temporal range.
@@ -305,6 +336,23 @@ def query_all_points_by_range(
305336 dataframe with all the points of move_df which are in
306337 a spatial distance and temporal distance equal or smaller
307338 than the minimum distance parameters.
339+
340+ Examples
341+ --------
342+ >>> from pymove.query.query import query_all_points_by_range
343+ >>> traj_df
344+ lat lon datetime id
345+ 0 16.4 -54.9 2014-10-11 18:00:00 1
346+ 1 16.4 -55.9 2014-10-12 00:00:00 1
347+ 2 16.4 -56.9 2014-10-12 06:00:00 1
348+ >>> move_df
349+ lat lon datetime id
350+ 0 33.1 -77.0 2012-05-19 00:00:00 2
351+ 1 32.8 -77.1 2012-05-19 06:00:00 3
352+ 2 32.5 -77.3 2012-05-19 12:00:00 4
353+ >>> query_all_points_by_range(traj_df, move_df, minimum_meters=3190000, minimum_time=timedelta(hours=21010))
354+ lat lon datetime id spatial_distance target_id target_lat target_lon target_datetime temporal_distance
355+ 0 32.5 -77.3 2012-05-19 12:00:00 4 3.182834e+06 1 16.4 -54.9 2014-10-11 18:00:00 875 days 06:00:00
308356 """
309357 if minimum_time is None :
310358 minimum_time = timedelta (minutes = 2 )
0 commit comments