3208fe37c6787ef0cd3f2f973a02ad63995042fa,osmnx/bearing.py,,add_edge_bearings,#Any#Any#,61

Before Change


    
    if projection.is_projected(G.graph["crs"]):  // pragma: no cover
        raise ValueError("graph must be unprojected to add edge bearings")
    for u, v, data in G.edges(keys=False, data=True):

        if u == v:
            // a self-loop has an undefined compass bearing
            data["bearing"] = np.nan

        else:
            // calculate bearing from edge"s origin to its destination
            origin_point = (G.nodes[u]["y"], G.nodes[u]["x"])
            destination_point = (G.nodes[v]["y"], G.nodes[v]["x"])
            bearing = get_bearing(origin_point, destination_point)
            data["bearing"] = round(bearing, precision)

    return G


def orientation_entropy(Gu, num_bins=36, min_length=0, weight=None):

After Change



    // extract edge IDs and corresponding coordinates from their nodes
    uvk = tuple(G.edges)
    x = G.nodes(data="x")
    y = G.nodes(data="y")
    coords = np.array([(y[u], x[u], y[v], x[v]) for u, v, k in uvk])

    // calculate bearings then set as edge attributes
    bearings = calculate_bearing(coords[:, 0], coords[:, 1], coords[:, 2], coords[:, 3])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: gboeing/osmnx
Commit Name: 3208fe37c6787ef0cd3f2f973a02ad63995042fa
Time: 2021-03-26
Author: boeing@usc.edu
File Name: osmnx/bearing.py
Class Name:
Method Name: add_edge_bearings


Project Name: gboeing/osmnx
Commit Name: 21872543a89273331c195b3c30c27dcb05c270d0
Time: 2020-11-19
Author: boeing@usc.edu
File Name: osmnx/utils_graph.py
Class Name:
Method Name: add_edge_lengths


Project Name: gboeing/osmnx
Commit Name: 14d74470233d0eb9149ae2bab72261be8d93eb92
Time: 2020-12-03
Author: boeing@usc.edu
File Name: osmnx/stats.py
Class Name:
Method Name: basic_stats