Skip to content

Commit 7db6708

Browse files
committed
test that basemap should reproject C non conntiguous arrays and not fail
1 parent f70b00c commit 7db6708

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

lib/mpl_toolkits/basemap/test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,31 @@ def test_no_cyc2(self):
9696
assert (grid==gridout).all()
9797

9898

99+
class TestProjectCoords(TestCase):
100+
def get_data(self):
101+
lons, lats = np.arange(-180, 180, 20), np.arange(-90, 90, 10)
102+
lats, lons = np.meshgrid(lats, lons)
103+
lons, lats = lons.copy(order="F"), lats.copy(order="F")
104+
return lons, lats, Basemap(projection="sinu", lon_0=0)
105+
106+
107+
def test_convert(self):
108+
"""
109+
Should not fail on C non-contiguous arrays
110+
"""
111+
lons, lats, bmp = self.get_data()
112+
assert not lons.flags['C_CONTIGUOUS']
113+
114+
assert isinstance(lons, np.ndarray)
115+
116+
assert isinstance(bmp, Basemap)
117+
118+
xx1, yy1 = bmp(lons, lats)
119+
120+
121+
122+
123+
99124
def test():
100125
"""
101126
Run some tests.

0 commit comments

Comments
 (0)