diff --git a/Inst_eddies/Analysis/plot_velocity.py b/Inst_eddies/Analysis/plot_velocity.py index c5a71d1d7f1ca271c91523f6624bca6161b20af7..c6a39e60454f74a43fe6cd10a77622e4961d47db 100755 --- a/Inst_eddies/Analysis/plot_velocity.py +++ b/Inst_eddies/Analysis/plot_velocity.py @@ -55,8 +55,15 @@ projection = ccrs.PlateCarree() ax = plt.axes(projection = projection) with netCDF4.Dataset(args.input_file) as f: + if "time" in f["ugos"].dimensions: + ugos = f["ugos"][0] + vgos = f["vgos"][0] + else: + ugos = f["ugos"][:] + vgos = f["vgos"][:] + if args.undefined: - undef_velocity = np.logical_or(f["ugos"][0].mask, f["vgos"][0].mask) + undef_velocity = np.logical_or(ugos.mask, vgos.mask) lon_2d, lat_2d = np.meshgrid(longitude[lon_mask], latitude[lat_mask]) ax.plot(lon_2d[undef_velocity].reshape(-1), @@ -65,8 +72,8 @@ with netCDF4.Dataset(args.input_file) as f: 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], + ugos[lat_mask][:, lon_mask], + vgos[lat_mask][:, lon_mask], scale = args.scale, scale_units = "width", transform = src_crs)