|
|
@ -28,12 +28,9 @@ static PyObject* genFunc(PyObject* self, PyObject* args)
|
|
|
|
struct vario_mod variogram;
|
|
|
|
struct vario_mod variogram;
|
|
|
|
long seed;
|
|
|
|
long seed;
|
|
|
|
struct statistic_mod stat;
|
|
|
|
struct statistic_mod stat;
|
|
|
|
PyArrayObject* out_array;
|
|
|
|
PyObject* out_array;
|
|
|
|
npy_intp out_dims[NPY_MAXDIMS];
|
|
|
|
npy_intp out_dims[NPY_MAXDIMS];
|
|
|
|
|
|
|
|
|
|
|
|
out_array = (PyArrayObject *) PyArray_FromDims(NDIMENSIONS,out_dims,NPY_DOUBLE);
|
|
|
|
|
|
|
|
Y.vector = (double *) out_array->data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Py_getvalues(args, &seed, &grid, &variogram, &stat))
|
|
|
|
if (!Py_getvalues(args, &seed, &grid, &variogram, &stat))
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
Py_kgeneration(seed, grid, stat, variogram, &Z, &Y, n);
|
|
|
|
Py_kgeneration(seed, grid, stat, variogram, &Z, &Y, n);
|
|
|
@ -42,12 +39,11 @@ static PyObject* genFunc(PyObject* self, PyObject* args)
|
|
|
|
out_dims[1] = grid.NY;
|
|
|
|
out_dims[1] = grid.NY;
|
|
|
|
out_dims[2] = grid.NX;
|
|
|
|
out_dims[2] = grid.NX;
|
|
|
|
|
|
|
|
|
|
|
|
out_array = (PyArrayObject*)PyArray_SimpleNewFromData(NDIMENSIONS, out_dims, NPY_DOUBLE, Y.vector);
|
|
|
|
out_array = PyArray_SimpleNewFromData(NDIMENSIONS, out_dims, NPY_DOUBLE, Y.vector);
|
|
|
|
if (out_array == NULL)
|
|
|
|
if (out_array == NULL)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
// PyArray_ENABLEFLAGS(out_array, NPY_ARRAY_OWNDATA);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// out_array->flags |= NPY_ARRAY_OWNDATA;
|
|
|
|
PyArray_ENABLEFLAGS(out_array, NPY_ARRAY_OWNDATA);
|
|
|
|
|
|
|
|
|
|
|
|
free(stat.mean);
|
|
|
|
free(stat.mean);
|
|
|
|
free(stat.variance);
|
|
|
|
free(stat.variance);
|
|
|
|