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

后端 未结 1 1092
悲哀的现实
悲哀的现实 2020-12-12 02:34

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

相关标签:
1条回答
  • 2020-12-12 03:14

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

    0 讨论(0)
提交回复
热议问题