Why does pcolor with masked arrays fill undesired quadrangles when projected in cartopy coordinates?

别等时光非礼了梦想. 提交于 2019-11-28 14:21:01

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()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!