# ----------------------------------- # We can use `Grid` tools to interpolate SST on the altimetry grid lons, lats = meshgrid(g.x_c, g.y_c) shape = lats.shape # flat grid before interp lons, lats = lons.reshape(-1), lats.reshape(-1) # interp and reshape ti = t.interp('analysed_sst', lons, lats).reshape(shape).T ti = ma.masked_invalid(ti) # %% # and add it to `g` g.add_grid('sst',ti) # %% ax = start_axes("SST") m = g.display(ax, "sst", vmin=295, vmax=300) u,v = g.grid("ugosa").T,g.grid("vgosa").T ax.quiver(g.x_c, g.y_c, u, v, scale=10) update_axes(ax, m, unit='[°K]') # %% # Now, with eddy contours, and displaying SST anomaly # ! lazy patch since add_grid isn't currently completing g.variables_description g.variables_description['sst'] = t.variables_description[var_name_sst] g.copy("sst", "sst_high") g.bessel_high_filter('sst_high',200)
plt.colorbar(mappable, cax=ax.figure.add_axes([0.95, 0.05, 0.01, 0.9])) # %% # Load detection files and data to interp a = EddiesObservations.load_file(data.get_path("Anticyclonic_20160515.nc")) c = EddiesObservations.load_file(data.get_path("Cyclonic_20160515.nc")) aviso_map = RegularGridDataset( data.get_path("dt_med_allsat_phy_l4_20160515_20190101.nc"), "longitude", "latitude") aviso_map.add_uv("adt") # %% # Compute and store eke in cm²/s² aviso_map.add_grid("eke", (aviso_map.grid("u")**2 + aviso_map.grid("v")**2) * 0.5 * (100**2)) eke_kwargs = dict(vmin=1, vmax=1000, cmap="magma_r") ax = start_axes("EKE (cm²/s²)") m = aviso_map.display(ax, "eke", **eke_kwargs) a.display(ax, color="r", linewidth=0.5, label="Anticyclonic", ref=-10) c.display(ax, color="b", linewidth=0.5, label="Cyclonic", ref=-10) update_axes(ax, m) # %% # Get mean of eke in each effective contour ax = start_axes("EKE (cm²/s²)") a.display(ax, color="r", linewidth=0.5, label="Anticyclonic", ref=-10) c.display(ax, color="b", linewidth=0.5, label="Cyclonic", ref=-10)