This is a followup question to preventing spurious horizontal lines for ungridded pcolor(mesh) data and why does pcolor with masked array still fill quadrangles
I have the impression that the code that is meant to be a workaround for wrapping coordinates around the limits of the projection which was introduced into cartopy according to this issue is not actually working well/at all(?). This code tries to do a similar thing of masking the different regions, but somehow does not produce the desired result.
Now, on the other hand the issue of facets beeing wrapped around the globe is anyways only present in pcolormesh
, not in pcolor
; probably due to the different meshing used in both cases.
Therefore when using pcolor
the plot looks as desired.
import cartopy.crs as ccrs
proj = ccrs.Mollweide(central_longitude=0)
trans = proj.transform_points(ccrs.Geodetic(), lons, lats)
plt.figure()
ax = plt.axes(projection=proj)
ax.pcolor(ma.masked_where(trans[:, :, 0]>0, trans[:, :, 0]), ma.masked_where(trans[:, :, 0]>0, trans[:, :, 1]), ma.masked_where(trans[:, :, 0]>0, bts), transform=proj)
ax.pcolor(ma.masked_where(trans[:, :, 0]<0, trans[:, :, 0]), ma.masked_where(trans[:, :, 0]<0, trans[:, :, 1]), ma.masked_where(trans[:, :, 0]<0, bts), transform=proj)
plt.show()