Cartopy
Imports
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import cartopy.io.shapereader as shpreader
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
Add coastline
ax.coastlines()
Quiver plot
land_cf = cfeature.NaturalEarthFeature('physical', 'land', '10m',
edgecolor='face',
facecolor='white')
bb = [100, 110, -5, 5] # W, E, S, N
fig, ax = plt.subplots(1, 1, figsize=(10, 8))
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_extent(bb, crs=ccrs.PlateCarree())
p = ax.contourf(
_ws10.longitude, _ws10.latitude, _ws10, transform=ccrs.PlateCarree()
)
q = ax.quiver(
_u10.longitude[::2],
_u10.latitude[::2],
_u10[::2, ::2],
_v10[::2, ::2],
transform=ccrs.PlateCarree(),
)
qk = plt.quiverkey(
q, 1.2, 0.97, 5, "velocity (5 m s$^{-1}$)", labelpos="E", coordinates="axes"
)
ax.coastlines(resolution="10m")
ax.add_feature(land_cf)
gl = ax.gridlines(draw_labels=True)
gl.xlines = False
gl.ylines = False
gl.top_labels = False
gl.right_labels = False
ax.scatter(
location[1],
location[0],
marker="o",
transform=ccrs.PlateCarree(),
color="red",
s=100,
zorder=3,
)
ax.text(
location[1] - 0.5,
location[0] + 0.3,
port_code,
horizontalalignment="left",
fontsize=25,
color="red",
transform=ccrs.PlateCarree(),
)
cbar = plt.colorbar(p)
cbar.set_label("10-m wind speed (m s$^{-1}$)")
plt.suptitle('a', fontsize=12)
plt.savefig("wind.png")