I want to have plot by matplotlib to show the temperature change along time in lat. I got this: WARNING: x coordinate not montonically increasing – contour plot may not be what you expect. If it looks odd, you can either adjust the map projection region to be consistent with your data, or (if your data is on a global lat/lon grid) use the shiftgrid function to adjust the data to be consistent with the map projection region (see examples/contour_demo.py)
d=Dataset(‘sst.mon.ltm.1991-2020.nc’)
sst=d.variables[‘sst’]
time=d.variables[‘time’]
lon=d.variables[‘lon’][:]
lat=d.variables[‘lat’][:]
mean_sst=np.mean(sst,axis=(2),keepdims=False)
ax=fig-subplots(121)
fig=plt.figure(figsize=(5,5))
ax=fig.add_subplot(211)
m = Basemap(projection=’merc’, llcrnrlon= 0,urcrnrlon=180,llcrnrlat=-80,urcrnrlat=0)
lat_grid,time_grid=np.meshgrid(lat,time)
cx=m.contourf(lat_grid,time_grid,mean_sst,cmap=’seismic’)
plt.show()
faeze bh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.