Skip to content
Snippets Groups Projects
ancillary.c 990 KiB
Newer Older
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_geos_data, __pyx_v_v, __pyx_t_4) < 0)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_DECREF(__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])
    /* "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
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":88
 *             geos_data[v] = np.ascontiguousarray(geos_data[v])
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     cdef float[::1] tpw_mv = geos_data['tpw']             # <<<<<<<<<<<<<<
 *     cdef float[::1] snowfr_mv = geos_data['snowfr']
 *     cdef float[::1] icefr_mv = geos_data['icefr']
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_tpw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 88, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tpw_mv = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":89
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     cdef float[::1] tpw_mv = geos_data['tpw']
 *     cdef float[::1] snowfr_mv = geos_data['snowfr']             # <<<<<<<<<<<<<<
 *     cdef float[::1] icefr_mv = geos_data['icefr']
 *     cdef float[::1] ocnfr_mv = geos_data['ocnfr']
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_snowfr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_snowfr_mv = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":90
 *     cdef float[::1] tpw_mv = geos_data['tpw']
 *     cdef float[::1] snowfr_mv = geos_data['snowfr']
 *     cdef float[::1] icefr_mv = geos_data['icefr']             # <<<<<<<<<<<<<<
 *     cdef float[::1] ocnfr_mv = geos_data['ocnfr']
 *     cdef float[::1] landicefr_mv = geos_data['landicefr']
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_icefr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_icefr_mv = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":91
 *     cdef float[::1] snowfr_mv = geos_data['snowfr']
 *     cdef float[::1] icefr_mv = geos_data['icefr']
 *     cdef float[::1] ocnfr_mv = geos_data['ocnfr']             # <<<<<<<<<<<<<<
 *     cdef float[::1] landicefr_mv = geos_data['landicefr']
 *     cdef float[::1] sfct_mv = geos_data['sfct']
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_ocnfr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ocnfr_mv = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":92
 *     cdef float[::1] icefr_mv = geos_data['icefr']
 *     cdef float[::1] ocnfr_mv = geos_data['ocnfr']
 *     cdef float[::1] landicefr_mv = geos_data['landicefr']             # <<<<<<<<<<<<<<
 *     cdef float[::1] sfct_mv = geos_data['sfct']
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_landicefr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_landicefr_mv = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":93
 *     cdef float[::1] ocnfr_mv = geos_data['ocnfr']
 *     cdef float[::1] landicefr_mv = geos_data['landicefr']
 *     cdef float[::1] sfct_mv = geos_data['sfct']             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     get_GEOS(&lat[0], &lon[0], res, startTime, anc_dir, geos1, geos2, geos_lnd, geos_ocn, geos_cnst,
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_sfct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sfct_mv = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":95
 *     cdef float[::1] sfct_mv = geos_data['sfct']
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     get_GEOS(&lat[0], &lon[0], res, startTime, anc_dir, geos1, geos2, geos_lnd, geos_ocn, geos_cnst,             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 *              &tpw_mv[0], &snowfr_mv[0], &icefr_mv[0], &ocnfr_mv[0], &landicefr_mv[0], &sfct_mv[0])
 * 
 */
  __pyx_t_11 = 0;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":96
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     get_GEOS(&lat[0], &lon[0], res, startTime, anc_dir, geos1, geos2, geos_lnd, geos_ocn, geos_cnst,
Paolo Veglio's avatar
Paolo Veglio committed
 *              &tpw_mv[0], &snowfr_mv[0], &icefr_mv[0], &ocnfr_mv[0], &landicefr_mv[0], &sfct_mv[0])             # <<<<<<<<<<<<<<
 * 
 *     geos_dict = {'tpw': geos_data['tpw'],
Paolo Veglio's avatar
Paolo Veglio committed
 */
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_t_14 = 0;
  __pyx_t_15 = 0;
  __pyx_t_16 = 0;
  __pyx_t_17 = 0;
  __pyx_t_18 = 0;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":95
 *     cdef float[::1] sfct_mv = geos_data['sfct']
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     get_GEOS(&lat[0], &lon[0], res, startTime, anc_dir, geos1, geos2, geos_lnd, geos_ocn, geos_cnst,             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 *              &tpw_mv[0], &snowfr_mv[0], &icefr_mv[0], &ocnfr_mv[0], &landicefr_mv[0], &sfct_mv[0])
 * 
 */
  get_GEOS((&(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_lat.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_lat.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_lon.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_lon.diminfo[0].strides))), __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, (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_tpw_mv.data) + __pyx_t_13)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_snowfr_mv.data) + __pyx_t_14)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_icefr_mv.data) + __pyx_t_15)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_ocnfr_mv.data) + __pyx_t_16)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_landicefr_mv.data) + __pyx_t_17)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_sfct_mv.data) + __pyx_t_18)) )))));
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":98
 *              &tpw_mv[0], &snowfr_mv[0], &icefr_mv[0], &ocnfr_mv[0], &landicefr_mv[0], &sfct_mv[0])
 * 
 *     geos_dict = {'tpw': geos_data['tpw'],             # <<<<<<<<<<<<<<
 *                  'snowfr': geos_data['snowfr'],
 *                  'icefr': geos_data['icefr'],
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_tpw); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tpw, __pyx_t_4) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":99
 * 
 *     geos_dict = {'tpw': geos_data['tpw'],
 *                  'snowfr': geos_data['snowfr'],             # <<<<<<<<<<<<<<
 *                  'icefr': geos_data['icefr'],
 *                  'ocnfr': geos_data['ocnfr'],
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_snowfr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_snowfr, __pyx_t_4) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "ancillary.pyx":100
 *     geos_dict = {'tpw': geos_data['tpw'],
 *                  'snowfr': geos_data['snowfr'],
 *                  'icefr': geos_data['icefr'],             # <<<<<<<<<<<<<<
 *                  'ocnfr': geos_data['ocnfr'],
 *                  'landicefr': geos_data['landicefr'],
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_icefr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_icefr, __pyx_t_4) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "ancillary.pyx":101
 *                  'snowfr': geos_data['snowfr'],
 *                  'icefr': geos_data['icefr'],
 *                  'ocnfr': geos_data['ocnfr'],             # <<<<<<<<<<<<<<
 *                  'landicefr': geos_data['landicefr'],
 *                  'sfct': geos_data['sfct']
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_ocnfr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_ocnfr, __pyx_t_4) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "ancillary.pyx":102
 *                  'icefr': geos_data['icefr'],
 *                  'ocnfr': geos_data['ocnfr'],
 *                  'landicefr': geos_data['landicefr'],             # <<<<<<<<<<<<<<
 *                  'sfct': geos_data['sfct']
 *                  }
 */
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_landicefr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_landicefr, __pyx_t_4) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "ancillary.pyx":103
 *                  'ocnfr': geos_data['ocnfr'],
 *                  'landicefr': geos_data['landicefr'],
 *                  'sfct': geos_data['sfct']             # <<<<<<<<<<<<<<
 *                  }
  __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_sfct); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sfct, __pyx_t_4) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_geos_dict = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "ancillary.pyx":106
 *                  }
 * 
 *     return geos_dict             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_geos_dict);
  __pyx_r = __pyx_v_geos_dict;
Paolo Veglio's avatar
Paolo Veglio committed
  goto __pyx_L0;

  /* "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
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
Paolo Veglio's avatar
Paolo Veglio committed
  { 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_GEOS", __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_XDECREF(__pyx_v_v);
Paolo Veglio's avatar
Paolo Veglio committed
  __PYX_XDEC_MEMVIEW(&__pyx_v_tpw_mv, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_snowfr_mv, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_icefr_mv, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ocnfr_mv, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_landicefr_mv, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_sfct_mv, 1);
  __Pyx_XDECREF(__pyx_v_geos_dict);
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "ancillary.pyx":112
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
 * def py_snow_mask(char *satname, unsigned char lsf):             # <<<<<<<<<<<<<<
 *     # need to have for loop here to compute all the pixels since the function, as with everything else,
 *     # is run per pixel.
Paolo Veglio's avatar
Paolo Veglio committed
 */

/* Python wrapper */
static PyObject *__pyx_pw_14ancillary_data_9py_snow_mask(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_14ancillary_data_9py_snow_mask = {"py_snow_mask", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14ancillary_data_9py_snow_mask, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_14ancillary_data_9py_snow_mask(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED char *__pyx_v_satname;
  CYTHON_UNUSED unsigned char __pyx_v_lsf;
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_snow_mask (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_satname,&__pyx_n_s_lsf,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_satname)) != 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_lsf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_snow_mask", 1, 2, 2, 1); __PYX_ERR(0, 112, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_snow_mask") < 0)) __PYX_ERR(0, 112, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_satname = __Pyx_PyObject_AsWritableString(values[0]); if (unlikely((!__pyx_v_satname) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L3_error)
    __pyx_v_lsf = __Pyx_PyInt_As_unsigned_char(values[1]); if (unlikely((__pyx_v_lsf == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("py_snow_mask", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 112, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("ancillary_data.py_snow_mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_14ancillary_data_8py_snow_mask(__pyx_self, __pyx_v_satname, __pyx_v_lsf);
Paolo Veglio's avatar
Paolo Veglio committed

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
Paolo Veglio's avatar
Paolo Veglio committed

static PyObject *__pyx_pf_14ancillary_data_8py_snow_mask(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED char *__pyx_v_satname, CYTHON_UNUSED unsigned char __pyx_v_lsf) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("py_snow_mask", 0);
Paolo Veglio's avatar
Paolo Veglio committed

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "ancillary.pyx":121
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
 * def py_cithr(int key, np.ndarray[float, ndim=1] sec_vza, np.ndarray[float, ndim=1] bt11):             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     cdef np.ndarray tci_thr = np.zeros((bt11.shape[0], ), order='C', dtype=np.float)
Paolo Veglio's avatar
Paolo Veglio committed
 */

/* Python wrapper */
static PyObject *__pyx_pw_14ancillary_data_11py_cithr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_14ancillary_data_11py_cithr = {"py_cithr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14ancillary_data_11py_cithr, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_14ancillary_data_11py_cithr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_key;
  PyArrayObject *__pyx_v_sec_vza = 0;
  PyArrayObject *__pyx_v_bt11 = 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_cithr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_sec_vza,&__pyx_n_s_bt11,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_key)) != 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_sec_vza)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_cithr", 1, 3, 3, 1); __PYX_ERR(0, 121, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bt11)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_cithr", 1, 3, 3, 2); __PYX_ERR(0, 121, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_cithr") < 0)) __PYX_ERR(0, 121, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      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);
    }
    __pyx_v_key = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error)
    __pyx_v_sec_vza = ((PyArrayObject *)values[1]);
    __pyx_v_bt11 = ((PyArrayObject *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("py_cithr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 121, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("ancillary_data.py_cithr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sec_vza), __pyx_ptype_5numpy_ndarray, 1, "sec_vza", 0))) __PYX_ERR(0, 121, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bt11), __pyx_ptype_5numpy_ndarray, 1, "bt11", 0))) __PYX_ERR(0, 121, __pyx_L1_error)
  __pyx_r = __pyx_pf_14ancillary_data_10py_cithr(__pyx_self, __pyx_v_key, __pyx_v_sec_vza, __pyx_v_bt11);
Paolo Veglio's avatar
Paolo Veglio committed

  /* function exit code */
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_L1_error:;
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_14ancillary_data_10py_cithr(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_key, PyArrayObject *__pyx_v_sec_vza, PyArrayObject *__pyx_v_bt11) {
  PyArrayObject *__pyx_v_tci_thr = 0;
  npy_intp __pyx_v_i;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bt11;
  __Pyx_Buffer __pyx_pybuffer_bt11;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sec_vza;
  __Pyx_Buffer __pyx_pybuffer_sec_vza;
Paolo Veglio's avatar
Paolo Veglio committed
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  npy_intp __pyx_t_6;
  npy_intp __pyx_t_7;
  npy_intp __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
Paolo Veglio's avatar
Paolo Veglio committed
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("py_cithr", 0);
  __pyx_pybuffer_sec_vza.pybuffer.buf = NULL;
  __pyx_pybuffer_sec_vza.refcount = 0;
  __pyx_pybuffernd_sec_vza.data = NULL;
  __pyx_pybuffernd_sec_vza.rcbuffer = &__pyx_pybuffer_sec_vza;
  __pyx_pybuffer_bt11.pybuffer.buf = NULL;
  __pyx_pybuffer_bt11.refcount = 0;
  __pyx_pybuffernd_bt11.data = NULL;
  __pyx_pybuffernd_bt11.rcbuffer = &__pyx_pybuffer_bt11;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sec_vza.rcbuffer->pybuffer, (PyObject*)__pyx_v_sec_vza, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 121, __pyx_L1_error)
  }
  __pyx_pybuffernd_sec_vza.diminfo[0].strides = __pyx_pybuffernd_sec_vza.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sec_vza.diminfo[0].shape = __pyx_pybuffernd_sec_vza.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bt11.rcbuffer->pybuffer, (PyObject*)__pyx_v_bt11, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 121, __pyx_L1_error)
  }
  __pyx_pybuffernd_bt11.diminfo[0].strides = __pyx_pybuffernd_bt11.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bt11.diminfo[0].shape = __pyx_pybuffernd_bt11.rcbuffer->pybuffer.shape[0];
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":123
 * def py_cithr(int key, np.ndarray[float, ndim=1] sec_vza, np.ndarray[float, ndim=1] bt11):
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     cdef np.ndarray tci_thr = np.zeros((bt11.shape[0], ), order='C', dtype=np.float)             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     for i in range(bt11.shape[0]):
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_bt11->dimensions[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_u_C) < 0) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 123, __pyx_L1_error)
  __pyx_v_tci_thr = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":125
 *     cdef np.ndarray tci_thr = np.zeros((bt11.shape[0], ), order='C', dtype=np.float)
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     for i in range(bt11.shape[0]):             # <<<<<<<<<<<<<<
 *         tci_thr[i] = cithr(key, sec_vza[i], bt11[i])
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 */
  __pyx_t_6 = (__pyx_v_bt11->dimensions[0]);
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;
Paolo Veglio's avatar
Paolo Veglio committed

    /* "ancillary.pyx":126
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     for i in range(bt11.shape[0]):
 *         tci_thr[i] = cithr(key, sec_vza[i], bt11[i])             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 * 
Paolo Veglio's avatar
Paolo Veglio committed
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_5 = PyFloat_FromDouble(cithr(__pyx_v_key, (*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_sec_vza.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_sec_vza.diminfo[0].strides)), (*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_bt11.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_bt11.diminfo[0].strides)))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_tci_thr), __pyx_v_i, __pyx_t_5, npy_intp, 1, __Pyx_PyInt_From_Py_intptr_t, 0, 0, 0) < 0)) __PYX_ERR(0, 126, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":128
 *         tci_thr[i] = cithr(key, sec_vza[i], bt11[i])
 * 
 *     return tci_thr             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_tci_thr));
  __pyx_r = ((PyObject *)__pyx_v_tci_thr);
Paolo Veglio's avatar
Paolo Veglio committed
  goto __pyx_L0;

  /* "ancillary.pyx":121
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
 * def py_cithr(int key, np.ndarray[float, ndim=1] sec_vza, np.ndarray[float, ndim=1] bt11):             # <<<<<<<<<<<<<<
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     cdef np.ndarray tci_thr = np.zeros((bt11.shape[0], ), order='C', dtype=np.float)
Paolo Veglio's avatar
Paolo Veglio committed
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { 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_bt11.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sec_vza.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("ancillary_data.py_cithr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bt11.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sec_vza.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_tci_thr);
Paolo Veglio's avatar
Paolo Veglio committed
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "ancillary.pyx":134
 * @cython.wraparound(False)
 * @cython.initializedcheck(False)
 * def py_check_reg_uniformity(np.ndarray[unsigned char, ndim=2] eco_type, np.ndarray[unsigned char, ndim=2] eco,             # <<<<<<<<<<<<<<
 *                             np.ndarray[float, ndim=2] snowfr,
 *                             np.ndarray[float, ndim=2] icefr, np.ndarray[unsigned char, ndim=2] lsf):
Paolo Veglio's avatar
Paolo Veglio committed
 */

/* Python wrapper */
static PyObject *__pyx_pw_14ancillary_data_13py_check_reg_uniformity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_14ancillary_data_13py_check_reg_uniformity = {"py_check_reg_uniformity", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_14ancillary_data_13py_check_reg_uniformity, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_14ancillary_data_13py_check_reg_uniformity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_eco_type = 0;
  PyArrayObject *__pyx_v_eco = 0;
  PyArrayObject *__pyx_v_snowfr = 0;
  PyArrayObject *__pyx_v_icefr = 0;
  PyArrayObject *__pyx_v_lsf = 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_check_reg_uniformity (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_eco_type,&__pyx_n_s_eco,&__pyx_n_s_snowfr,&__pyx_n_s_icefr,&__pyx_n_s_lsf,0};
    PyObject* values[5] = {0,0,0,0,0};
    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;
        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_eco_type)) != 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_eco)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_check_reg_uniformity", 1, 5, 5, 1); __PYX_ERR(0, 134, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_snowfr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_check_reg_uniformity", 1, 5, 5, 2); __PYX_ERR(0, 134, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_icefr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_check_reg_uniformity", 1, 5, 5, 3); __PYX_ERR(0, 134, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lsf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("py_check_reg_uniformity", 1, 5, 5, 4); __PYX_ERR(0, 134, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_check_reg_uniformity") < 0)) __PYX_ERR(0, 134, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      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);
    }
    __pyx_v_eco_type = ((PyArrayObject *)values[0]);
    __pyx_v_eco = ((PyArrayObject *)values[1]);
    __pyx_v_snowfr = ((PyArrayObject *)values[2]);
    __pyx_v_icefr = ((PyArrayObject *)values[3]);
    __pyx_v_lsf = ((PyArrayObject *)values[4]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("py_check_reg_uniformity", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 134, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("ancillary_data.py_check_reg_uniformity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_eco_type), __pyx_ptype_5numpy_ndarray, 1, "eco_type", 0))) __PYX_ERR(0, 134, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_eco), __pyx_ptype_5numpy_ndarray, 1, "eco", 0))) __PYX_ERR(0, 134, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_snowfr), __pyx_ptype_5numpy_ndarray, 1, "snowfr", 0))) __PYX_ERR(0, 135, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_icefr), __pyx_ptype_5numpy_ndarray, 1, "icefr", 0))) __PYX_ERR(0, 136, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lsf), __pyx_ptype_5numpy_ndarray, 1, "lsf", 0))) __PYX_ERR(0, 136, __pyx_L1_error)
  __pyx_r = __pyx_pf_14ancillary_data_12py_check_reg_uniformity(__pyx_self, __pyx_v_eco_type, __pyx_v_eco, __pyx_v_snowfr, __pyx_v_icefr, __pyx_v_lsf);
Paolo Veglio's avatar
Paolo Veglio committed

  /* function exit code */
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_L1_error:;
Paolo Veglio's avatar
Paolo Veglio committed
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_14ancillary_data_12py_check_reg_uniformity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_eco_type, PyArrayObject *__pyx_v_eco, PyArrayObject *__pyx_v_snowfr, PyArrayObject *__pyx_v_icefr, PyArrayObject *__pyx_v_lsf) {
  int __pyx_v_coast;
  int __pyx_v_land;
  int __pyx_v_water;
  int __pyx_v_loc_uniform;
  int __pyx_v_i;
  int __pyx_v_j;
  PyArrayObject *__pyx_v_coast_r = 0;
  PyArrayObject *__pyx_v_land_r = 0;
  PyArrayObject *__pyx_v_water_r = 0;
  PyArrayObject *__pyx_v_loc_uniform_r = 0;
  __Pyx_memviewslice __pyx_v_coast_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_land_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_water_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_loc_uniform_mv = { 0, 0, { 0 }, { 0 }, { 0 } };
  npy_intp __pyx_v_lines;
  npy_intp __pyx_v_eles;
  long __pyx_v_line_edge;
  long __pyx_v_elem_edge;
  PyObject *__pyx_v_scene_uniformity = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_eco;
  __Pyx_Buffer __pyx_pybuffer_eco;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_eco_type;
  __Pyx_Buffer __pyx_pybuffer_eco_type;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_icefr;
  __Pyx_Buffer __pyx_pybuffer_icefr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lsf;
  __Pyx_Buffer __pyx_pybuffer_lsf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_snowfr;
  __Pyx_Buffer __pyx_pybuffer_snowfr;
Paolo Veglio's avatar
Paolo Veglio committed
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  npy_intp __pyx_t_7;
  npy_intp __pyx_t_8;
  int __pyx_t_9;
  npy_intp __pyx_t_10;
  npy_intp __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  unsigned char __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("py_check_reg_uniformity", 0);
  __pyx_pybuffer_eco_type.pybuffer.buf = NULL;
  __pyx_pybuffer_eco_type.refcount = 0;
  __pyx_pybuffernd_eco_type.data = NULL;
  __pyx_pybuffernd_eco_type.rcbuffer = &__pyx_pybuffer_eco_type;
  __pyx_pybuffer_eco.pybuffer.buf = NULL;
  __pyx_pybuffer_eco.refcount = 0;
  __pyx_pybuffernd_eco.data = NULL;
  __pyx_pybuffernd_eco.rcbuffer = &__pyx_pybuffer_eco;
  __pyx_pybuffer_snowfr.pybuffer.buf = NULL;
  __pyx_pybuffer_snowfr.refcount = 0;
  __pyx_pybuffernd_snowfr.data = NULL;
  __pyx_pybuffernd_snowfr.rcbuffer = &__pyx_pybuffer_snowfr;
  __pyx_pybuffer_icefr.pybuffer.buf = NULL;
  __pyx_pybuffer_icefr.refcount = 0;
  __pyx_pybuffernd_icefr.data = NULL;
  __pyx_pybuffernd_icefr.rcbuffer = &__pyx_pybuffer_icefr;
  __pyx_pybuffer_lsf.pybuffer.buf = NULL;
  __pyx_pybuffer_lsf.refcount = 0;
  __pyx_pybuffernd_lsf.data = NULL;
  __pyx_pybuffernd_lsf.rcbuffer = &__pyx_pybuffer_lsf;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_eco_type.rcbuffer->pybuffer, (PyObject*)__pyx_v_eco_type, &__Pyx_TypeInfo_unsigned_char, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 134, __pyx_L1_error)
  }
  __pyx_pybuffernd_eco_type.diminfo[0].strides = __pyx_pybuffernd_eco_type.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_eco_type.diminfo[0].shape = __pyx_pybuffernd_eco_type.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_eco_type.diminfo[1].strides = __pyx_pybuffernd_eco_type.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_eco_type.diminfo[1].shape = __pyx_pybuffernd_eco_type.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_eco.rcbuffer->pybuffer, (PyObject*)__pyx_v_eco, &__Pyx_TypeInfo_unsigned_char, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 134, __pyx_L1_error)
  }
  __pyx_pybuffernd_eco.diminfo[0].strides = __pyx_pybuffernd_eco.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_eco.diminfo[0].shape = __pyx_pybuffernd_eco.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_eco.diminfo[1].strides = __pyx_pybuffernd_eco.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_eco.diminfo[1].shape = __pyx_pybuffernd_eco.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_snowfr.rcbuffer->pybuffer, (PyObject*)__pyx_v_snowfr, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 134, __pyx_L1_error)
  }
  __pyx_pybuffernd_snowfr.diminfo[0].strides = __pyx_pybuffernd_snowfr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_snowfr.diminfo[0].shape = __pyx_pybuffernd_snowfr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_snowfr.diminfo[1].strides = __pyx_pybuffernd_snowfr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_snowfr.diminfo[1].shape = __pyx_pybuffernd_snowfr.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_icefr.rcbuffer->pybuffer, (PyObject*)__pyx_v_icefr, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 134, __pyx_L1_error)
  }
  __pyx_pybuffernd_icefr.diminfo[0].strides = __pyx_pybuffernd_icefr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_icefr.diminfo[0].shape = __pyx_pybuffernd_icefr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_icefr.diminfo[1].strides = __pyx_pybuffernd_icefr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_icefr.diminfo[1].shape = __pyx_pybuffernd_icefr.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lsf.rcbuffer->pybuffer, (PyObject*)__pyx_v_lsf, &__Pyx_TypeInfo_unsigned_char, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 134, __pyx_L1_error)
  }
  __pyx_pybuffernd_lsf.diminfo[0].strides = __pyx_pybuffernd_lsf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lsf.diminfo[0].shape = __pyx_pybuffernd_lsf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lsf.diminfo[1].strides = __pyx_pybuffernd_lsf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lsf.diminfo[1].shape = __pyx_pybuffernd_lsf.rcbuffer->pybuffer.shape[1];
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":141
 *     cdef int i, j
Paolo Veglio's avatar
Paolo Veglio committed
 * 
 *     cdef np.ndarray coast_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray land_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
 *     cdef np.ndarray water_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_eco_type->dimensions[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_eco_type->dimensions[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_u_C) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 141, __pyx_L1_error)
  __pyx_v_coast_r = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":142
 * 
 *     cdef np.ndarray coast_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
 *     cdef np.ndarray land_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray water_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
 *     cdef np.ndarray loc_uniform_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
Paolo Veglio's avatar
Paolo Veglio committed
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_eco_type->dimensions[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_eco_type->dimensions[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __pyx_t_5 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_u_C) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 142, __pyx_L1_error)
  __pyx_v_land_r = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
Paolo Veglio's avatar
Paolo Veglio committed

  /* "ancillary.pyx":143
 *     cdef np.ndarray coast_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
 *     cdef np.ndarray land_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
 *     cdef np.ndarray water_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)             # <<<<<<<<<<<<<<
 *     cdef np.ndarray loc_uniform_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
 *     cdef int[:, ::1] coast_mv = coast_r
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_eco_type->dimensions[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_eco_type->dimensions[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_u_C) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 143, __pyx_L1_error)
  __pyx_v_water_r = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "ancillary.pyx":144
 *     cdef np.ndarray land_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
 *     cdef np.ndarray water_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)
 *     cdef np.ndarray loc_uniform_r = np.zeros((eco_type.shape[0], eco_type.shape[1]), order='C', dtype=np.int32)             # <<<<<<<<<<<<<<
 *     cdef int[:, ::1] coast_mv = coast_r
 *     cdef int[:, ::1] land_mv = land_r
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;