Skip to content

Commit c09f1b9

Browse files
committed
Scale threshold to Globe radius in more projections.
Fixes #1572, testing the example in the other projections as well.
1 parent f54d2f3 commit c09f1b9

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

lib/cartopy/crs.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,9 +1638,15 @@ def __init__(self, central_longitude=0, false_easting=None,
16381638
false_northing=false_northing,
16391639
globe=globe)
16401640

1641+
# TODO: Let the globe return the semimajor axis always.
1642+
a = np.float(self.globe.semimajor_axis or WGS84_SEMIMAJOR_AXIS)
1643+
b = np.float(self.globe.semiminor_axis or a)
1644+
1645+
self._threshold = min(a, b) / 63.78137 # About 1e5 for defaults.
1646+
16411647
@property
16421648
def threshold(self):
1643-
return 1e5
1649+
return self._threshold
16441650

16451651

16461652
class EckertI(_Eckert):
@@ -1810,9 +1816,15 @@ def __init__(self, central_longitude=0, globe=None,
18101816
false_northing=false_northing,
18111817
globe=globe)
18121818

1819+
# TODO: Let the globe return the semimajor axis always.
1820+
a = np.float(self.globe.semimajor_axis or WGS84_SEMIMAJOR_AXIS)
1821+
b = np.float(self.globe.semiminor_axis or a)
1822+
1823+
self._threshold = min(a, b) / 63.78137 # About 1e5 for defaults.
1824+
18131825
@property
18141826
def threshold(self):
1815-
return 1e5
1827+
return self._threshold
18161828

18171829

18181830
class Robinson(_WarpedRectangularProjection):
@@ -2306,14 +2318,15 @@ def __init__(self, central_longitude=0.0, central_latitude=0.0,
23062318
maxs = np.max(coords, axis=1)
23072319
self._x_limits = mins[0], maxs[0]
23082320
self._y_limits = mins[1], maxs[1]
2321+
self._threshold = min(a, b) / 63.78137 # About 1e5 for defaults.
23092322

23102323
@property
23112324
def boundary(self):
23122325
return self._boundary
23132326

23142327
@property
23152328
def threshold(self):
2316-
return 1e5
2329+
return self._threshold
23172330

23182331
@property
23192332
def x_limits(self):

0 commit comments

Comments
 (0)