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

Add option ishape

parent e574100d
No related branches found
No related tags found
No related merge requests found
......@@ -15,25 +15,31 @@ import util_eddies
parser = argparse.ArgumentParser()
parser.add_argument("directory", help = "containing the three shapefiles")
parser.add_argument("-i", "--ishape", type = int)
args = parser.parse_args()
reply = input("days_1950, eddy_index = ? ").split(",")
days_1950 = int(reply[0])
eddy_index = int(reply[1])
handler = util_eddies.open_shpc(args.directory)
# Find ishape:
if handler["ishape_last"] is None:
print("ishape_last not found. Iterating through shapes...")
for ishape, rec in enumerate(handler["readers"]["extremum"].iterRecords()):
if rec["days_1950"] == days_1950 and rec["eddy_index"] == eddy_index:
break
else:
sys.exit("Eddy with this date and index not found")
if args.ishape:
ishape = args.ishape
else:
ishape = util_eddies.comp_ishape(handler, days_1950, eddy_index)
reply = input("days_1950, eddy_index = ? ").split(",")
days_1950 = int(reply[0])
eddy_index = int(reply[1])
# Find ishape:
if handler["ishape_last"] is None:
print("ishape_last not found. Iterating through shapes...")
for ishape, rec \
in enumerate(handler["readers"]["extremum"].iterRecords()):
if rec["days_1950"] == days_1950 \
and rec["eddy_index"] == eddy_index:
break
else:
sys.exit("Eddy with this date and index not found")
else:
ishape = util_eddies.comp_ishape(handler, days_1950, eddy_index)
for layer in ["extremum", "outermost_contour", "max_speed_contour", "centroid"]:
if layer in handler["readers"]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment