Closed bstabler closed 7 years ago
Here is a numpy/pandas example to determine link tonode number of legs and min volume leg. Determining freeway and centroid connector links is the same type of groupby and repeat operation once the links have a facility type as well.
import pandas as pd
import numpy as np
links = pd.DataFrame()
links["fn"] = [1,2,3,4,5]
links["tn"] = [6,6,6,7,8]
links["vol"] = [75,50,100,200,300]
#node legs
links["tn_legs"] = np.repeat(links.groupby("tn").count()["fn"].tolist(),links.groupby("tn").count()["fn"].tolist())
#min volume leg
links["tn_minvol"] = np.repeat(links.groupby("tn").min()["vol"].tolist(),links.groupby("tn").count()["fn"].tolist())
links["tn_minvolleg"] = links["vol"] == links["tn_minvol"]
@VinceBernardin said "I think the logic to determine which nodes are intersections would be pretty basic. If the node is connected to a freeway link, it is not an intersection, and if the node is a centroid it is not an intersection. I think that would probably be good enough. Then we would just need to determine the number of legs and the max and min volume approaches which takes a little work, requiring a join between the links and nodes but isn’t really too difficult."