diff --git a/Analysis/plot_snapshot.py b/Analysis/plot_snapshot.py index 2f68bc259d38f18b6d96ca275f01f960cd306abf..a59d46c78d798101cc0eafe095c27d45eb690561 100755 --- a/Analysis/plot_snapshot.py +++ b/Analysis/plot_snapshot.py @@ -28,18 +28,18 @@ import math import cartopy.crs as ccrs from os import path -def snapshot(directory, k = None, *, dashed = False, light = False, +def snapshot(shp_tr_dir, k = None, *, dashed = False, light = False, new_figure = False, src_crs = ccrs.PlateCarree(), projection = ccrs.PlateCarree(), window = None): """Plots extrema, outermost contours and max-speed contours. - directory: containing the three shapefiles. + shp_tr_dir: containing the three shapefiles. dashed: boolean.""" - reader_extr = shapefile.Reader(path.join(directory, "extremum")) - reader_outer = shapefile.Reader(path.join(directory, "outermost_contour")) + reader_extr = shapefile.Reader(path.join(shp_tr_dir, "extremum")) + reader_outer = shapefile.Reader(path.join(shp_tr_dir, "outermost_contour")) k1 = reader_extr.record(0).date_index - fname = path.join(directory, "ishape_last.txt") + fname = path.join(shp_tr_dir, "ishape_last.txt") try: ishape_last = np.loadtxt(fname, dtype = int) @@ -59,7 +59,8 @@ def snapshot(directory, k = None, *, dashed = False, light = False, ishape_first = ishape_last[k - k1 - 1] + 1 try: - reader_m_s = shapefile.Reader(path.join(directory, "max_speed_contour")) + reader_m_s = shapefile.Reader(path.join(shp_tr_dir, + "max_speed_contour")) except shapefile.ShapefileException: print("Shapefile max_speed_contour not found. " "Max-speed contours will not be plotted.") @@ -170,7 +171,7 @@ if __name__ == "__main__": action = "store_true") parser.add_argument("-d", "--dashed", action = "store_true", help = "dashed linestyle, useful for a second snapshot") - parser.add_argument("directory", help = "containing the three shapefiles") + parser.add_argument("shp_tr_dir", help = "containing the three shapefiles") args = parser.parse_args() if args.grid or args.velocity: @@ -216,7 +217,7 @@ if __name__ == "__main__": (grid_nml["nlat"] - 1) * 0.25, edgecolor="black", fill=False) ax.add_patch(rect) - snapshot(args.directory, args.k, dashed = args.dashed, + snapshot(args.shp_tr_dir, args.k, dashed = args.dashed, light = args.light, window = args.window) if args.velocity: