Browse Source

rename : directions -> dires, direction -> dire)

master
김선중 1 year ago
parent
commit
6d6c49c9a8
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      Scripts/preprocess_daily.py

+ 10
- 10
Scripts/preprocess_daily.py View File

@ -400,14 +400,14 @@ class DailyPreprocessor():
parent_no = self.inter_node[self.inter_node.node_id==child_id].inter_no.iloc[0] parent_no = self.inter_node[self.inter_node.node_id==child_id].inter_no.iloc[0]
sub_inter_node = self.inter_node[self.inter_node.inter_no==parent_no] sub_inter_node = self.inter_node[self.inter_node.inter_no==parent_no]
ch2pa[child_id] = sub_inter_node[sub_inter_node.inter_type=='parent'].iloc[0].node_id ch2pa[child_id] = sub_inter_node[sub_inter_node.inter_type=='parent'].iloc[0].node_id
self.directions = ['', '북동', '', '남동', '', '남서', '', '북서'] # 정북기준 시계방향으로 8방향
self.dires = ['', '북동', '', '남동', '', '남서', '', '북서'] # 정북기준 시계방향으로 8방향
# 각 uturn node에 대하여 (inc_edge_id, out_edge_id) 부여 # 각 uturn node에 대하여 (inc_edge_id, out_edge_id) 부여
cmatches = [] cmatches = []
for _, row in self.uturn.iterrows(): for _, row in self.uturn.iterrows():
child_id = row.child_id child_id = row.child_id
parent_id = row.parent_id parent_id = row.parent_id
direction = row.direction
dire = row.direction
condition = row.condition condition = row.condition
inc_edge_id = row.inc_edge inc_edge_id = row.inc_edge
out_edge_id = row.out_edge out_edge_id = row.out_edge
@ -419,18 +419,18 @@ class DailyPreprocessor():
cmatch[['inc_edge', 'out_edge']] = np.nan cmatch[['inc_edge', 'out_edge']] = np.nan
# 보행신호시/좌회전시 진입/진출방향 # 보행신호시/좌회전시 진입/진출방향
ind = self.directions.index(direction)
inc_dire_pedes = self.directions[(ind + 2) % len(self.directions)]
out_dire_pedes = self.directions[(ind - 2) % len(self.directions)]
inc_dire_right = direction
out_dire_right = self.directions[(ind + 2) % len(self.directions)]
ind = self.dires.index(dire)
inc_dire_pedes = self.dires[(ind + 2) % len(self.dires)]
out_dire_pedes = self.dires[(ind - 2) % len(self.dires)]
inc_dire_right = dire
out_dire_right = self.dires[(ind + 2) % len(self.dires)]
# 보행신호시/좌회전시 조건 # 보행신호시/좌회전시 조건
pedes_exists = (cmatch.inc_dire==inc_dire_pedes) & (cmatch.out_dire==out_dire_pedes) pedes_exists = (cmatch.inc_dire==inc_dire_pedes) & (cmatch.out_dire==out_dire_pedes)
right_exists = (cmatch.inc_dire==inc_dire_right) & (cmatch.out_dire==out_dire_right) right_exists = (cmatch.inc_dire==inc_dire_right) & (cmatch.out_dire==out_dire_right)
# 보행신호시/좌회전시 진입/진출 엣지id 배정 # 보행신호시/좌회전시 진입/진출 엣지id 배정
ind = self.directions.index(direction)
ind = self.dires.index(dire)
if condition == "보행신호시": if condition == "보행신호시":
cmatch.loc[pedes_exists, ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id] cmatch.loc[pedes_exists, ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id]
elif condition == "좌회전시": elif condition == "좌회전시":
@ -452,10 +452,10 @@ class DailyPreprocessor():
cmatch.loc[pedes_exists, ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id] cmatch.loc[pedes_exists, ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id]
# 보행신호이동류(17) 발생시 # 보행신호이동류(17) 발생시
elif crosswalk_on.any(): elif crosswalk_on.any():
cmatch.loc[crosswalk_on & (cmatch.out_dire!=direction), ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id]
cmatch.loc[crosswalk_on & (cmatch.out_dire!=dire), ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id]
# 신호없음이동류(18) 발생시 # 신호없음이동류(18) 발생시
elif all_redsigns.any(): elif all_redsigns.any():
cmatch.loc[all_redsigns & (cmatch.out_dire!=direction), ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id]
cmatch.loc[all_redsigns & (cmatch.out_dire!=dire), ['inc_edge', 'out_edge']] = [inc_edge_id, out_edge_id]
cmatches.append(cmatch) cmatches.append(cmatch)
# 각 연등교차로(coordination node)에 대하여 (inc_edge_id, out_edge_id) 부여 # 각 연등교차로(coordination node)에 대하여 (inc_edge_id, out_edge_id) 부여

Loading…
Cancel
Save