Reputation: 19563
I have an xarray DataArray that goes from 0 to 360 longitude, and -90 to 90 latitude. if I plot it with m.imshow
, without specifying the latitudes, the data is offset from the map by 180 degrees:
m = Basemap()
m.drawcoastlines()
m.imshow(mean['Qle'].T)
or I can do it with m.pcolormesh(x=mean.lon, y=mean.lat, data=mean['Qle'].T)
, and I get this:
What is the best way to wrap the data? I still want the default map layout, with Africa in the middle.
Upvotes: 2
Views: 1126
Reputation: 19563
Ah, found it. pcolormesh
has a latlon
argument that automatically shifts the data:
m.pcolormesh(x=mean.lon, y=mean.lat, data=mean['Qle'].T, latlon=True)
Upvotes: 3