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

Remove function `open_shpc`

Superceded by class `SHPC_class`.
parent f6798d1e
No related branches found
No related tags found
No related merge requests found
......@@ -163,32 +163,3 @@ def in_window(point, window):
# (in [llcrnrlon, llcrnrlon + 360[)
return longit <= urcrnrlon and llcrnrlat <= point[1] <= urcrnrlat
def open_shpc(shpc_dir, orientation, i_slice = 0):
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",
"centroid"]:
my_shapefile = path.join(shpc_dir, f"Slice_{i_slice}", orientation,
layer)
try:
handler["readers"][layer] = shapefile.Reader(my_shapefile)
except shapefile.ShapefileException:
print(f"{my_shapefile}.shp not found.")
handler["d_init"] = handler["readers"]["extremum"].record(0).date
fname = path.join(shpc_dir, f"Slice_{i_slice}", orientation,
"ishape_last.txt")
try:
handler["ishape_last"] = np.loadtxt(fname, dtype = int, ndmin = 1)
except OSError:
print("Could not read", fname)
handler["ishape_last"] = None
handler["cyclones"] = orientation == "Cyclones"
return handler
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment