Now that I played with 'rotpole' a bit... I also found that dralsmask fails with ZeroDivisionError. This is the full traceback:
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
<ipython-input-79-0ba416c748fa> in <module>()
----> 1 m.drawlsmask(resolution='c')
/home/razvan/.local/lib/python3.4/site-packages/mpl_toolkits/basemap/__init__.py in drawlsmask(self, land_color, ocean_color, lsmask, lsmask_lons, lsmask_lats, lakes, resolution, grid, **kwargs)
3934 # to a rectangular map projection grid.
3935 mask,x,y = self.transform_scalar(lsmask,lsmask_lons,-> 3936 lsmask_lats,nx,ny,returnxy=True,order=0,masked=255)
3937 lsmask_lats.dtype
3938 # for these projections, points outside the projection
/home/razvan/.local/lib/python3.4/site-packages/mpl_toolkits/basemap/__init__.py in transform_scalar(self, datin, lons, lats, nx, ny, returnxy, checkbounds, order, masked)
2961 raise ValueError('grid must be shifted so that lons are monotonically increasing and fit in range -180,+180 (see shiftgrid function)')
2962 if returnxy:
-> 2963 lonsout, latsout, x, y = self.makegrid(nx,ny,returnxy=True)
2964 else:
2965 lonsout, latsout = self.makegrid(nx,ny)
/home/razvan/.local/lib/python3.4/site-packages/mpl_toolkits/basemap/__init__.py in makegrid(self, nx, ny, returnxy)
1172 If ``returnxy = True``, the x,y values of the grid are returned also.
1173 """
-> 1174 return self.projtran.makegrid(nx,ny,returnxy=returnxy)
1175
1176 def _readboundarydata(self,name,as_polygons=False):
/home/razvan/.local/lib/python3.4/site-packages/mpl_toolkits/basemap/proj.py in makegrid(self, nx, ny, returnxy)
332 if returnxy=True, the x,y values of the grid are returned also.
333 """
--> 334 dx = (self.urcrnrx-self.llcrnrx)/(nx-1)
335 dy = (self.urcrnry-self.llcrnry)/(ny-1)
336 x = self.llcrnrx+dx*np.indices((ny,nx),np.float32)[1,:,:]
ZeroDivisionError: float division by zero
I figured it's because of this:
nx = int((self.xmax-self.xmin)/dx)+1; ny = int((self.ymax-self.ymin)/dx)+1
here self.xmax, self.xmin, ... are used incorrectly for 'rotpole' giving nx == ny == 1.
I tried changing line 3928:
if self.projection == 'cyl':
to
if self.projection == 'cyl' or self.projection == 'rotpole':
with the effect of producing a nice pattern :) but no land sea mask unfortunately... so the issue is a bit dipper, but I don't have time to investigate now...
I have the same problem for merc projection with any of the external sources of background such as bluemarble etc. Have you by any chance, found the general error?
Now that I played with
'rotpole'
a bit... I also found thatdralsmask
fails withZeroDivisionError
. This is the full traceback:I figured it's because of this:
here
self.xmax, self.xmin, ...
are used incorrectly for'rotpole'
givingnx == ny == 1
.I tried changing line 3928:
to
with the effect of producing a nice pattern :) but no land sea mask unfortunately... so the issue is a bit dipper, but I don't have time to investigate now...
Edit: on version 1.0.7