diff --git a/Inst_eddies/Analysis/plot_velocity.py b/Inst_eddies/Analysis/plot_velocity.py index b7085b178cd1376def932e0ff3694fa22d214a6e..9e0d5c4fb4eedb8d9029ecf920db8055b1d5cbc2 100755 --- a/Inst_eddies/Analysis/plot_velocity.py +++ b/Inst_eddies/Analysis/plot_velocity.py @@ -16,6 +16,8 @@ parser.add_argument("-w", "--window", help = "choose a limited plot window", "urcrnrlat")) parser.add_argument("--save", metavar = "format", help = "Save file to specified format") +parser.add_argument("-u", "--undefined", action = "store_true", + help = "plot points where velocity is not defined") args = parser.parse_args() with netCDF4.Dataset("h.nc") as f: @@ -52,15 +54,23 @@ projection = ccrs.PlateCarree() ax = plt.axes(projection = projection) with netCDF4.Dataset("uv.nc") as f: - quiver_return = ax.quiver(longitude[lon_mask], - latitude[lat_mask], - f["ugos"][0, lat_mask][:, lon_mask], - f["vgos"][0, lat_mask][:, lon_mask], - scale = args.scale, - scale_units = "width", - transform = src_crs) -plt.quiverkey(quiver_return, 0.9, 0.9, 1, r"1 m s$^{-1}$", - coordinates = "figure") + if args.undefined: + undef_velocity = np.logical_or(f["ugos"][0].mask, f["vgos"][0].mask) + lon_2d, lat_2d = np.meshgrid(longitude[lon_mask], + latitude[lat_mask]) + ax.plot(lon_2d[undef_velocity].reshape(-1), + lat_2d[undef_velocity].reshape(-1), transform = src_crs, + marker = "*", color = "violet", linestyle = "None") + else: + quiver_return = ax.quiver(longitude[lon_mask], + latitude[lat_mask], + f["ugos"][0, lat_mask][:, lon_mask], + f["vgos"][0, lat_mask][:, lon_mask], + scale = args.scale, + scale_units = "width", + transform = src_crs) + plt.quiverkey(quiver_return, 0.9, 0.9, 1, r"1 m s$^{-1}$", + coordinates = "figure") ax.gridlines(draw_labels = True) ax.coastlines()