-
Notifications
You must be signed in to change notification settings - Fork 2
/
prof.py
27 lines (19 loc) · 799 Bytes
/
prof.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import numpy as np
import pandas as pd
import geo.geospoke as gs
import cProfile
def main():
columns_to_read = ['Timestamp', 'LineID', 'Direction', 'PatternID',
'JourneyID', 'Congestion', 'Lon', 'Lat',
'Delay', 'BlockID', 'VehicleID', 'StopID', 'AtStop']
df = pd.read_parquet("data/sir010113-310113.parquet",
columns=columns_to_read)
positions = df[['Lat', 'Lon']].to_numpy()
random_indexes = np.random.randint(low=0, high=positions.shape[0], size=100)
random_locations = positions[random_indexes]
h3_index = gs.H3Index(positions, resolution=10)
ind = None
for pt in random_locations:
ind = h3_index.query_radius(pt, r=100.0)
if __name__ == "__main__":
cProfile.run('main()')