b013b12999b16e11a5b965ae3ac0c9301c6888fa,osmnx/distance.py,,add_edge_lengths,#Any#Any#,105

Before Change


    // extract the edges" endpoint nodes" coordinates
    try:
        coords = (
            (u, v, k, G.nodes[u]["y"], G.nodes[u]["x"], G.nodes[v]["y"], G.nodes[v]["x"])
            for u, v, k in G.edges
        )
    except KeyError:  // pragma: no cover

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")
    try:
        coords = np.array([(y[u], x[u], y[v], x[v]) for u, v, k in uvk])
    except KeyError:  // pragma: no cover
        raise KeyError("some edges missing nodes, possibly due to input data clipping issue")

    // calculate great circle distances, fill nulls with zeros, then round
    dists = great_circle_vec(coords[:, 0], coords[:, 1], coords[:, 2], coords[:, 3])
    dists[np.isnan(dists)] = 0
    values = zip(uvk, dists.round(precision))
    nx.set_edge_attributes(G, values=dict(values), name="length")

    utils.log("Added length attributes to graph edges")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: gboeing/osmnx
Commit Name: b013b12999b16e11a5b965ae3ac0c9301c6888fa
Time: 2021-04-05
Author: boeing@usc.edu
File Name: osmnx/distance.py
Class Name:
Method Name: add_edge_lengths


Project Name: nipy/dipy
Commit Name: 990702bedcfd4bfd62b3c96f82a26fd8e1b6354a
Time: 2013-09-11
Author: Samuel.St-Jean@usherbrooke.ca
File Name: dipy/segment/mask.py
Class Name:
Method Name: segment_from_cfa


Project Name: nipy/dipy
Commit Name: a9fa0782dc1df24bd3e9c9ee9ddd3ab1dc9fd5e0
Time: 2013-09-11
Author: Samuel.St-Jean@usherbrooke.ca
File Name: dipy/segment/mask.py
Class Name:
Method Name: segment_from_cfa


Project Name: gboeing/osmnx
Commit Name: b013b12999b16e11a5b965ae3ac0c9301c6888fa
Time: 2021-04-05
Author: boeing@usc.edu
File Name: osmnx/distance.py
Class Name:
Method Name: add_edge_lengths