|
|
@ -47,7 +47,7 @@ class DailyPreprocessor(): |
|
|
|
'direction':'str', 'condition':'str', 'inc_edge_id':'str', 'out_edge_id':'str', |
|
|
|
'end_unix':'int', 'inter_name':'str', 'inter_lat':'float', 'inter_lon':'float', |
|
|
|
'group_no':'int', 'main_phase_no':'int', 'phase_no':'int','ring_type':'str', |
|
|
|
'angle_code':'str'} |
|
|
|
'angle_code':'str', 'turn_type':'str'} |
|
|
|
for alph in ['A', 'B']: |
|
|
|
for j in range(1,9): |
|
|
|
# loading_dtype[f'angle_{alph}{j}'] = 'str' |
|
|
@ -64,6 +64,7 @@ class DailyPreprocessor(): |
|
|
|
self.u_condition= pd.read_csv(os.path.join(self.path_tables, 'u_condition.csv'), dtype=loading_dtype) |
|
|
|
self.coord = pd.read_csv(os.path.join(self.path_tables, 'child_coord.csv'), dtype=loading_dtype) |
|
|
|
self.nema = pd.read_csv(os.path.join(self.path_tables, 'nema.csv'), encoding='cp949', dtype=loading_dtype) |
|
|
|
self.turn_type = pd.read_csv(os.path.join(self.path_tables, 'turn_type.csv'), dtype=loading_dtype) |
|
|
|
|
|
|
|
# 교차로목록, 노드목록 정의 |
|
|
|
self.inter_nos = [int(x) for x in sorted(self.inter_info.inter_no.unique())] |
|
|
@ -402,6 +403,24 @@ class DailyPreprocessor(): |
|
|
|
self.match5['node_id'] = self.match5['inter_no'].map(self.inter2node) |
|
|
|
self.match5 = self.match5.sort_values(by=['inter_no','phase_no','ring_type']).reset_index(drop=True) |
|
|
|
|
|
|
|
# dictionary that maps node_id to io2turn |
|
|
|
n2io2turn = dict() |
|
|
|
node_id = 'i0' |
|
|
|
for node_id in self.parent_ids: |
|
|
|
turn = self.turn_type[self.turn_type.node_id==node_id] |
|
|
|
io = list(zip(turn.inc_edge_id, turn.out_edge_id)) |
|
|
|
# dictionary that maps (inc_edge_id, out_edge_id) to turn_type |
|
|
|
io2turn = dict(zip(io, turn.turn_type)) |
|
|
|
n2io2turn[node_id] = io2turn |
|
|
|
|
|
|
|
for i, row in self.match5.iterrows(): |
|
|
|
node_id = row.node_id |
|
|
|
inc_edge_id = row.inc_edge_id |
|
|
|
out_edge_id = row.out_edge_id |
|
|
|
if not (pd.isna(inc_edge_id) and pd.isna(out_edge_id)): |
|
|
|
turn_type = n2io2turn[node_id][(inc_edge_id, out_edge_id)] |
|
|
|
self.match5.at[i, 'turn_type'] = turn_type |
|
|
|
|
|
|
|
# 2-1-6 |
|
|
|
def make_match6(self): |
|
|
|
''' |
|
|
|