Skip to content
Snippets Groups Projects
ancillary.c 990 KiB
Newer Older
Paolo Veglio's avatar
Paolo Veglio committed
 *     cdef float[::1] sst_mv = sst
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_sst) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_sst);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_sst, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "ancillary.pyx":33
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     # cdef np.ndarray sst = np.zeros((3232*3200, ), order='C', dtype=np.float32)
 *     if not sst.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         sst = np.ascontiguousarray(sst)
 * 
 */
  }

  /* "ancillary.pyx":36
Paolo Veglio's avatar
Paolo Veglio committed
 *         sst = np.ascontiguousarray(sst)
 * 
 *     cdef float[::1] sst_mv = sst             # <<<<<<<<<<<<<<
 * 
 *     get_Reynolds_SST(&lat[0], &lon[0], res, anc_dir, sst_file, &sst_mv[0])
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_v_sst, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 36, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_v_sst_mv = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "ancillary.pyx":38
Paolo Veglio's avatar
Paolo Veglio committed
 *     cdef float[::1] sst_mv = sst
 * 
 *     get_Reynolds_SST(&lat[0], &lon[0], res, anc_dir, sst_file, &sst_mv[0])             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     return sst
 */
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_res); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L1_error)
  __pyx_t_10 = 0;
  get_Reynolds_SST((&(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_lat.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_lat.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_lon.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_lon.diminfo[0].strides))), __pyx_t_9, __pyx_v_anc_dir, __pyx_v_sst_file, (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_sst_mv.data) + __pyx_t_10)) )))));
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":40
 *     get_Reynolds_SST(&lat[0], &lon[0], res, anc_dir, sst_file, &sst_mv[0])
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     return sst             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_sst);
  __pyx_r = __pyx_v_sst;
  goto __pyx_L0;

  /* "ancillary.pyx":28
Paolo Veglio's avatar
Paolo Veglio committed
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
 * def py_get_Reynolds_SST(np.ndarray[float, ndim=1] lat,             # <<<<<<<<<<<<<<
 *                         np.ndarray[float, ndim=1] lon, res,
Paolo Veglio's avatar
Paolo Veglio committed
 *                         char *anc_dir, char *sst_file, sst):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lat.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lon.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("ancillary_data.py_get_Reynolds_SST", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lat.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lon.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_sst_mv, 1);
  __Pyx_XDECREF(__pyx_v_sst);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "ancillary.pyx":46
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
Paolo Veglio's avatar
Paolo Veglio committed
 * def py_get_NDVI_background(np.ndarray[float, ndim=1] lat,             # <<<<<<<<<<<<<<
 *                            np.ndarray[float, ndim=1] lon, res,
Paolo Veglio's avatar
Paolo Veglio committed
 *                            char *anc_dir, char *ndvi_file, ndvi):
 */

/* Python wrapper */
static PyObject *__pyx_pw_14ancillary_data_3py_get_NDVI_background(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_14ancillary_data_3py_get_NDVI_background = {"py_get_NDVI_background", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14ancillary_data_3py_get_NDVI_background, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_14ancillary_data_3py_get_NDVI_background(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_lat = 0;
  PyArrayObject *__pyx_v_lon = 0;
  PyObject *__pyx_v_res = 0;
Paolo Veglio's avatar
Paolo Veglio committed
  char *__pyx_v_anc_dir;
  char *__pyx_v_ndvi_file;
  PyObject *__pyx_v_ndvi = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("py_get_NDVI_background (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat,&__pyx_n_s_lon,&__pyx_n_s_res,&__pyx_n_s_anc_dir,&__pyx_n_s_ndvi_file,&__pyx_n_s_ndvi,0};
    PyObject* values[6] = {0,0,0,0,0,0};
Paolo Veglio's avatar
Paolo Veglio committed
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
Paolo Veglio's avatar
Paolo Veglio committed
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lon)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_NDVI_background", 1, 6, 6, 1); __PYX_ERR(0, 46, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_res)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_NDVI_background", 1, 6, 6, 2); __PYX_ERR(0, 46, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_anc_dir)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_NDVI_background", 1, 6, 6, 3); __PYX_ERR(0, 46, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ndvi_file)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_NDVI_background", 1, 6, 6, 4); __PYX_ERR(0, 46, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ndvi)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_NDVI_background", 1, 6, 6, 5); __PYX_ERR(0, 46, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_get_NDVI_background") < 0)) __PYX_ERR(0, 46, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
Paolo Veglio's avatar
Paolo Veglio committed
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
Paolo Veglio's avatar
Paolo Veglio committed
    }
    __pyx_v_lat = ((PyArrayObject *)values[0]);
    __pyx_v_lon = ((PyArrayObject *)values[1]);
    __pyx_v_res = values[2];
    __pyx_v_anc_dir = __Pyx_PyObject_AsWritableString(values[3]); if (unlikely((!__pyx_v_anc_dir) && PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L3_error)
    __pyx_v_ndvi_file = __Pyx_PyObject_AsWritableString(values[4]); if (unlikely((!__pyx_v_ndvi_file) && PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L3_error)
    __pyx_v_ndvi = values[5];
Paolo Veglio's avatar
Paolo Veglio committed
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("py_get_NDVI_background", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 46, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_L3_error:;
  __Pyx_AddTraceback("ancillary_data.py_get_NDVI_background", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5numpy_ndarray, 1, "lat", 0))) __PYX_ERR(0, 46, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lon), __pyx_ptype_5numpy_ndarray, 1, "lon", 0))) __PYX_ERR(0, 47, __pyx_L1_error)
  __pyx_r = __pyx_pf_14ancillary_data_2py_get_NDVI_background(__pyx_self, __pyx_v_lat, __pyx_v_lon, __pyx_v_res, __pyx_v_anc_dir, __pyx_v_ndvi_file, __pyx_v_ndvi);
Paolo Veglio's avatar
Paolo Veglio committed

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_14ancillary_data_2py_get_NDVI_background(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, PyObject *__pyx_v_res, char *__pyx_v_anc_dir, char *__pyx_v_ndvi_file, PyObject *__pyx_v_ndvi) {
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_memviewslice __pyx_v_ndvi_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lat;
  __Pyx_Buffer __pyx_pybuffer_lat;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lon;
  __Pyx_Buffer __pyx_pybuffer_lon;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
Paolo Veglio's avatar
Paolo Veglio committed
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("py_get_NDVI_background", 0);
  __Pyx_INCREF(__pyx_v_ndvi);
  __pyx_pybuffer_lat.pybuffer.buf = NULL;
  __pyx_pybuffer_lat.refcount = 0;
  __pyx_pybuffernd_lat.data = NULL;
  __pyx_pybuffernd_lat.rcbuffer = &__pyx_pybuffer_lat;
  __pyx_pybuffer_lon.pybuffer.buf = NULL;
  __pyx_pybuffer_lon.refcount = 0;
  __pyx_pybuffernd_lon.data = NULL;
  __pyx_pybuffernd_lon.rcbuffer = &__pyx_pybuffer_lon;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lat.rcbuffer->pybuffer, (PyObject*)__pyx_v_lat, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 46, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  }
  __pyx_pybuffernd_lat.diminfo[0].strides = __pyx_pybuffernd_lat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lat.diminfo[0].shape = __pyx_pybuffernd_lat.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lon.rcbuffer->pybuffer, (PyObject*)__pyx_v_lon, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 46, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  }
  __pyx_pybuffernd_lon.diminfo[0].strides = __pyx_pybuffernd_lon.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lon.diminfo[0].shape = __pyx_pybuffernd_lon.rcbuffer->pybuffer.shape[0];

  /* "ancillary.pyx":50
Paolo Veglio's avatar
Paolo Veglio committed
 *                            char *anc_dir, char *ndvi_file, ndvi):
 * 
 *     if not ndvi.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         ndvi = np.ascontiguousarray(ndvi)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ndvi, __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_C_CONTIGUOUS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 50, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "ancillary.pyx":51
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     if not ndvi.flags['C_CONTIGUOUS']:
 *         ndvi = np.ascontiguousarray(ndvi)             # <<<<<<<<<<<<<<
 * 
 *     cdef float[::1] ndvi_mv = ndvi
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 51, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_ndvi) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_ndvi);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_ndvi, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "ancillary.pyx":50
Paolo Veglio's avatar
Paolo Veglio committed
 *                            char *anc_dir, char *ndvi_file, ndvi):
 * 
 *     if not ndvi.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         ndvi = np.ascontiguousarray(ndvi)
 * 
 */
  }

  /* "ancillary.pyx":53
Paolo Veglio's avatar
Paolo Veglio committed
 *         ndvi = np.ascontiguousarray(ndvi)
 * 
 *     cdef float[::1] ndvi_mv = ndvi             # <<<<<<<<<<<<<<
 * 
 *     get_NDVI_background(&lat[0], &lon[0], res, anc_dir, ndvi_file, &ndvi_mv[0])
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_v_ndvi, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 53, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_v_ndvi_mv = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "ancillary.pyx":55
Paolo Veglio's avatar
Paolo Veglio committed
 *     cdef float[::1] ndvi_mv = ndvi
 * 
 *     get_NDVI_background(&lat[0], &lon[0], res, anc_dir, ndvi_file, &ndvi_mv[0])             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     return ndvi
 */
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_res); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 55, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_t_10 = 0;
  get_NDVI_background((&(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_lat.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_lat.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_lon.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_lon.diminfo[0].strides))), __pyx_t_9, __pyx_v_anc_dir, __pyx_v_ndvi_file, (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_ndvi_mv.data) + __pyx_t_10)) )))));
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":57
 *     get_NDVI_background(&lat[0], &lon[0], res, anc_dir, ndvi_file, &ndvi_mv[0])
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     return ndvi             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ndvi);
  __pyx_r = __pyx_v_ndvi;
  goto __pyx_L0;

  /* "ancillary.pyx":46
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
Paolo Veglio's avatar
Paolo Veglio committed
 * def py_get_NDVI_background(np.ndarray[float, ndim=1] lat,             # <<<<<<<<<<<<<<
 *                            np.ndarray[float, ndim=1] lon, res,
Paolo Veglio's avatar
Paolo Veglio committed
 *                            char *anc_dir, char *ndvi_file, ndvi):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lat.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lon.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("ancillary_data.py_get_NDVI_background", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lat.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lon.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_ndvi_mv, 1);
  __Pyx_XDECREF(__pyx_v_ndvi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "ancillary.pyx":63
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
Paolo Veglio's avatar
Paolo Veglio committed
 * def py_get_Olson_eco(np.ndarray[float, ndim=1] lat,             # <<<<<<<<<<<<<<
 *                      np.ndarray[float, ndim=1] lon, res,
Paolo Veglio's avatar
Paolo Veglio committed
 *                      char *anc_dir, eco):
 */

/* Python wrapper */
static PyObject *__pyx_pw_14ancillary_data_5py_get_Olson_eco(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_14ancillary_data_5py_get_Olson_eco = {"py_get_Olson_eco", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14ancillary_data_5py_get_Olson_eco, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_14ancillary_data_5py_get_Olson_eco(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_lat = 0;
  PyArrayObject *__pyx_v_lon = 0;
  PyObject *__pyx_v_res = 0;
Paolo Veglio's avatar
Paolo Veglio committed
  char *__pyx_v_anc_dir;
  PyObject *__pyx_v_eco = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("py_get_Olson_eco (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat,&__pyx_n_s_lon,&__pyx_n_s_res,&__pyx_n_s_anc_dir,&__pyx_n_s_eco,0};
    PyObject* values[5] = {0,0,0,0,0};
Paolo Veglio's avatar
Paolo Veglio committed
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
Paolo Veglio's avatar
Paolo Veglio committed
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lon)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_Olson_eco", 1, 5, 5, 1); __PYX_ERR(0, 63, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_res)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_Olson_eco", 1, 5, 5, 2); __PYX_ERR(0, 63, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_anc_dir)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_Olson_eco", 1, 5, 5, 3); __PYX_ERR(0, 63, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eco)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_Olson_eco", 1, 5, 5, 4); __PYX_ERR(0, 63, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_get_Olson_eco") < 0)) __PYX_ERR(0, 63, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
Paolo Veglio's avatar
Paolo Veglio committed
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
Paolo Veglio's avatar
Paolo Veglio committed
    }
    __pyx_v_lat = ((PyArrayObject *)values[0]);
    __pyx_v_lon = ((PyArrayObject *)values[1]);
    __pyx_v_res = values[2];
    __pyx_v_anc_dir = __Pyx_PyObject_AsWritableString(values[3]); if (unlikely((!__pyx_v_anc_dir) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L3_error)
    __pyx_v_eco = values[4];
Paolo Veglio's avatar
Paolo Veglio committed
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("py_get_Olson_eco", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 63, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_L3_error:;
  __Pyx_AddTraceback("ancillary_data.py_get_Olson_eco", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5numpy_ndarray, 1, "lat", 0))) __PYX_ERR(0, 63, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lon), __pyx_ptype_5numpy_ndarray, 1, "lon", 0))) __PYX_ERR(0, 64, __pyx_L1_error)
  __pyx_r = __pyx_pf_14ancillary_data_4py_get_Olson_eco(__pyx_self, __pyx_v_lat, __pyx_v_lon, __pyx_v_res, __pyx_v_anc_dir, __pyx_v_eco);
Paolo Veglio's avatar
Paolo Veglio committed

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_14ancillary_data_4py_get_Olson_eco(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, PyObject *__pyx_v_res, char *__pyx_v_anc_dir, PyObject *__pyx_v_eco) {
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_memviewslice __pyx_v_eco_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lat;
  __Pyx_Buffer __pyx_pybuffer_lat;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lon;
  __Pyx_Buffer __pyx_pybuffer_lon;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
Paolo Veglio's avatar
Paolo Veglio committed
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("py_get_Olson_eco", 0);
  __Pyx_INCREF(__pyx_v_eco);
  __pyx_pybuffer_lat.pybuffer.buf = NULL;
  __pyx_pybuffer_lat.refcount = 0;
  __pyx_pybuffernd_lat.data = NULL;
  __pyx_pybuffernd_lat.rcbuffer = &__pyx_pybuffer_lat;
  __pyx_pybuffer_lon.pybuffer.buf = NULL;
  __pyx_pybuffer_lon.refcount = 0;
  __pyx_pybuffernd_lon.data = NULL;
  __pyx_pybuffernd_lon.rcbuffer = &__pyx_pybuffer_lon;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lat.rcbuffer->pybuffer, (PyObject*)__pyx_v_lat, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 63, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  }
  __pyx_pybuffernd_lat.diminfo[0].strides = __pyx_pybuffernd_lat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lat.diminfo[0].shape = __pyx_pybuffernd_lat.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lon.rcbuffer->pybuffer, (PyObject*)__pyx_v_lon, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 63, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  }
  __pyx_pybuffernd_lon.diminfo[0].strides = __pyx_pybuffernd_lon.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lon.diminfo[0].shape = __pyx_pybuffernd_lon.rcbuffer->pybuffer.shape[0];

  /* "ancillary.pyx":67
Paolo Veglio's avatar
Paolo Veglio committed
 *                      char *anc_dir, eco):
 * 
 *     if not eco.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         eco = np.ascontiguousarray(eco)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_eco, __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_C_CONTIGUOUS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 67, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "ancillary.pyx":68
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     if not eco.flags['C_CONTIGUOUS']:
 *         eco = np.ascontiguousarray(eco)             # <<<<<<<<<<<<<<
 * 
 *     cdef unsigned char[::1] eco_mv = eco
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_eco) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_eco);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_eco, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "ancillary.pyx":67
Paolo Veglio's avatar
Paolo Veglio committed
 *                      char *anc_dir, eco):
 * 
 *     if not eco.flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *         eco = np.ascontiguousarray(eco)
 * 
 */
  }

  /* "ancillary.pyx":70
Paolo Veglio's avatar
Paolo Veglio committed
 *         eco = np.ascontiguousarray(eco)
 * 
 *     cdef unsigned char[::1] eco_mv = eco             # <<<<<<<<<<<<<<
 * 
 *     get_Olson_eco(&lat[0], &lon[0], res, anc_dir, &eco_mv[0])
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_v_eco, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 70, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_v_eco_mv = __pyx_t_6;
  __pyx_t_6.memview = NULL;
  __pyx_t_6.data = NULL;

  /* "ancillary.pyx":72
Paolo Veglio's avatar
Paolo Veglio committed
 *     cdef unsigned char[::1] eco_mv = eco
 * 
 *     get_Olson_eco(&lat[0], &lon[0], res, anc_dir, &eco_mv[0])             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     return eco
 */
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_res); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_t_10 = 0;
  get_Olson_eco((&(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_lat.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_lat.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_lon.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_lon.diminfo[0].strides))), __pyx_t_9, __pyx_v_anc_dir, (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_eco_mv.data) + __pyx_t_10)) )))));
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":74
 *     get_Olson_eco(&lat[0], &lon[0], res, anc_dir, &eco_mv[0])
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     return eco             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_eco);
  __pyx_r = __pyx_v_eco;
  goto __pyx_L0;

  /* "ancillary.pyx":63
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
Paolo Veglio's avatar
Paolo Veglio committed
 * def py_get_Olson_eco(np.ndarray[float, ndim=1] lat,             # <<<<<<<<<<<<<<
 *                      np.ndarray[float, ndim=1] lon, res,
Paolo Veglio's avatar
Paolo Veglio committed
 *                      char *anc_dir, eco):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lat.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lon.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("ancillary_data.py_get_Olson_eco", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lat.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lon.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_eco_mv, 1);
  __Pyx_XDECREF(__pyx_v_eco);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "ancillary.pyx":80
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
 * def py_get_GEOS(np.ndarray[float, ndim=1] lat, np.ndarray[float, ndim=1] lon, int res, char *startTime,             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 *                 char *anc_dir, char *geos1, char *geos2, char *geos_lnd, char *geos_ocn, char *geos_cnst,
Paolo Veglio's avatar
Paolo Veglio committed
 */

/* Python wrapper */
static PyObject *__pyx_pw_14ancillary_data_7py_get_GEOS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_14ancillary_data_7py_get_GEOS = {"py_get_GEOS", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14ancillary_data_7py_get_GEOS, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_14ancillary_data_7py_get_GEOS(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_lat = 0;
  PyArrayObject *__pyx_v_lon = 0;
Paolo Veglio's avatar
Paolo Veglio committed
  char *__pyx_v_startTime;
  char *__pyx_v_anc_dir;
  char *__pyx_v_geos1;
  char *__pyx_v_geos2;
  char *__pyx_v_geos_lnd;
  char *__pyx_v_geos_ocn;
  char *__pyx_v_geos_cnst;
  PyObject *__pyx_v_geos_data = 0;
Paolo Veglio's avatar
Paolo Veglio committed
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("py_get_GEOS (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat,&__pyx_n_s_lon,&__pyx_n_s_res,&__pyx_n_s_startTime,&__pyx_n_s_anc_dir,&__pyx_n_s_geos1,&__pyx_n_s_geos2,&__pyx_n_s_geos_lnd,&__pyx_n_s_geos_ocn,&__pyx_n_s_geos_cnst,&__pyx_n_s_geos_data,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
Paolo Veglio's avatar
Paolo Veglio committed
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
Paolo Veglio's avatar
Paolo Veglio committed
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lon)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 1); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_res)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 2); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startTime)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 3); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_anc_dir)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 4); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos1)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 5); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos2)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 6); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos_lnd)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 7); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos_ocn)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 8); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos_cnst)) != 0)) kw_args--;
Paolo Veglio's avatar
Paolo Veglio committed
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 9); __PYX_ERR(0, 80, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, 10); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_get_GEOS") < 0)) __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 11) {
Paolo Veglio's avatar
Paolo Veglio committed
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
      values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
Paolo Veglio's avatar
Paolo Veglio committed
    }
    __pyx_v_lat = ((PyArrayObject *)values[0]);
    __pyx_v_lon = ((PyArrayObject *)values[1]);
    __pyx_v_res = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_res == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L3_error)
    __pyx_v_startTime = __Pyx_PyObject_AsWritableString(values[3]); if (unlikely((!__pyx_v_startTime) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L3_error)
    __pyx_v_anc_dir = __Pyx_PyObject_AsWritableString(values[4]); if (unlikely((!__pyx_v_anc_dir) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L3_error)
    __pyx_v_geos1 = __Pyx_PyObject_AsWritableString(values[5]); if (unlikely((!__pyx_v_geos1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L3_error)
    __pyx_v_geos2 = __Pyx_PyObject_AsWritableString(values[6]); if (unlikely((!__pyx_v_geos2) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L3_error)
    __pyx_v_geos_lnd = __Pyx_PyObject_AsWritableString(values[7]); if (unlikely((!__pyx_v_geos_lnd) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L3_error)
    __pyx_v_geos_ocn = __Pyx_PyObject_AsWritableString(values[8]); if (unlikely((!__pyx_v_geos_ocn) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L3_error)
    __pyx_v_geos_cnst = __Pyx_PyObject_AsWritableString(values[9]); if (unlikely((!__pyx_v_geos_cnst) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L3_error)
    __pyx_v_geos_data = values[10];
Paolo Veglio's avatar
Paolo Veglio committed
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 80, __pyx_L3_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_L3_error:;
  __Pyx_AddTraceback("ancillary_data.py_get_GEOS", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5numpy_ndarray, 1, "lat", 0))) __PYX_ERR(0, 80, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lon), __pyx_ptype_5numpy_ndarray, 1, "lon", 0))) __PYX_ERR(0, 80, __pyx_L1_error)
  __pyx_r = __pyx_pf_14ancillary_data_6py_get_GEOS(__pyx_self, __pyx_v_lat, __pyx_v_lon, __pyx_v_res, __pyx_v_startTime, __pyx_v_anc_dir, __pyx_v_geos1, __pyx_v_geos2, __pyx_v_geos_lnd, __pyx_v_geos_ocn, __pyx_v_geos_cnst, __pyx_v_geos_data);
Paolo Veglio's avatar
Paolo Veglio committed

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_14ancillary_data_6py_get_GEOS(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, int __pyx_v_res, char *__pyx_v_startTime, char *__pyx_v_anc_dir, char *__pyx_v_geos1, char *__pyx_v_geos2, char *__pyx_v_geos_lnd, char *__pyx_v_geos_ocn, char *__pyx_v_geos_cnst, PyObject *__pyx_v_geos_data) {
  PyObject *__pyx_v_v = NULL;
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_memviewslice __pyx_v_tpw_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_snowfr_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_icefr_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ocnfr_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_landicefr_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_sfct_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_geos_dict = NULL;
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lat;
  __Pyx_Buffer __pyx_pybuffer_lat;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lon;
  __Pyx_Buffer __pyx_pybuffer_lon;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
Paolo Veglio's avatar
Paolo Veglio committed
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
Paolo Veglio's avatar
Paolo Veglio committed
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
Paolo Veglio's avatar
Paolo Veglio committed
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
Paolo Veglio's avatar
Paolo Veglio committed
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("py_get_GEOS", 0);
  __pyx_pybuffer_lat.pybuffer.buf = NULL;
  __pyx_pybuffer_lat.refcount = 0;
  __pyx_pybuffernd_lat.data = NULL;
  __pyx_pybuffernd_lat.rcbuffer = &__pyx_pybuffer_lat;
  __pyx_pybuffer_lon.pybuffer.buf = NULL;
  __pyx_pybuffer_lon.refcount = 0;
  __pyx_pybuffernd_lon.data = NULL;
  __pyx_pybuffernd_lon.rcbuffer = &__pyx_pybuffer_lon;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lat.rcbuffer->pybuffer, (PyObject*)__pyx_v_lat, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 80, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  }
  __pyx_pybuffernd_lat.diminfo[0].strides = __pyx_pybuffernd_lat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lat.diminfo[0].shape = __pyx_pybuffernd_lat.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lon.rcbuffer->pybuffer, (PyObject*)__pyx_v_lon, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 80, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  }
  __pyx_pybuffernd_lon.diminfo[0].strides = __pyx_pybuffernd_lon.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lon.diminfo[0].shape = __pyx_pybuffernd_lon.rcbuffer->pybuffer.shape[0];

  /* "ancillary.pyx":84
 *                 geos_data):
 * 
 *     for v in geos_data:             # <<<<<<<<<<<<<<
 *         if not geos_data[v].flags['C_CONTIGUOUS']:
 *             geos_data[v] = np.ascontiguousarray(geos_data[v])
Paolo Veglio's avatar
Paolo Veglio committed
 */
  if (likely(PyList_CheckExact(__pyx_v_geos_data)) || PyTuple_CheckExact(__pyx_v_geos_data)) {
    __pyx_t_1 = __pyx_v_geos_data; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_geos_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 84, __pyx_L1_error)
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 84, __pyx_L1_error)
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
Paolo Veglio's avatar
Paolo Veglio committed
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 84, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
      }
      __Pyx_GOTREF(__pyx_t_4);
Paolo Veglio's avatar
Paolo Veglio committed
    }
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4);
    __pyx_t_4 = 0;
Paolo Veglio's avatar
Paolo Veglio committed

    /* "ancillary.pyx":85
 * 
 *     for v in geos_data:
 *         if not geos_data[v].flags['C_CONTIGUOUS']:             # <<<<<<<<<<<<<<
 *             geos_data[v] = np.ascontiguousarray(geos_data[v])
Paolo Veglio's avatar
Paolo Veglio committed
 */
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_geos_data, __pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_flags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_C_CONTIGUOUS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
Paolo Veglio's avatar
Paolo Veglio committed
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = ((!__pyx_t_6) != 0);
    if (__pyx_t_7) {
Paolo Veglio's avatar
Paolo Veglio committed

      /* "ancillary.pyx":86
 *     for v in geos_data:
 *         if not geos_data[v].flags['C_CONTIGUOUS']:
 *             geos_data[v] = np.ascontiguousarray(geos_data[v])             # <<<<<<<<<<<<<<
 * 
 *     cdef float[::1] tpw_mv = geos_data['tpw']
Paolo Veglio's avatar
Paolo Veglio committed
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_geos_data, __pyx_v_v); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {