Skip to content

Commit 49b9b4e

Browse files
author
Jeff Whitaker
committed
Merge pull request #111 from jswhit/master
fix for issue 110 (clipping in contourf and contour methods)
2 parents dbaaad4 + 20a9d20 commit 49b9b4e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Changelog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ since version 1.0.6
44
* fix warpimage with projection = 'hammer' (issue 100).
55
* fix tolerances for detecting jumps in meridians and parallels for
66
cyl and rotpole projections (issue 108).
7+
* fix clipping to map projection region done in contourf and contour methods
8+
so it doesn't assume x and y are increasing (issue 110).
79

810
version 1.0.6 (git tag v1.0.6rel)
911
--------------------------------

lib/mpl_toolkits/basemap/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,7 +2318,7 @@ def drawparallels(self,circles,color='k',linewidth=1.,zorder=None, \
23182318
xd = (x[1:]-x[0:-1])**2
23192319
yd = (y[1:]-y[0:-1])**2
23202320
dist = np.sqrt(xd+yd)
2321-
if self.projection not in ['cyl','rotpole']:
2321+
if self.projection not in ['cyl','rotpole']:
23222322
split = dist > self.rmajor/10.
23232323
else:
23242324
split = dist > 1.
@@ -2602,7 +2602,7 @@ def addlon(meridians,madd):
26022602
xd = (x[1:]-x[0:-1])**2
26032603
yd = (y[1:]-y[0:-1])**2
26042604
dist = np.sqrt(xd+yd)
2605-
if self.projection not in ['cyl','rotpole']:
2605+
if self.projection not in ['cyl','rotpole']:
26062606
split = dist > self.rmajor/10.
26072607
else:
26082608
split = dist > 1.
@@ -3552,8 +3552,8 @@ def contour(self,x,y,data,*args,**kwargs):
35523552
# mask for points more than one grid length outside projection limb.
35533553
xx = ma.masked_where(x > 1.e20, x)
35543554
yy = ma.masked_where(y > 1.e20, y)
3555-
epsx = (xx[:,1:]-xx[:,0:-1]).max()
3556-
epsy = (yy[1:,:]-yy[0:-1,:]).max()
3555+
epsx = np.abs(xx[:,1:]-xx[:,0:-1]).max()
3556+
epsy = np.abs(yy[1:,:]-yy[0:-1,:]).max()
35573557
xymask = \
35583558
np.logical_or(np.greater(x,self.xmax+epsx),np.greater(y,self.ymax+epsy))
35593559
xymask = xymask + \
@@ -3655,8 +3655,8 @@ def contourf(self,x,y,data,*args,**kwargs):
36553655
xx = ma.masked_where(x > 1.e20, x)
36563656
yy = ma.masked_where(y > 1.e20, y)
36573657
if self.projection != 'omerc':
3658-
epsx = (xx[:,1:]-xx[:,0:-1]).max()
3659-
epsy = (yy[1:,:]-yy[0:-1,:]).max()
3658+
epsx = np.abs(xx[:,1:]-xx[:,0:-1]).max()
3659+
epsy = np.abs(yy[1:,:]-yy[0:-1,:]).max()
36603660
else: # doesn't work for omerc (FIXME)
36613661
epsx = 0.; epsy = 0
36623662
xymask = \

0 commit comments

Comments
 (0)