@@ -96,6 +96,41 @@ 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+ assert isinstance (lons , np .ndarray )
114+ assert isinstance (bmp , Basemap )
115+
116+ xx1 , yy1 = bmp (lons , lats )
117+
118+
119+ def test_results_should_be_same_for_c_and_f_order_arrays (self ):
120+
121+ lons , lats , bmp = self .get_data ()
122+
123+ xx1 , yy1 = bmp (lons .copy (order = "C" ), lats .copy (order = "C" ))
124+ xx2 , yy2 = bmp (lons .copy (order = "F" ), lats .copy (order = "F" ))
125+
126+ assert_almost_equal (xx1 , xx2 )
127+ assert_almost_equal (yy1 , yy2 )
128+
129+
130+
131+
132+
133+
99134def test ():
100135 """
101136 Run some tests.
0 commit comments