Commit 732632a8 authored by Raffaele Gaetano's avatar Raffaele Gaetano
Browse files

Changed parsing of optional arrays

parent 342bc860
No related merge requests found
Showing with 10 additions and 10 deletions
+10 -10
......@@ -63,11 +63,11 @@ obiatools_zonalstats(PyObject *self, PyObject *args) {
if (!w || w == Py_None) {
wg = 0;
} else {
PyArray_Descr* dtype;
int _ndims;
npy_intp _dims;
PyArrayObject* _w;
PyArray_GetArrayParamsFromObject(w,NULL,1,&dtype,&_ndims,&_dims,&_w,NULL);
PyArray_Descr* dtype = PyArray_DescrFromType(NPY_FLOAT32);
//int _ndims;
//npy_intp _dims;
PyArrayObject* _w = (PyArrayObject*)PyArray_FromAny(w, dtype, 1, 1, NPY_ARRAY_CARRAY, NULL);
//PyArray_GetArrayParamsFromObject(w,NULL,1,&dtype,&_ndims,&_dims,&_w,NULL);
wg = (float*)PyArray_DATA(_w);
}
......@@ -76,11 +76,11 @@ obiatools_zonalstats(PyObject *self, PyObject *args) {
nvg = new Data[B];
for (k=0; k<B; k++) nvg[k] = -9999.0;
} else {
PyArray_Descr* dtype;
int _ndims;
npy_intp _dims;
PyArrayObject* _nv;
PyArray_GetArrayParamsFromObject(nv,NULL,1,&dtype,&_ndims,&_dims,&_nv,NULL);
PyArray_Descr* dtype = PyArray_DescrFromType(NPY_FLOAT32);
//int _ndims;
//npy_intp _dims;
PyArrayObject* _nv = (PyArrayObject*)PyArray_FromAny(nv, dtype, 1, 1, NPY_ARRAY_CARRAY, NULL);
//PyArray_GetArrayParamsFromObject(nv,NULL,1,&dtype,&_ndims,&_dims,&_nv,NULL);
nvg = (Data*)PyArray_DATA(_nv);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment