Skip to content

Commit 025d4f5

Browse files
committed
Update __init__.py
Starting line 3960 within method drawlsmask I propose changing the use of numpy.concatenate to use np.hstack to achieve the stacking of the lsmask longitude array with itself. This is due to changes in numpy concatenate in NumPy version 1.10.0+ in which an IndexError will be raised if the axis of concatenation does not exist. Numpy.hstack will function the same way and persists in newer versions of NumPy.
1 parent 89508c8 commit 025d4f5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/mpl_toolkits/basemap/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3960,10 +3960,14 @@ def drawlsmask(self,land_color="0.8",ocean_color="w",lsmask=None,
39603960
if cylproj:
39613961
# stack grids side-by-side (in longitiudinal direction), so
39623962
# any range of longitudes may be plotted on a world map.
3963+
# in versions of NumPy later than 1.10.0, concatenate will
3964+
# not stack these arrays as expected. If axis 1 is outside
3965+
# the dimensions of the array, concatenate will now raise
3966+
# an IndexError. Using hstack instead.
39633967
lsmask_lons = \
3964-
np.concatenate((lsmask_lons,lsmask_lons[1:]+360),1)
3968+
np.hstack((lsmask_lons,lsmask_lons[1:] + 360))
39653969
lsmask = \
3966-
np.concatenate((lsmask,lsmask[:,1:]),1)
3970+
np.hstack((lsmask,lsmask[:,1:]))
39673971
else:
39683972
if lakes: lsmask = np.where(lsmask==2,np.array(0,np.uint8),lsmask)
39693973

0 commit comments

Comments
 (0)