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

Stop `open_shpc` if the directory does not exist

The function would crash anyway because "extremum" is not in
`handler["readers"]` but the error messages would be less clear.
parent 2b036a1e
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import shapefile
import math
from os import path
import numpy as np
import sys
def comp_ishape(handler, date, eddy_index):
k = date - handler["d_init"]
......@@ -21,6 +22,9 @@ def in_window(point, window):
return longit <= urcrnrlon and llcrnrlat <= point[1] <= urcrnrlat
def open_shpc(shpc_dir):
if not path.isdir(shpc_dir):
sys.exit(f"open_shpc: {shpc_dir} is not an existing directory")
handler = {"readers": {}}
for layer in ["extremum", "outermost_contour", "max_speed_contour",
......
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