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

Generalize to no time dimension

Because there is no time dimension in
`Inst_eddies/Tests/Input/uv_outermost.nc`, for example.
parent 411734e3
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
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