I am a matlab user trying to use Python more for my computations recently. I am using xarray and would like to change my longitude array from 0 - 360 to -180 to 180 of a geophysical field. But when I do that:
df=xr.open_dataset(ecmwf_winds.nc)u10=df['u10']lon=df['longitude']lon = np.where(lon > 180, lon-360, lon)[X,Y]=np.meshgrid(lon,df.latitude)plt.contourf(X,Y,u10)the contourplot turns out to messy with gaps, which does not make sense. Can anyone please help me with it. I am not sure where I am doing wrong.