Skip to content

Commit 5b4b718

Browse files
committed
merge from master to avoid conflicts
2 parents c8ded4e + 348e7be commit 5b4b718

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

lib/mpl_toolkits/basemap/pyproj.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@ def _copytobuffer(x):
521521
# (this makes a copy - which is crucial
522522
# since buffer is modified in place)
523523
x.dtype.char
524-
inx = x.astype('d')
524+
inx = x.astype('d', order="C")
525+
525526
# inx,isfloat,islist,istuple
526527
return inx,False,False,False
527528
except:

lib/mpl_toolkits/basemap/test.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,40 @@ def test_less_than_n_by_3_points_should_work(self):
149149
assert_almost_equal(lonsout_expected, lonsout)
150150

151151

152+
class TestProjectCoords(TestCase):
153+
def get_data(self):
154+
lons, lats = np.arange(-180, 180, 20), np.arange(-90, 90, 10)
155+
lats, lons = np.meshgrid(lats, lons)
156+
lons, lats = lons.copy(order="F"), lats.copy(order="F")
157+
return lons, lats, Basemap(projection="sinu", lon_0=0)
158+
159+
160+
def test_convert(self):
161+
"""
162+
Should not fail on C non-contiguous arrays
163+
"""
164+
lons, lats, bmp = self.get_data()
165+
assert not lons.flags['C_CONTIGUOUS']
166+
assert isinstance(lons, np.ndarray)
167+
assert isinstance(bmp, Basemap)
168+
169+
xx1, yy1 = bmp(lons, lats)
170+
171+
172+
def test_results_should_be_same_for_c_and_f_order_arrays(self):
173+
174+
lons, lats, bmp = self.get_data()
175+
176+
xx1, yy1 = bmp(lons.copy(order="C"), lats.copy(order="C"))
177+
xx2, yy2 = bmp(lons.copy(order="F"), lats.copy(order="F"))
178+
179+
assert_almost_equal(xx1, xx2)
180+
assert_almost_equal(yy1, yy2)
181+
182+
183+
184+
185+
152186
def test():
153187
"""
154188
Run some tests.

0 commit comments

Comments
 (0)