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

Replace arguments `d_min` and `d_max` by `-d`

This is more comfortable. Furthermore, it is going to be necessary
when we extend the script to several input SHPC.
parent b22ea428
No related branches found
No related tags found
No related merge requests found
...@@ -65,8 +65,8 @@ if __name__ == "__main__": ...@@ -65,8 +65,8 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("shpc_dir", help = "directory containing the " parser.add_argument("shpc_dir", help = "directory containing the "
"collection of shapefiles") "collection of shapefiles")
parser.add_argument("d_min", type = int) parser.add_argument("-d", "--dates", type = int, nargs = 2,
parser.add_argument("d_max", type = int) metavar = ("d_min", "d_max"))
parser.add_argument("-l", "--light", help = "lighter plot", parser.add_argument("-l", "--light", help = "lighter plot",
action = "store_true") action = "store_true")
parser.add_argument("-w", "--window", help = "choose a limited plot window", parser.add_argument("-w", "--window", help = "choose a limited plot window",
...@@ -79,15 +79,22 @@ if __name__ == "__main__": ...@@ -79,15 +79,22 @@ if __name__ == "__main__":
readers, d_init, ishape_last = util_eddies.open_shpc(args.shpc_dir) readers, d_init, ishape_last = util_eddies.open_shpc(args.shpc_dir)
if ishape_last is None: sys.exit("Missing ishape_last.txt") if ishape_last is None: sys.exit("Missing ishape_last.txt")
if not d_init <= args.d_min < args.d_max <= d_init + len(ishape_last) - 1:
sys.exit("Bad dates specified")
if args.dates:
d_min = args.dates[0]
d_max = args.dates[1]
if not d_init <= d_min < d_max <= d_init + len(ishape_last) - 1:
sys.exit("Bad dates specified")
else:
d_min = d_init
d_max = d_init + len(ishape_last) - 1
fig = plt.figure() fig = plt.figure()
projection = ccrs.PlateCarree() projection = ccrs.PlateCarree()
ax = plt.axes(projection = projection) ax = plt.axes(projection = projection)
ani = anim_eddies(fig, ax, d_init, ishape_last, readers, ani = anim_eddies(fig, ax, d_init, ishape_last, readers,
window = args.window, d_min = args.d_min, window = args.window, d_min = d_min,
d_max = args.d_max, light = args.light) d_max = d_max, light = args.light)
ani.save("eddy_contours.gif", writer = "imagemagick") ani.save("eddy_contours.gif", writer = "imagemagick")
pygifsicle.gifsicle("eddy_contours.gif", options = ["--no-loopcount"]) pygifsicle.gifsicle("eddy_contours.gif", options = ["--no-loopcount"])
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
"command": "command":
[ [
"$src_dir/Inst_eddies/Analysis/anim_eddy_contours.py", "$src_dir/Inst_eddies/Analysis/anim_eddy_contours.py",
"$src_dir/Overlap/Tests/Input/Region_6_SHPC", "20454", "$src_dir/Overlap/Tests/Input/Region_6_SHPC", "--light"
"20455", "--light"
] ]
}, },
{ {
......
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