matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
780 stars 392 forks source link

Numerical precision issue in rotate_vector #417

Open rewquey opened 6 years ago

rewquey commented 6 years ago

Hi,

I ran into a numerical precision issue when using the rotate_vector function with 32bit floats as input data. In this case, the lat/lon increments used to determine the relative rotation between map projection and the lat/lon grid is chosen too small. The result was a cristalline structure in the plotted wind barbs which patches of barbs pointing in the exact same direction.

https://github.com/matplotlib/basemap/blob/decfa95124dab76499734145d03b002b9db27477/lib/mpl_toolkits/basemap/__init__.py#L3118

Converting the input to 64bit floats solves the issue for me, as did an increase of the increment to 1.0e-4.

Best regards, Clemens