Browse Source

changed the expression 'from' and 'to' to 'inc' and 'out'. But some error occurs.'

master
김선중 1 year ago
parent
commit
d5b0c88210
2 changed files with 9 additions and 10 deletions
  1. +1
    -1
      Data/tables/uturn.csv
  2. +8
    -9
      Scripts/preprocess_daily.py

+ 1
- 1
Data/tables/uturn.csv View File

@ -1,4 +1,4 @@
parent_id,child_id,adj_from_edge_id,adj_to_edge_id,from_edge_id,to_edge_id
parent_id,child_id,adj_inc_edge_id,adj_out_edge_id,inc_edge_id,out_edge_id
i0,u00,-571500487_01,571500487_01,571500487_02,571500487_01.32
i2,u20,571542811_02,571542811_01,571542810_01.51,571542810_02
i3,u30,571556450_02,571556450_01,571556452_01,571556452_02

+ 8
- 9
Scripts/preprocess_daily.py View File

@ -59,7 +59,6 @@ class DailyPreprocessor():
self.angle = pd.read_csv(os.path.join(self.path_tables, 'angle.csv'), dtype=loading_dtype)
self.plan = pd.read_csv(os.path.join(self.path_tables, 'plan.csv'), dtype=loading_dtype)
self.inter_node = pd.read_csv(os.path.join(self.path_tables, 'inter_node.csv'), dtype=loading_dtype)
self.uturn = pd.read_csv(os.path.join(self.path_tables, 'child_uturn.csv'), dtype=loading_dtype)
self.u_turn = pd.read_csv(os.path.join(self.path_tables, 'uturn.csv'), dtype=loading_dtype)
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)
@ -191,7 +190,7 @@ class DailyPreprocessor():
def restore_objects(self):
self.parent_ids = sorted(self.inter_node[self.inter_node.inter_type=='parent'].node_id.unique())
self.child_ids = sorted(self.inter_node[self.inter_node.inter_type=='child'].node_id.unique())
self.uturn_ids = sorted(self.uturn.child_id.unique())
self.u_turn_ids = sorted(self.u_turn.child_id.unique())
self.coord_ids = sorted(self.coord.child_id.unique())
# node2inter : node_id to inter_no
@ -217,7 +216,7 @@ class DailyPreprocessor():
ids = {'node_ids' : self.node_ids,
'parent_ids': self.parent_ids,
'child_ids' : self.child_ids,
'uturn_ids' : self.uturn_ids,
'uturn_ids' : self.u_turn_ids,
'coord_ids' : self.coord_ids,
'inter_nos' : self.inter_nos}
with open(os.path.join(self.path_intermediates, 'ids.json'), 'w') as file:
@ -460,10 +459,10 @@ class DailyPreprocessor():
parent_id = row.parent_id
child_id = row.child_id
condition = row.condition
inc_edge_id = row.from_edge_id
out_edge_id = row.to_edge_id
adj_inc_edge_id = row.adj_from_edge_id
adj_out_edge_id = row.adj_to_edge_id
inc_edge_id = row.inc_edge_id
out_edge_id = row.out_edge_id
adj_inc_edge_id = row.adj_inc_edge_id
adj_out_edge_id = row.adj_out_edge_id
# match5에서 부모노드id에 해당하는 행들을 가져옴 (cmatch)
cmatch = self.match5.copy()[self.match5.node_id==parent_id] # match dataframe for a child node
@ -707,7 +706,7 @@ class DailyPreprocessor():
if index >= 0:
self.node2init[node_id][index] = 'r'
# 유턴교차로
for _, row in self.uturn.iterrows():
for _, row in self.u_turn.iterrows():
node_id = row.child_id
inc_edge_id = row.inc_edge_id
out_edge = row.out_edge_id
@ -785,7 +784,7 @@ class DailyPreprocessor():
print('2-3. 직진 및 좌회전(G)을 배정했습니다.')
uid2uindex = {}
for uid in self.uturn_ids:
for uid in self.u_turn_ids:
states = self.match6[self.match6.node_id==uid].state.unique()
for state in states:
if 'G' in state:

Loading…
Cancel
Save