<div dir="ltr"><div>I am wondering if python does not recognise that wind barbs are directed to the right in the southern hemisphere and to the left in the northern hemisphere. This is the same problem in ncl which seems to be carried over to python.</div><div>If it is possible to change this I would appreciate assistance. I reproduce below a script to plot 850 winds, if it is possible to indicate where to make any change.</div><div><br></div><div>from netCDF4 import Dataset <br>import cartopy.io.shapereader as shpreader<br>import numpy as np<br>import matplotlib.pyplot as plt<br>from mpl_toolkits.axes_grid1 import make_axes_locatable<br>from <a href="http://matplotlib.cm">matplotlib.cm</a> import get_cmap<br>import cartopy.crs as crs<br>from cartopy.feature import NaturalEarthFeature<br><br>from wrf import (getvar, interplevel, to_np, latlon_coords, get_cartopy, <br> cartopy_xlim, cartopy_ylim)<br><br>#Open the NetCDF file<br>#--------------------<br>ncfile = Dataset("wrfout_d01_2021-08-19_06:00:00")<br><br>#Extract the pressure, geopotential height, and wind variables<br>#-------------------------------------------------------------<br>p = getvar(ncfile, "pressure")<br>z = getvar(ncfile, "z", units="dm")<br>ua = getvar(ncfile, "ua", units="kt")<br>va = getvar(ncfile, "va", units="kt")<br>wspd = getvar(ncfile, "wspd_wdir", units="kts")[0,:]<br><br>#Interpolate geopotential height, u, and v winds to 850 hPa<br>#-----------------------------------------------------------<br>ht_850 = interplevel(z, p, 850)<br>u_850 = interplevel(ua, p, 850)<br>v_850 = interplevel(va, p, 850)<br>wspd_850 = interplevel(wspd, p, 850)<br><br>#Get the lat/lon coordinates<br>#---------------------------<br>lats, lons = latlon_coords(ht_850)<br><br>#Get the map projection information<br>#----------------------------------<br>cart_proj = get_cartopy(ht_850)<br><br>#Create the figure<br>#-----------------<br>fig = plt.figure(figsize=(12,9))<br>ax = plt.axes(projection=cart_proj)<br><br>#Download and add the states and coastlines<br>#-----------------------------------------<br>#states = NaturalEarthFeature(category="cultural", scale="50m", <br># facecolor="none",<br># name="admin_1_states_provinces_shp")<br>#ax.add_feature(states, linewidth=0.5, edgecolor="black")<br>#ax.coastlines('50m', linewidth=0.8)<br><br>fname = './ZMB_ADM1.shp'<br>adm1_shapes = list(shpreader.Reader(fname).geometries())<br><br>#Add the 850 hPa geopotential height contours<br>#--------------------------------------------<br>levels = np.arange(150., 155., 1.)<br>contours = plt.contour(to_np(lons), to_np(lats), to_np(ht_850), <br>   levels=levels, colors="blue", <br>   transform=crs.PlateCarree())<br>plt.clabel(contours, inline=1, fontsize=10, fmt="%i")<br><br>#Add the wind speed contours<br>#---------------------------<br>levels = [0, 5, 10, 15, 20, 25, 30]<br>wspd_contours = plt.contourf(to_np(lons), to_np(lats), to_np(wspd_850), <br> levels=levels,<br> cmap=get_cmap("rainbow"), <br> transform=crs.PlateCarree())<br>plt.colorbar(wspd_contours, ax=ax, orientation="vertical", pad=.05)<br><br>#divider = make_axes_locatable(ax)<br>#ax_cb = divider.new_horizontal(size="5%", pad=0.1, axes_class=plt.Axes)<br><br>#plt.add_axes(ax_cb)<br>#plt.colorbar(wspd_contours, cax=ax_cb, pad=.05)<br><br>#Add the 850 hPa wind barbs, only plotting every 5th data point.<br>#-----------------------------------------------------------------<br>plt.barbs(to_np(lons[::10,::10]), to_np(lats[::10,::10]), <br>  to_np(u_850[::10, ::10]), to_np(v_850[::10, ::10]), <br>  transform=crs.PlateCarree(), length=6)<br><br><br>ax.add_geometries(adm1_shapes, crs.PlateCarree(),<br>                  edgecolor='black', facecolor='gray', alpha=0.5)<br><br>#Set the map bounds<br>#------------------<br>ax.set_xlim(cartopy_xlim(ht_850))<br>ax.set_ylim(cartopy_ylim(ht_850))<br><br>ax.gridlines()<br><br>plt.title("850 MB Height (dm), Wind Speed (kt), Barbs (kt)")<br><br>plt.show()<br></div></div>