@@ -1515,8 +1515,8 @@ build_cntr_list_v2(long *np, double *xp, double *yp, short *kp,
1515
1515
if (kv == NULL ) goto error ;
1516
1516
1517
1517
n = reorder (xpp , ypp , kpp ,
1518
- (double * ) xyv -> data ,
1519
- (unsigned char * ) kv -> data ,
1518
+ (double * ) PyArray_DATA ( xyv ) ,
1519
+ (unsigned char * ) PyArray_DATA ( kv ) ,
1520
1520
np [i ]);
1521
1521
if (n == -1 ) goto error ;
1522
1522
newshape .len = 2 ;
@@ -1827,22 +1827,22 @@ Cntr_init(Cntr *self, PyObject *args, PyObject *kwds)
1827
1827
"x, y, z must be castable to double." );
1828
1828
goto error ;
1829
1829
}
1830
- iMax = zpa -> dimensions [ 1 ] ;
1831
- jMax = zpa -> dimensions [ 0 ] ;
1832
- if (xpa -> dimensions [ 0 ] != jMax || xpa -> dimensions [ 1 ] != iMax ||
1833
- ypa -> dimensions [ 0 ] != jMax || ypa -> dimensions [ 1 ] != iMax ||
1834
- (mpa && (mpa -> dimensions [ 0 ] != jMax || mpa -> dimensions [ 1 ] != iMax )))
1830
+ iMax = PyArray_DIM ( zpa , 1 ) ;
1831
+ jMax = PyArray_DIM ( zpa , 0 ) ;
1832
+ if (PyArray_DIM ( xpa , 0 ) != jMax || PyArray_DIM ( xpa , 1 ) != iMax ||
1833
+ PyArray_DIM ( ypa , 0 ) != jMax || PyArray_DIM ( ypa , 1 ) != iMax ||
1834
+ (mpa && (PyArray_DIM ( mpa , 0 ) != jMax || PyArray_DIM ( mpa , 1 ) != iMax )))
1835
1835
{
1836
1836
PyErr_SetString (PyExc_ValueError ,
1837
1837
"Arguments x, y, z, mask (if present)"
1838
1838
" must have the same dimensions." );
1839
1839
goto error ;
1840
1840
}
1841
- if (mpa ) mask = mpa -> data ;
1841
+ if (mpa ) mask = PyArray_DATA ( mpa ) ;
1842
1842
else mask = NULL ;
1843
- if ( cntr_init (self -> site , iMax , jMax , (double * )xpa -> data ,
1844
- (double * )ypa -> data ,
1845
- (double * )zpa -> data , mask ))
1843
+ if ( cntr_init (self -> site , iMax , jMax , (double * )PyArray_DATA ( xpa ) ,
1844
+ (double * )PyArray_DATA ( ypa ) ,
1845
+ (double * )PyArray_DATA ( zpa ) , mask ))
1846
1846
{
1847
1847
PyErr_SetString (PyExc_MemoryError ,
1848
1848
"Memory allocation failure in cntr_init" );
@@ -1895,9 +1895,10 @@ Cntr_get_cdata(Cntr *self)
1895
1895
dims [1 ] = nj = self -> site -> jmax ;
1896
1896
1897
1897
Cdata = (PyArrayObject * ) PyArray_SimpleNew (2 , dims , NPY_SHORT );
1898
+ char * const data = PyArray_DATA (Cdata );
1898
1899
for (j = 0 ; j < nj ; j ++ )
1899
1900
for (i = 0 ; i < ni ; i ++ )
1900
- Cdata -> data [j + i * nj ] = self -> site -> data [i + j * ni ];
1901
+ data [j + i * nj ] = self -> site -> data [i + j * ni ];
1901
1902
/* output is C-order, input is F-order */
1902
1903
/* for now we are ignoring the last ni+1 values */
1903
1904
return (PyObject * )Cdata ;
0 commit comments