如何从R中的GPS轨迹数据中删除夜间时间点?

时间:2016-10-12 17:12:36

标签: r time gps conditional

我有一些跟踪看起来像下面的示例。我希望能够删除在06:00之前和18:00之后出现的行,即夜间值。

tracks <- read.table(text = "
             05/04/2015 16:04,  53.3854 ,   -6.29421
             05/04/2015 17:17,  53.38464,   -6.29412
             05/04/2015 17:33,  53.38457,   -6.29409
             05/04/2015 17:49,  53.38463,   -6.29418
             05/04/2015 19:20,  53.38458,   -6.29408
             05/04/2015 19:49,  53.38452,   -6.29394
             05/04/2015 20:19,  53.38464,   -6.29411
             05/04/2015 21:20,  53.38441,   -6.29421
             06/04/2015 07:13,  53.38459,   -6.29414
             06/04/2015 08:30,  53.3846,    -6.29414
             06/04/2015 16:56,  53.38458,   -6.29413
             06/04/2015 17:05,  53.38469,   -6.29416
             06/04/2015 17:13,  53.38464,   -6.29409
             06/04/2015 17:26,  53.38463,   -6.29412
             06/04/2015 17:39,  53.38463,   -6.29411
             06/04/2015 19:51,  53.38465,   -6.29411
             06/04/2015 21:29,  53.38451,   -6.29415"                 
, header = F, sep = ",")

2 个答案:

答案 0 :(得分:2)

您可以先从B^A^中提取小时和分钟,然后将其用于V1行的子集:

track

答案 1 :(得分:2)

import os, os.path, time import matplotlib.pyplot as mplot from PIL import Image import numpy as np files = os.listdir('./images') print files img = Image.open(os.path.join('./images', files[0]) image_stack = np.ndarray((len(files), img.shape[0], img.shape[1], 3), dtype=np.float32) for i, file in enumerate(files): img = Image.open('./images/'+file) img = np.float32(img) image_stack[i] = img avg_img = np.mean(image_stack, axis=0) avg_img = np.clip(avg_img, 0, 255) avg_img = avg_img.astype(np.uint8) mplot.imshow(avg_img) mplot.show() difference_stack = image_stack[1:] - image_stack[:-1] 解决方案:

lubdridate