Skip to content

Commit

Permalink
Remove some dead code and make a minor fix in connectivity.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ptormene committed Jul 20, 2023
1 parent 7f7177e commit 12880c4
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions openquake/risklib/connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_exposure_df(dstore):

def classify_nodes(exposure_df):
# Classifying the nodes accodingly to compute performance indicator in
# global and local scale
# global and local level

# TAZ is the acronym of "Traffic Analysis Zone"
# user can write both as well
Expand Down Expand Up @@ -304,13 +304,7 @@ def cleanup_graph(G_original, event_damage_df, g_type):
(u, v) for (u, v, data) in G.edges(data=True)
if data['id'] in nonfunctional_edges_df.index.to_list()]

# nonfunctional_edge_tuples = list(
# zip(nonfunctional_edges_df.start_node,
# nonfunctional_edges_df.end_node)
# )

G.remove_edges_from(edges_to_remove)
# G.remove_edges_from(nonfunctional_edge_tuples)
G.remove_nodes_from(nonfunctional_nodes_df.index.to_list())

return G
Expand Down Expand Up @@ -561,7 +555,6 @@ def ELWCLPCLloss_TAZ(exposure_df, G_original, TAZ_nodes,
# For example, traffic analysis zone in transportation network. This
# calculates, efficiency loss (EL),
# weighted connectivity loss (WCL),partial connectivity loss(PCL).
# Simple connectivity loss (SCL) doesnt make any sense in this case.

# To store the information of the performance indicators at connectivity
# level
Expand Down Expand Up @@ -594,13 +587,6 @@ def ELWCLPCLloss_TAZ(exposure_df, G_original, TAZ_nodes,
count = count + 1
pcl_table.at[i, 'NS0'] = count

# Code below is not giving correct answer because the path is checked from
# a TAZ to every other TAZ
# but this will include itself as well. in the above code it is done by
# specifying (if i !=j)
# pcl_table['NS0'] = [sum(nx.has_path(G_original, j, i) for j in TAZ_nodes)
# for i in TAZ_nodes]

att = nx.get_edge_attributes(G_original, 'weight')
wcl_table = calc_weighted_connectivity_loss(
G_original, att, TAZ_nodes, TAZ_nodes, wcl_table, pcl_table, 'WS0',
Expand Down

0 comments on commit 12880c4

Please sign in to comment.