Skip to content
Snippets Groups Projects
Commit 41c8c5cc authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Do not crash on missing SHPC directory

Do not crash on missing SHPC directory for interpolated
eddies. Motivation: when we call `read_eddy_graph` from
`plot_traj.py`, we just try to read data on interpolated eddies.
parent 4ff019ac
No related branches found
No related tags found
No related merge requests found
......@@ -33,14 +33,18 @@ def read_eddy_graph(edgelist, shp_tr_dir = None, read_interp = True):
G.add_edge((k1, i1), (k2, i2), weight = weight)
if read_interp:
# Read and set attributes of interpolated eddies:
# Try to read and set attributes of interpolated eddies:
# Assuming that the directory containing the interpolated
# eddies is in the same location as edgelist:
extremum = path.join(path.dirname(edgelist), "SHP_triplet",
"extremum")
set_attribute(G, extremum)
if os.access(extremum, os.R_OK):
set_attribute(G, extremum)
else:
print("Trying to read data on interpolated eddies but ",
f"{extremum} is not readable")
if shp_tr_dir is not None:
# Read and set attributes of Visible eddies:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment