Open tomerburg opened 4 years ago
Regridding is done in the projection frame and on either side of the pole you have a vector going opposite directions, so the vector will be interpolated to 0 at the pole, hence your decreasing values.
I think the intent you probably expected is for the interpolation to be done in the source frame, and I think this is what I would expect as well. I've put up a draft PR https://github.com/SciTools/cartopy/pull/1636 with that thought in mind. You should be able to adapt that methodology of transforming back and forth to do the interpolation yourself in the meantime.
I'll also add that this seems to depend on what you choose for your latitude range on input. I adjusted to start your lats at 37, thus giving me the highest lat point at 89 rather than 87, and the artifact went away.
I'm generating numerical model output plots (e.g., GFS, ERA-5) for polar projections using the Nearside Perspective projection. When plotting wind barbs, the barb magnitudes are correct if plotted normally, such as:
ax.barbs(x, y, u, v, transform=ccrs.PlateCarree())
Once I add the
regrid_shape
argument, the barbs are inaccurate near the North Pole, with the magnitude decreasing towards zero within a few degrees latitude of the pole. I'm not entirely sure if this is user error or a bug inregrid_shape
, but I am struggling to find any error on my end so I suspect it may be a bug.I created a sample code & data to reproduce this, by assuming a constant global u=50 m/s and v=0 m/s, meaning the wind magnitude should be 50 m/s throughout the grid. Using
regrid_shape
, most of the barbs correctly show a 50 m/s flag, but right near the pole the barbs gradually decrease towards 0 m/s. Ifregrid_shape
is omitted fromax.barbs()
, then all barbs (including those near the pole) show a 50 m/s flag.This is produced using Cartopy 0.17.0, in multiple versions of python (anywhere from 3.6.7 to 3.8.0) and on both Windows & Linux operating systems. Any help to identify if this is a user error or a bug, and if the latter then if it can be fixed, would be greatly appreciated.