From 8bd259d4de401707d537f07269d386e81b0d3881 Mon Sep 17 00:00:00 2001 From: Paolo Veglio <paolo.veglio@ssec.wisc.edu> Date: Mon, 11 Jul 2022 20:30:42 +0000 Subject: [PATCH] function to determine scene flags created --- .gitignore | 5 + ancillary.c | 1381 +++++++++++++++++++++------------------------------ scene.py | 206 ++++++-- 3 files changed, 747 insertions(+), 845 deletions(-) diff --git a/.gitignore b/.gitignore index da13992..0d6543d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ *.swp +*.so +conf.npy +viz.py + +build __pycache__ diff --git a/ancillary.c b/ancillary.c index 1814c08..aad7b60 100644 --- a/ancillary.c +++ b/ancillary.c @@ -1540,16 +1540,6 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); @@ -1589,6 +1579,13 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 }; static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); @@ -1600,6 +1597,9 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1763,6 +1763,35 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject /* BufferIndexError.proto */ static void __Pyx_RaiseBufferIndexError(int axis); +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + /* GetTopmostException.proto */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); @@ -1826,35 +1855,6 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/ /* GetAttr.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - /* decode_c_string_utf16.proto */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; @@ -2096,10 +2096,6 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_flo /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(PyObject *, int writable_flag); -/* MemviewDtypeToObject.proto */ -static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp); -static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *obj); - /* RealImag.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -2341,7 +2337,6 @@ extern int __pyx_module_is_main_ancillary_data; int __pyx_module_is_main_ancillary_data = 0; /* Implementation of 'ancillary_data' */ -static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_ImportError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; @@ -2353,6 +2348,7 @@ static PyObject *__pyx_builtin_id; static PyObject *__pyx_builtin_IndexError; static const char __pyx_k_O[] = "O"; static const char __pyx_k_c[] = "c"; +static const char __pyx_k_v[] = "v"; static const char __pyx_k_id[] = "id"; static const char __pyx_k_np[] = "np"; static const char __pyx_k_eco[] = "eco"; @@ -2386,7 +2382,6 @@ static const char __pyx_k_geos2[] = "geos2"; static const char __pyx_k_icefr[] = "icefr"; static const char __pyx_k_numpy[] = "numpy"; static const char __pyx_k_ocnfr[] = "ocnfr"; -static const char __pyx_k_print[] = "print"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_shape[] = "shape"; static const char __pyx_k_start[] = "start"; @@ -2421,6 +2416,8 @@ static const char __pyx_k_sst_file[] = "sst_file"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_geos_cnst[] = "geos_cnst"; +static const char __pyx_k_geos_data[] = "geos_data"; +static const char __pyx_k_geos_dict[] = "geos_dict"; static const char __pyx_k_landicefr[] = "landicefr"; static const char __pyx_k_ndvi_file[] = "ndvi_file"; static const char __pyx_k_pyx_state[] = "__pyx_state"; @@ -2533,17 +2530,19 @@ static PyObject *__pyx_n_u_fortran; static PyObject *__pyx_n_s_geos1; static PyObject *__pyx_n_s_geos2; static PyObject *__pyx_n_s_geos_cnst; +static PyObject *__pyx_n_s_geos_data; +static PyObject *__pyx_n_s_geos_dict; static PyObject *__pyx_n_s_geos_lnd; static PyObject *__pyx_n_s_geos_ocn; static PyObject *__pyx_n_s_getstate; static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi; -static PyObject *__pyx_n_s_icefr; +static PyObject *__pyx_n_u_icefr; static PyObject *__pyx_n_s_icefr_mv; static PyObject *__pyx_n_s_id; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_itemsize; static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; -static PyObject *__pyx_n_s_landicefr; +static PyObject *__pyx_n_u_landicefr; static PyObject *__pyx_n_s_landicefr_mv; static PyObject *__pyx_n_s_lat; static PyObject *__pyx_n_s_lon; @@ -2563,11 +2562,10 @@ static PyObject *__pyx_n_s_numpy; static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to; static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor; static PyObject *__pyx_n_s_obj; -static PyObject *__pyx_n_s_ocnfr; +static PyObject *__pyx_n_u_ocnfr; static PyObject *__pyx_n_s_ocnfr_mv; static PyObject *__pyx_n_s_pack; static PyObject *__pyx_n_s_pickle; -static PyObject *__pyx_n_s_print; static PyObject *__pyx_n_s_py_get_GEOS; static PyObject *__pyx_n_s_py_get_NDVI_background; static PyObject *__pyx_n_s_py_get_Olson_eco; @@ -2586,11 +2584,11 @@ static PyObject *__pyx_n_s_reduce_cython; static PyObject *__pyx_n_s_reduce_ex; static PyObject *__pyx_n_s_setstate; static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_sfct; +static PyObject *__pyx_n_u_sfct; static PyObject *__pyx_n_s_sfct_mv; static PyObject *__pyx_n_s_shape; static PyObject *__pyx_n_s_size; -static PyObject *__pyx_n_s_snowfr; +static PyObject *__pyx_n_u_snowfr; static PyObject *__pyx_n_s_snowfr_mv; static PyObject *__pyx_n_s_sst; static PyObject *__pyx_n_s_sst_file; @@ -2605,16 +2603,17 @@ static PyObject *__pyx_kp_s_strided_and_indirect; static PyObject *__pyx_kp_s_stringsource; static PyObject *__pyx_n_s_struct; static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_tpw; +static PyObject *__pyx_n_u_tpw; static PyObject *__pyx_n_s_tpw_mv; static PyObject *__pyx_kp_s_unable_to_allocate_array_data; static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str; static PyObject *__pyx_n_s_unpack; static PyObject *__pyx_n_s_update; +static PyObject *__pyx_n_s_v; static PyObject *__pyx_pf_14ancillary_data_py_get_Reynolds_SST(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, char *__pyx_v_anc_dir, char *__pyx_v_sst_file, PyObject *__pyx_v_sst); /* proto */ static PyObject *__pyx_pf_14ancillary_data_2py_get_NDVI_background(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, char *__pyx_v_anc_dir, char *__pyx_v_ndvi_file, PyObject *__pyx_v_ndvi); /* proto */ static PyObject *__pyx_pf_14ancillary_data_4py_get_Olson_eco(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, char *__pyx_v_anc_dir, PyObject *__pyx_v_eco); /* proto */ -static PyObject *__pyx_pf_14ancillary_data_6py_get_GEOS(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, 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_tpw, PyObject *__pyx_v_snowfr, PyObject *__pyx_v_icefr, PyObject *__pyx_v_ocnfr, PyObject *__pyx_v_landicefr, PyObject *__pyx_v_sfct); /* proto */ +static PyObject *__pyx_pf_14ancillary_data_6py_get_GEOS(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, 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); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */ @@ -3592,7 +3591,7 @@ static PyObject *__pyx_pf_14ancillary_data_4py_get_Olson_eco(CYTHON_UNUSED PyObj * * def py_get_GEOS(np.ndarray[float, ndim=1] lat, np.ndarray[float, ndim=1] lon, char *startTime, # <<<<<<<<<<<<<< * char *anc_dir, char *geos1, char *geos2, char *geos_lnd, char *geos_ocn, char *geos_cnst, - * tpw, snowfr, icefr, ocnfr, landicefr, sfct): + * geos_data): # tpw, snowfr, icefr, ocnfr, landicefr, sfct): */ /* Python wrapper */ @@ -3608,12 +3607,7 @@ static PyObject *__pyx_pw_14ancillary_data_7py_get_GEOS(PyObject *__pyx_self, Py char *__pyx_v_geos_lnd; char *__pyx_v_geos_ocn; char *__pyx_v_geos_cnst; - PyObject *__pyx_v_tpw = 0; - PyObject *__pyx_v_snowfr = 0; - PyObject *__pyx_v_icefr = 0; - PyObject *__pyx_v_ocnfr = 0; - PyObject *__pyx_v_landicefr = 0; - PyObject *__pyx_v_sfct = 0; + PyObject *__pyx_v_geos_data = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3621,22 +3615,12 @@ static PyObject *__pyx_pw_14ancillary_data_7py_get_GEOS(PyObject *__pyx_self, Py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("py_get_GEOS (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat,&__pyx_n_s_lon,&__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_tpw,&__pyx_n_s_snowfr,&__pyx_n_s_icefr,&__pyx_n_s_ocnfr,&__pyx_n_s_landicefr,&__pyx_n_s_sfct,0}; - PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat,&__pyx_n_s_lon,&__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[10] = {0,0,0,0,0,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 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); - CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - CYTHON_FALLTHROUGH; case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); CYTHON_FALLTHROUGH; case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); @@ -3669,91 +3653,61 @@ static PyObject *__pyx_pw_14ancillary_data_7py_get_GEOS(PyObject *__pyx_self, Py 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, 15, 15, 1); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, 1); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startTime)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 2); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, 2); __PYX_ERR(0, 67, __pyx_L3_error) } 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_GEOS", 1, 15, 15, 3); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, 3); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 4); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, 4); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 5); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, 5); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos_lnd)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 6); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, 6); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos_ocn)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 7); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, 7); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos_cnst)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 8); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, 8); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: - if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tpw)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 9); __PYX_ERR(0, 67, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 10: - if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_snowfr)) != 0)) kw_args--; + if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geos_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 10); __PYX_ERR(0, 67, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 11: - if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_icefr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 11); __PYX_ERR(0, 67, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 12: - if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ocnfr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 12); __PYX_ERR(0, 67, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 13: - if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_landicefr)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 13); __PYX_ERR(0, 67, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 14: - if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sfct)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, 14); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, 9); __PYX_ERR(0, 67, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_get_GEOS") < 0)) __PYX_ERR(0, 67, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 15) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -3766,11 +3720,6 @@ static PyObject *__pyx_pw_14ancillary_data_7py_get_GEOS(PyObject *__pyx_self, Py 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); - values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - values[13] = PyTuple_GET_ITEM(__pyx_args, 13); - values[14] = PyTuple_GET_ITEM(__pyx_args, 14); } __pyx_v_lat = ((PyArrayObject *)values[0]); __pyx_v_lon = ((PyArrayObject *)values[1]); @@ -3781,16 +3730,11 @@ static PyObject *__pyx_pw_14ancillary_data_7py_get_GEOS(PyObject *__pyx_self, Py __pyx_v_geos_lnd = __Pyx_PyObject_AsWritableString(values[6]); if (unlikely((!__pyx_v_geos_lnd) && PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L3_error) __pyx_v_geos_ocn = __Pyx_PyObject_AsWritableString(values[7]); if (unlikely((!__pyx_v_geos_ocn) && PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L3_error) __pyx_v_geos_cnst = __Pyx_PyObject_AsWritableString(values[8]); if (unlikely((!__pyx_v_geos_cnst) && PyErr_Occurred())) __PYX_ERR(0, 68, __pyx_L3_error) - __pyx_v_tpw = values[9]; - __pyx_v_snowfr = values[10]; - __pyx_v_icefr = values[11]; - __pyx_v_ocnfr = values[12]; - __pyx_v_landicefr = values[13]; - __pyx_v_sfct = values[14]; + __pyx_v_geos_data = values[9]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 15, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("py_get_GEOS", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 67, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("ancillary_data.py_get_GEOS", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3798,7 +3742,7 @@ static PyObject *__pyx_pw_14ancillary_data_7py_get_GEOS(PyObject *__pyx_self, Py __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5numpy_ndarray, 1, "lat", 0))) __PYX_ERR(0, 67, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lon), __pyx_ptype_5numpy_ndarray, 1, "lon", 0))) __PYX_ERR(0, 67, __pyx_L1_error) - __pyx_r = __pyx_pf_14ancillary_data_6py_get_GEOS(__pyx_self, __pyx_v_lat, __pyx_v_lon, __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_tpw, __pyx_v_snowfr, __pyx_v_icefr, __pyx_v_ocnfr, __pyx_v_landicefr, __pyx_v_sfct); + __pyx_r = __pyx_pf_14ancillary_data_6py_get_GEOS(__pyx_self, __pyx_v_lat, __pyx_v_lon, __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); /* function exit code */ goto __pyx_L0; @@ -3809,13 +3753,15 @@ static PyObject *__pyx_pw_14ancillary_data_7py_get_GEOS(PyObject *__pyx_self, Py 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, 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_tpw, PyObject *__pyx_v_snowfr, PyObject *__pyx_v_icefr, PyObject *__pyx_v_ocnfr, PyObject *__pyx_v_landicefr, PyObject *__pyx_v_sfct) { +static PyObject *__pyx_pf_14ancillary_data_6py_get_GEOS(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, 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; __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; __Pyx_LocalBuf_ND __pyx_pybuffernd_lat; __Pyx_Buffer __pyx_pybuffer_lat; __Pyx_LocalBuf_ND __pyx_pybuffernd_lon; @@ -3823,30 +3769,28 @@ static PyObject *__pyx_pf_14ancillary_data_6py_get_GEOS(CYTHON_UNUSED PyObject * PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } }; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; + 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 } }; Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; + int __pyx_t_12; 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; + Py_ssize_t __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("py_get_GEOS", 0); - __Pyx_INCREF(__pyx_v_tpw); - __Pyx_INCREF(__pyx_v_snowfr); - __Pyx_INCREF(__pyx_v_icefr); - __Pyx_INCREF(__pyx_v_ocnfr); - __Pyx_INCREF(__pyx_v_landicefr); - __Pyx_INCREF(__pyx_v_sfct); __pyx_pybuffer_lat.pybuffer.buf = NULL; __pyx_pybuffer_lat.refcount = 0; __pyx_pybuffernd_lat.data = NULL; @@ -3866,564 +3810,406 @@ static PyObject *__pyx_pf_14ancillary_data_6py_get_GEOS(CYTHON_UNUSED PyObject * } __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":75 - * # if not geos_data[v].flags['C_CONTIGUOUS']: - * # geos_data[v] = np.ascontiguousarray(geos_data[v]) - * if not tpw.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * tpw = np.ascontiguousarray(tpw) - * if not snowfr.flags['C_CONTIGUOUS']: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tpw, __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) - __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, 75, __pyx_L1_error) - __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, 75, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = ((!__pyx_t_3) != 0); - if (__pyx_t_4) { - - /* "ancillary.pyx":76 - * # geos_data[v] = np.ascontiguousarray(geos_data[v]) - * if not tpw.flags['C_CONTIGUOUS']: - * tpw = np.ascontiguousarray(tpw) # <<<<<<<<<<<<<< - * if not snowfr.flags['C_CONTIGUOUS']: - * snowfr = np.ascontiguousarray(snowfr) + /* "ancillary.pyx":71 + * geos_data): # tpw, snowfr, icefr, ocnfr, landicefr, sfct): + * + * for v in geos_data: # <<<<<<<<<<<<<< + * if not geos_data[v].flags['C_CONTIGUOUS']: + * geos_data[v] = np.ascontiguousarray(geos_data[v]) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) + 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, 71, __pyx_L1_error) __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, 76, __pyx_L1_error) - __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_tpw) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_tpw); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_tpw, __pyx_t_2); - __pyx_t_2 = 0; - - /* "ancillary.pyx":75 - * # if not geos_data[v].flags['C_CONTIGUOUS']: - * # geos_data[v] = np.ascontiguousarray(geos_data[v]) - * if not tpw.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * tpw = np.ascontiguousarray(tpw) - * if not snowfr.flags['C_CONTIGUOUS']: - */ + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) } - - /* "ancillary.pyx":77 - * if not tpw.flags['C_CONTIGUOUS']: - * tpw = np.ascontiguousarray(tpw) - * if not snowfr.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * snowfr = np.ascontiguousarray(snowfr) - * if not icefr.flags['C_CONTIGUOUS']: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_snowfr, __pyx_n_s_flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_C_CONTIGUOUS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = ((!__pyx_t_4) != 0); - if (__pyx_t_3) { - - /* "ancillary.pyx":78 - * tpw = np.ascontiguousarray(tpw) - * if not snowfr.flags['C_CONTIGUOUS']: - * snowfr = np.ascontiguousarray(snowfr) # <<<<<<<<<<<<<< - * if not icefr.flags['C_CONTIGUOUS']: - * icefr = np.ascontiguousarray(icefr) - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + 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, 71, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __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, 71, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif } - } - __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_snowfr) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_snowfr); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_snowfr, __pyx_t_5); - __pyx_t_5 = 0; - - /* "ancillary.pyx":77 - * if not tpw.flags['C_CONTIGUOUS']: - * tpw = np.ascontiguousarray(tpw) - * if not snowfr.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * snowfr = np.ascontiguousarray(snowfr) - * if not icefr.flags['C_CONTIGUOUS']: - */ - } - - /* "ancillary.pyx":79 - * if not snowfr.flags['C_CONTIGUOUS']: - * snowfr = np.ascontiguousarray(snowfr) - * if not icefr.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * icefr = np.ascontiguousarray(icefr) - * if not ocnfr.flags['C_CONTIGUOUS']: - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_icefr, __pyx_n_s_flags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_C_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = ((!__pyx_t_3) != 0); - if (__pyx_t_4) { - - /* "ancillary.pyx":80 - * snowfr = np.ascontiguousarray(snowfr) - * if not icefr.flags['C_CONTIGUOUS']: - * icefr = np.ascontiguousarray(icefr) # <<<<<<<<<<<<<< - * if not ocnfr.flags['C_CONTIGUOUS']: - * ocnfr = np.ascontiguousarray(ocnfr) - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + } 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, 71, __pyx_L1_error) + } + break; } + __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_icefr) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_icefr); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_icefr, __pyx_t_1); - __pyx_t_1 = 0; - - /* "ancillary.pyx":79 - * if not snowfr.flags['C_CONTIGUOUS']: - * snowfr = np.ascontiguousarray(snowfr) - * if not icefr.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * icefr = np.ascontiguousarray(icefr) - * if not ocnfr.flags['C_CONTIGUOUS']: - */ - } - - /* "ancillary.pyx":81 - * if not icefr.flags['C_CONTIGUOUS']: - * icefr = np.ascontiguousarray(icefr) - * if not ocnfr.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * ocnfr = np.ascontiguousarray(ocnfr) - * if not landicefr.flags['C_CONTIGUOUS']: - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_ocnfr, __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) - __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, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = ((!__pyx_t_4) != 0); - if (__pyx_t_3) { + __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4); + __pyx_t_4 = 0; - /* "ancillary.pyx":82 - * icefr = np.ascontiguousarray(icefr) - * if not ocnfr.flags['C_CONTIGUOUS']: - * ocnfr = np.ascontiguousarray(ocnfr) # <<<<<<<<<<<<<< - * if not landicefr.flags['C_CONTIGUOUS']: - * landicefr = np.ascontiguousarray(landicefr) + /* "ancillary.pyx":72 + * + * for v in geos_data: + * if not geos_data[v].flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< + * geos_data[v] = np.ascontiguousarray(geos_data[v]) + * # if not tpw.flags['C_CONTIGUOUS']: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __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, 82, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_geos_data, __pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __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, 72, __pyx_L1_error) __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_ocnfr) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_ocnfr); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __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, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF_SET(__pyx_v_ocnfr, __pyx_t_2); - __pyx_t_2 = 0; - - /* "ancillary.pyx":81 - * if not icefr.flags['C_CONTIGUOUS']: - * icefr = np.ascontiguousarray(icefr) - * if not ocnfr.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * ocnfr = np.ascontiguousarray(ocnfr) - * if not landicefr.flags['C_CONTIGUOUS']: - */ - } + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = ((!__pyx_t_6) != 0); + if (__pyx_t_7) { - /* "ancillary.pyx":83 - * if not ocnfr.flags['C_CONTIGUOUS']: - * ocnfr = np.ascontiguousarray(ocnfr) - * if not landicefr.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * landicefr = np.ascontiguousarray(landicefr) - * if not sfct.flags['C_CONTIGUOUS']: + /* "ancillary.pyx":73 + * for v in geos_data: + * if not geos_data[v].flags['C_CONTIGUOUS']: + * geos_data[v] = np.ascontiguousarray(geos_data[v]) # <<<<<<<<<<<<<< + * # if not tpw.flags['C_CONTIGUOUS']: + * # tpw = np.ascontiguousarray(tpw) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_landicefr, __pyx_n_s_flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_C_CONTIGUOUS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = ((!__pyx_t_3) != 0); - if (__pyx_t_4) { + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __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, 73, __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, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { + __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, 73, __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, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ancillary.pyx":84 - * ocnfr = np.ascontiguousarray(ocnfr) - * if not landicefr.flags['C_CONTIGUOUS']: - * landicefr = np.ascontiguousarray(landicefr) # <<<<<<<<<<<<<< - * if not sfct.flags['C_CONTIGUOUS']: - * sfct = np.ascontiguousarray(sfct) + /* "ancillary.pyx":72 + * + * for v in geos_data: + * if not geos_data[v].flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< + * geos_data[v] = np.ascontiguousarray(geos_data[v]) + * # if not tpw.flags['C_CONTIGUOUS']: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } } - __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_landicefr) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_landicefr); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_landicefr, __pyx_t_5); - __pyx_t_5 = 0; - /* "ancillary.pyx":83 - * if not ocnfr.flags['C_CONTIGUOUS']: - * ocnfr = np.ascontiguousarray(ocnfr) - * if not landicefr.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * landicefr = np.ascontiguousarray(landicefr) - * if not sfct.flags['C_CONTIGUOUS']: + /* "ancillary.pyx":71 + * geos_data): # tpw, snowfr, icefr, ocnfr, landicefr, sfct): + * + * for v in geos_data: # <<<<<<<<<<<<<< + * if not geos_data[v].flags['C_CONTIGUOUS']: + * geos_data[v] = np.ascontiguousarray(geos_data[v]) */ } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "ancillary.pyx":85 - * if not landicefr.flags['C_CONTIGUOUS']: - * landicefr = np.ascontiguousarray(landicefr) - * if not sfct.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * sfct = np.ascontiguousarray(sfct) + /* "ancillary.pyx":87 + * # sfct = np.ascontiguousarray(sfct) * + * cdef float[::1] tpw_mv = geos_data['tpw'] # <<<<<<<<<<<<<< + * cdef float[::1] snowfr_mv = geos_data['snowfr'] + * cdef float[::1] icefr_mv = geos_data['icefr'] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_sfct, __pyx_n_s_flags); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_C_CONTIGUOUS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_tpw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 85, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_4) != 0); - if (__pyx_t_3) { - - /* "ancillary.pyx":86 - * landicefr = np.ascontiguousarray(landicefr) - * if not sfct.flags['C_CONTIGUOUS']: - * sfct = np.ascontiguousarray(sfct) # <<<<<<<<<<<<<< - * - * cdef float[::1] tpw_mv = tpw # geos_data['tpw'] - */ - __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_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_sfct) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sfct); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_sfct, __pyx_t_1); - __pyx_t_1 = 0; - - /* "ancillary.pyx":85 - * if not landicefr.flags['C_CONTIGUOUS']: - * landicefr = np.ascontiguousarray(landicefr) - * if not sfct.flags['C_CONTIGUOUS']: # <<<<<<<<<<<<<< - * sfct = np.ascontiguousarray(sfct) - * - */ - } + __pyx_v_tpw_mv = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; /* "ancillary.pyx":88 - * sfct = np.ascontiguousarray(sfct) * - * cdef float[::1] tpw_mv = tpw # geos_data['tpw'] # <<<<<<<<<<<<<< - * cdef float[::1] snowfr_mv = snowfr # geos_data['snowfr'] - * cdef float[::1] icefr_mv = icefr # geos_data['icefr'] + * 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'] */ - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_v_tpw, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 88, __pyx_L1_error) - __pyx_v_tpw_mv = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_snowfr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __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, 88, __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; /* "ancillary.pyx":89 - * - * cdef float[::1] tpw_mv = tpw # geos_data['tpw'] - * cdef float[::1] snowfr_mv = snowfr # geos_data['snowfr'] # <<<<<<<<<<<<<< - * cdef float[::1] icefr_mv = icefr # geos_data['icefr'] - * cdef float[::1] ocnfr_mv = ocnfr # geos_data['geos_ocnfr'] + * 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'] */ - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_v_snowfr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 89, __pyx_L1_error) - __pyx_v_snowfr_mv = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_icefr); 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_icefr_mv = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; /* "ancillary.pyx":90 - * cdef float[::1] tpw_mv = tpw # geos_data['tpw'] - * cdef float[::1] snowfr_mv = snowfr # geos_data['snowfr'] - * cdef float[::1] icefr_mv = icefr # geos_data['icefr'] # <<<<<<<<<<<<<< - * cdef float[::1] ocnfr_mv = ocnfr # geos_data['geos_ocnfr'] - * cdef float[::1] landicefr_mv = landicefr # geos_data['landicefr'] - */ - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_v_icefr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 90, __pyx_L1_error) - __pyx_v_icefr_mv = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + * 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, 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_ocnfr_mv = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; /* "ancillary.pyx":91 - * cdef float[::1] snowfr_mv = snowfr # geos_data['snowfr'] - * cdef float[::1] icefr_mv = icefr # geos_data['icefr'] - * cdef float[::1] ocnfr_mv = ocnfr # geos_data['geos_ocnfr'] # <<<<<<<<<<<<<< - * cdef float[::1] landicefr_mv = landicefr # geos_data['landicefr'] - * cdef float[::1] sfct_mv = sfct # geos_data['sfct'] - */ - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_v_ocnfr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 91, __pyx_L1_error) - __pyx_v_ocnfr_mv = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - - /* "ancillary.pyx":92 - * cdef float[::1] icefr_mv = icefr # geos_data['icefr'] - * cdef float[::1] ocnfr_mv = ocnfr # geos_data['geos_ocnfr'] - * cdef float[::1] landicefr_mv = landicefr # geos_data['landicefr'] # <<<<<<<<<<<<<< - * cdef float[::1] sfct_mv = sfct # geos_data['sfct'] + * 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_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_v_landicefr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 92, __pyx_L1_error) - __pyx_v_landicefr_mv = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_landicefr); 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_landicefr_mv = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "ancillary.pyx":93 - * cdef float[::1] ocnfr_mv = ocnfr # geos_data['geos_ocnfr'] - * cdef float[::1] landicefr_mv = landicefr # geos_data['landicefr'] - * cdef float[::1] sfct_mv = sfct # geos_data['sfct'] # <<<<<<<<<<<<<< + /* "ancillary.pyx":92 + * cdef float[::1] ocnfr_mv = geos_data['ocnfr'] + * cdef float[::1] landicefr_mv = geos_data['landicefr'] + * cdef float[::1] sfct_mv = geos_data['sfct'] # <<<<<<<<<<<<<< * * get_GEOS(&lat[0], &lon[0], startTime, anc_dir, geos1, geos2, geos_lnd, geos_ocn, geos_cnst, */ - __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_v_sfct, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 93, __pyx_L1_error) - __pyx_v_sfct_mv = __pyx_t_6; - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_sfct); 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_sfct_mv = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; - /* "ancillary.pyx":95 - * cdef float[::1] sfct_mv = sfct # geos_data['sfct'] + /* "ancillary.pyx":94 + * cdef float[::1] sfct_mv = geos_data['sfct'] * * get_GEOS(&lat[0], &lon[0], startTime, anc_dir, geos1, geos2, geos_lnd, geos_ocn, geos_cnst, # <<<<<<<<<<<<<< * &tpw_mv[0], &snowfr_mv[0], &icefr_mv[0], &ocnfr_mv[0], &landicefr_mv[0], &sfct_mv[0]) * */ - __pyx_t_7 = 0; - __pyx_t_8 = -1; - if (__pyx_t_7 < 0) { - __pyx_t_7 += __pyx_pybuffernd_lat.diminfo[0].shape; - if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_lat.diminfo[0].shape)) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_11 = 0; + __pyx_t_12 = -1; + if (__pyx_t_11 < 0) { + __pyx_t_11 += __pyx_pybuffernd_lat.diminfo[0].shape; + if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_lat.diminfo[0].shape)) __pyx_t_12 = 0; + if (unlikely(__pyx_t_12 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_12); + __PYX_ERR(0, 94, __pyx_L1_error) } - __pyx_t_9 = 0; - __pyx_t_8 = -1; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_pybuffernd_lon.diminfo[0].shape; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_lon.diminfo[0].shape)) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_13 = 0; + __pyx_t_12 = -1; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_pybuffernd_lon.diminfo[0].shape; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_12 = 0; + } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_lon.diminfo[0].shape)) __pyx_t_12 = 0; + if (unlikely(__pyx_t_12 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_12); + __PYX_ERR(0, 94, __pyx_L1_error) } - /* "ancillary.pyx":96 + /* "ancillary.pyx":95 * * get_GEOS(&lat[0], &lon[0], startTime, anc_dir, geos1, geos2, geos_lnd, geos_ocn, geos_cnst, * &tpw_mv[0], &snowfr_mv[0], &icefr_mv[0], &ocnfr_mv[0], &landicefr_mv[0], &sfct_mv[0]) # <<<<<<<<<<<<<< * - * # geos_dict = {'tpw': geos_data['tpw'], + * geos_dict = {'tpw': geos_data['tpw'], */ - __pyx_t_10 = 0; - __pyx_t_8 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_v_tpw_mv.shape[0]; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_v_tpw_mv.shape[0])) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - __PYX_ERR(0, 96, __pyx_L1_error) - } - __pyx_t_11 = 0; - __pyx_t_8 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_v_snowfr_mv.shape[0]; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_v_snowfr_mv.shape[0])) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - __PYX_ERR(0, 96, __pyx_L1_error) - } - __pyx_t_12 = 0; - __pyx_t_8 = -1; - if (__pyx_t_12 < 0) { - __pyx_t_12 += __pyx_v_icefr_mv.shape[0]; - if (unlikely(__pyx_t_12 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_12 >= __pyx_v_icefr_mv.shape[0])) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - __PYX_ERR(0, 96, __pyx_L1_error) - } - __pyx_t_13 = 0; - __pyx_t_8 = -1; - if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_v_ocnfr_mv.shape[0]; - if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_v_ocnfr_mv.shape[0])) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - __PYX_ERR(0, 96, __pyx_L1_error) - } __pyx_t_14 = 0; - __pyx_t_8 = -1; + __pyx_t_12 = -1; if (__pyx_t_14 < 0) { - __pyx_t_14 += __pyx_v_landicefr_mv.shape[0]; - if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_14 >= __pyx_v_landicefr_mv.shape[0])) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_14 += __pyx_v_tpw_mv.shape[0]; + if (unlikely(__pyx_t_14 < 0)) __pyx_t_12 = 0; + } else if (unlikely(__pyx_t_14 >= __pyx_v_tpw_mv.shape[0])) __pyx_t_12 = 0; + if (unlikely(__pyx_t_12 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_12); + __PYX_ERR(0, 95, __pyx_L1_error) } __pyx_t_15 = 0; - __pyx_t_8 = -1; + __pyx_t_12 = -1; if (__pyx_t_15 < 0) { - __pyx_t_15 += __pyx_v_sfct_mv.shape[0]; - if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_15 >= __pyx_v_sfct_mv.shape[0])) __pyx_t_8 = 0; - if (unlikely(__pyx_t_8 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_8); - __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_15 += __pyx_v_snowfr_mv.shape[0]; + if (unlikely(__pyx_t_15 < 0)) __pyx_t_12 = 0; + } else if (unlikely(__pyx_t_15 >= __pyx_v_snowfr_mv.shape[0])) __pyx_t_12 = 0; + if (unlikely(__pyx_t_12 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_12); + __PYX_ERR(0, 95, __pyx_L1_error) + } + __pyx_t_16 = 0; + __pyx_t_12 = -1; + if (__pyx_t_16 < 0) { + __pyx_t_16 += __pyx_v_icefr_mv.shape[0]; + if (unlikely(__pyx_t_16 < 0)) __pyx_t_12 = 0; + } else if (unlikely(__pyx_t_16 >= __pyx_v_icefr_mv.shape[0])) __pyx_t_12 = 0; + if (unlikely(__pyx_t_12 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_12); + __PYX_ERR(0, 95, __pyx_L1_error) + } + __pyx_t_17 = 0; + __pyx_t_12 = -1; + if (__pyx_t_17 < 0) { + __pyx_t_17 += __pyx_v_ocnfr_mv.shape[0]; + if (unlikely(__pyx_t_17 < 0)) __pyx_t_12 = 0; + } else if (unlikely(__pyx_t_17 >= __pyx_v_ocnfr_mv.shape[0])) __pyx_t_12 = 0; + if (unlikely(__pyx_t_12 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_12); + __PYX_ERR(0, 95, __pyx_L1_error) + } + __pyx_t_18 = 0; + __pyx_t_12 = -1; + if (__pyx_t_18 < 0) { + __pyx_t_18 += __pyx_v_landicefr_mv.shape[0]; + if (unlikely(__pyx_t_18 < 0)) __pyx_t_12 = 0; + } else if (unlikely(__pyx_t_18 >= __pyx_v_landicefr_mv.shape[0])) __pyx_t_12 = 0; + if (unlikely(__pyx_t_12 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_12); + __PYX_ERR(0, 95, __pyx_L1_error) + } + __pyx_t_19 = 0; + __pyx_t_12 = -1; + if (__pyx_t_19 < 0) { + __pyx_t_19 += __pyx_v_sfct_mv.shape[0]; + if (unlikely(__pyx_t_19 < 0)) __pyx_t_12 = 0; + } else if (unlikely(__pyx_t_19 >= __pyx_v_sfct_mv.shape[0])) __pyx_t_12 = 0; + if (unlikely(__pyx_t_12 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_12); + __PYX_ERR(0, 95, __pyx_L1_error) } - /* "ancillary.pyx":95 - * cdef float[::1] sfct_mv = sfct # geos_data['sfct'] + /* "ancillary.pyx":94 + * cdef float[::1] sfct_mv = geos_data['sfct'] * * get_GEOS(&lat[0], &lon[0], startTime, anc_dir, geos1, geos2, geos_lnd, geos_ocn, geos_cnst, # <<<<<<<<<<<<<< * &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_7, __pyx_pybuffernd_lat.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_lon.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_lon.diminfo[0].strides))), __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_10)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_snowfr_mv.data) + __pyx_t_11)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_icefr_mv.data) + __pyx_t_12)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_ocnfr_mv.data) + __pyx_t_13)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_landicefr_mv.data) + __pyx_t_14)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_sfct_mv.data) + __pyx_t_15)) ))))); + 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_13, __pyx_pybuffernd_lon.diminfo[0].strides))), __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_14)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_snowfr_mv.data) + __pyx_t_15)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_icefr_mv.data) + __pyx_t_16)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_ocnfr_mv.data) + __pyx_t_17)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_landicefr_mv.data) + __pyx_t_18)) )))), (&(*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_sfct_mv.data) + __pyx_t_19)) ))))); - /* "ancillary.pyx":112 - * # 'sfct': sfct - * # } - * print(tpw_mv[:10]) # <<<<<<<<<<<<<< - * return tpw + /* "ancillary.pyx":97 + * &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'], */ - __pyx_t_6.data = __pyx_v_tpw_mv.data; - __pyx_t_6.memview = __pyx_v_tpw_mv.memview; - __PYX_INC_MEMVIEW(&__pyx_t_6, 0); - __pyx_t_8 = -1; - if (unlikely(__pyx_memoryview_slice_memviewslice( - &__pyx_t_6, - __pyx_v_tpw_mv.shape[0], __pyx_v_tpw_mv.strides[0], __pyx_v_tpw_mv.suboffsets[0], - 0, - 0, - &__pyx_t_8, - 0, - 10, - 0, - 0, - 1, - 0, - 1) < 0)) -{ - __PYX_ERR(0, 112, __pyx_L1_error) -} - -__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); - __pyx_t_6.memview = NULL; - __pyx_t_6.data = NULL; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_tpw); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __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, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ancillary.pyx":113 + /* "ancillary.pyx":98 + * + * 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, 98, __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, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "ancillary.pyx":99 + * 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, 99, __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, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "ancillary.pyx":100 + * '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, 100, __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, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "ancillary.pyx":101 + * '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, 101, __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, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "ancillary.pyx":102 + * 'ocnfr': geos_data['ocnfr'], + * 'landicefr': geos_data['landicefr'], + * 'sfct': geos_data['sfct'] # <<<<<<<<<<<<<< + * } + * # geos_dict = {'tpw': tpw, + */ + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geos_data, __pyx_n_u_sfct); 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_sfct, __pyx_t_4) < 0) __PYX_ERR(0, 97, __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":112 * # } - * print(tpw_mv[:10]) - * return tpw # <<<<<<<<<<<<<< + * + * return geos_dict # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_tpw); - __pyx_r = __pyx_v_tpw; + __Pyx_INCREF(__pyx_v_geos_dict); + __pyx_r = __pyx_v_geos_dict; goto __pyx_L0; /* "ancillary.pyx":67 @@ -4431,15 +4217,17 @@ __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __p * * def py_get_GEOS(np.ndarray[float, ndim=1] lat, np.ndarray[float, ndim=1] lon, char *startTime, # <<<<<<<<<<<<<< * char *anc_dir, char *geos1, char *geos2, char *geos_lnd, char *geos_ocn, char *geos_cnst, - * tpw, snowfr, icefr, ocnfr, landicefr, sfct): + * geos_data): # tpw, snowfr, icefr, ocnfr, landicefr, sfct): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -4454,18 +4242,14 @@ __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_t_6, 1, (PyObject *(*)(char *)) __p __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lat.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lon.rcbuffer->pybuffer); __pyx_L2:; + __Pyx_XDECREF(__pyx_v_v); __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_tpw); - __Pyx_XDECREF(__pyx_v_snowfr); - __Pyx_XDECREF(__pyx_v_icefr); - __Pyx_XDECREF(__pyx_v_ocnfr); - __Pyx_XDECREF(__pyx_v_landicefr); - __Pyx_XDECREF(__pyx_v_sfct); + __Pyx_XDECREF(__pyx_v_geos_dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -19332,17 +19116,19 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_geos1, __pyx_k_geos1, sizeof(__pyx_k_geos1), 0, 0, 1, 1}, {&__pyx_n_s_geos2, __pyx_k_geos2, sizeof(__pyx_k_geos2), 0, 0, 1, 1}, {&__pyx_n_s_geos_cnst, __pyx_k_geos_cnst, sizeof(__pyx_k_geos_cnst), 0, 0, 1, 1}, + {&__pyx_n_s_geos_data, __pyx_k_geos_data, sizeof(__pyx_k_geos_data), 0, 0, 1, 1}, + {&__pyx_n_s_geos_dict, __pyx_k_geos_dict, sizeof(__pyx_k_geos_dict), 0, 0, 1, 1}, {&__pyx_n_s_geos_lnd, __pyx_k_geos_lnd, sizeof(__pyx_k_geos_lnd), 0, 0, 1, 1}, {&__pyx_n_s_geos_ocn, __pyx_k_geos_ocn, sizeof(__pyx_k_geos_ocn), 0, 0, 1, 1}, {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, - {&__pyx_n_s_icefr, __pyx_k_icefr, sizeof(__pyx_k_icefr), 0, 0, 1, 1}, + {&__pyx_n_u_icefr, __pyx_k_icefr, sizeof(__pyx_k_icefr), 0, 1, 0, 1}, {&__pyx_n_s_icefr_mv, __pyx_k_icefr_mv, sizeof(__pyx_k_icefr_mv), 0, 0, 1, 1}, {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, - {&__pyx_n_s_landicefr, __pyx_k_landicefr, sizeof(__pyx_k_landicefr), 0, 0, 1, 1}, + {&__pyx_n_u_landicefr, __pyx_k_landicefr, sizeof(__pyx_k_landicefr), 0, 1, 0, 1}, {&__pyx_n_s_landicefr_mv, __pyx_k_landicefr_mv, sizeof(__pyx_k_landicefr_mv), 0, 0, 1, 1}, {&__pyx_n_s_lat, __pyx_k_lat, sizeof(__pyx_k_lat), 0, 0, 1, 1}, {&__pyx_n_s_lon, __pyx_k_lon, sizeof(__pyx_k_lon), 0, 0, 1, 1}, @@ -19362,11 +19148,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0}, {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0}, {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_ocnfr, __pyx_k_ocnfr, sizeof(__pyx_k_ocnfr), 0, 0, 1, 1}, + {&__pyx_n_u_ocnfr, __pyx_k_ocnfr, sizeof(__pyx_k_ocnfr), 0, 1, 0, 1}, {&__pyx_n_s_ocnfr_mv, __pyx_k_ocnfr_mv, sizeof(__pyx_k_ocnfr_mv), 0, 0, 1, 1}, {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, {&__pyx_n_s_py_get_GEOS, __pyx_k_py_get_GEOS, sizeof(__pyx_k_py_get_GEOS), 0, 0, 1, 1}, {&__pyx_n_s_py_get_NDVI_background, __pyx_k_py_get_NDVI_background, sizeof(__pyx_k_py_get_NDVI_background), 0, 0, 1, 1}, {&__pyx_n_s_py_get_Olson_eco, __pyx_k_py_get_Olson_eco, sizeof(__pyx_k_py_get_Olson_eco), 0, 0, 1, 1}, @@ -19385,11 +19170,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_sfct, __pyx_k_sfct, sizeof(__pyx_k_sfct), 0, 0, 1, 1}, + {&__pyx_n_u_sfct, __pyx_k_sfct, sizeof(__pyx_k_sfct), 0, 1, 0, 1}, {&__pyx_n_s_sfct_mv, __pyx_k_sfct_mv, sizeof(__pyx_k_sfct_mv), 0, 0, 1, 1}, {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_snowfr, __pyx_k_snowfr, sizeof(__pyx_k_snowfr), 0, 0, 1, 1}, + {&__pyx_n_u_snowfr, __pyx_k_snowfr, sizeof(__pyx_k_snowfr), 0, 1, 0, 1}, {&__pyx_n_s_snowfr_mv, __pyx_k_snowfr_mv, sizeof(__pyx_k_snowfr_mv), 0, 0, 1, 1}, {&__pyx_n_s_sst, __pyx_k_sst, sizeof(__pyx_k_sst), 0, 0, 1, 1}, {&__pyx_n_s_sst_file, __pyx_k_sst_file, sizeof(__pyx_k_sst_file), 0, 0, 1, 1}, @@ -19404,16 +19189,16 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_tpw, __pyx_k_tpw, sizeof(__pyx_k_tpw), 0, 0, 1, 1}, + {&__pyx_n_u_tpw, __pyx_k_tpw, sizeof(__pyx_k_tpw), 0, 1, 0, 1}, {&__pyx_n_s_tpw_mv, __pyx_k_tpw_mv, sizeof(__pyx_k_tpw_mv), 0, 0, 1, 1}, {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0}, {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 112, __pyx_L1_error) __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 133, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error) @@ -19687,12 +19472,12 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * def py_get_GEOS(np.ndarray[float, ndim=1] lat, np.ndarray[float, ndim=1] lon, char *startTime, # <<<<<<<<<<<<<< * char *anc_dir, char *geos1, char *geos2, char *geos_lnd, char *geos_ocn, char *geos_cnst, - * tpw, snowfr, icefr, ocnfr, landicefr, sfct): + * geos_data): # tpw, snowfr, icefr, ocnfr, landicefr, sfct): */ - __pyx_tuple__27 = PyTuple_Pack(21, __pyx_n_s_lat, __pyx_n_s_lon, __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_tpw, __pyx_n_s_snowfr, __pyx_n_s_icefr, __pyx_n_s_ocnfr, __pyx_n_s_landicefr, __pyx_n_s_sfct, __pyx_n_s_tpw_mv, __pyx_n_s_snowfr_mv, __pyx_n_s_icefr_mv, __pyx_n_s_ocnfr_mv, __pyx_n_s_landicefr_mv, __pyx_n_s_sfct_mv); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(18, __pyx_n_s_lat, __pyx_n_s_lon, __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, __pyx_n_s_v, __pyx_n_s_tpw_mv, __pyx_n_s_snowfr_mv, __pyx_n_s_icefr_mv, __pyx_n_s_ocnfr_mv, __pyx_n_s_landicefr_mv, __pyx_n_s_sfct_mv, __pyx_n_s_geos_dict); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(15, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ancillary_pyx, __pyx_n_s_py_get_GEOS, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(10, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_ancillary_pyx, __pyx_n_s_py_get_GEOS, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 67, __pyx_L1_error) /* "View.MemoryView":286 * return self.name @@ -20234,7 +20019,7 @@ if (!__Pyx_RefNanny) { * * def py_get_GEOS(np.ndarray[float, ndim=1] lat, np.ndarray[float, ndim=1] lon, char *startTime, # <<<<<<<<<<<<<< * char *anc_dir, char *geos1, char *geos2, char *geos_lnd, char *geos_ocn, char *geos_cnst, - * tpw, snowfr, icefr, ocnfr, landicefr, sfct): + * geos_data): # tpw, snowfr, icefr, ocnfr, landicefr, sfct): */ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_14ancillary_data_7py_get_GEOS, NULL, __pyx_n_s_ancillary_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -20447,34 +20232,6 @@ end: } #endif -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, @@ -21198,6 +20955,20 @@ fail:; return -1; } +/* PyObjectGetAttrStr */ + #if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + /* DictGetItem */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { @@ -21222,6 +20993,20 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { } #endif +/* GetBuiltinName */ + static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { @@ -21696,6 +21481,122 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject "Out of bounds on buffer access (axis %d)", axis); } +/* GetItemInt */ + static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* ObjectGetItem */ + #if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { + PyObject *runerr; + Py_ssize_t key_value; + PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; + if (unlikely(!(m && m->sq_item))) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); + return NULL; + } + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { + PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; + if (likely(m && m->mp_subscript)) { + return m->mp_subscript(obj, key); + } + return __Pyx_PyObject_GetIndex(obj, key); +} +#endif + /* GetTopmostException */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * @@ -22180,122 +22081,6 @@ return_ne: return PyObject_GetAttr(o, n); } -/* GetItemInt */ - static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* ObjectGetItem */ - #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); - } - return __Pyx_PyObject_GetIndex(obj, key); -} -#endif - /* decode_c_string */ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, @@ -23553,18 +23338,6 @@ __pyx_fail: return result; } -/* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get_float(const char *itemp) { - return (PyObject *) PyFloat_FromDouble(*(float *) itemp); -} -static CYTHON_INLINE int __pyx_memview_set_float(const char *itemp, PyObject *obj) { - float value = __pyx_PyFloat_AsFloat(obj); - if ((value == (float)-1) && PyErr_Occurred()) - return 0; - *(float *) itemp = value; - return 1; -} - /* Declarations */ #if CYTHON_CCOMPLEX #ifdef __cplusplus diff --git a/scene.py b/scene.py index 8e1ac1a..2413767 100644 --- a/scene.py +++ b/scene.py @@ -7,7 +7,10 @@ _scene_list = ['ocean_day', 'ocean_night', 'land_day', 'land_night', 'snow_day', 'polar_night_land', 'polar_ocean_night'] _flags = ['day', 'night', 'land', 'coast', 'sh_lake', 'sh_ocean', 'water', 'polar', 'sunglint', 'greenland', 'high_elevation', 'antarctica', 'desert', 'vrused', 'map_snow', 'map_ice', - 'ndsi_snow', 'ice', 'new_zealand'] + 'ndsi_snow', 'snow', 'ice', 'new_zealand'] + +# temp value, need to verify what the actual bad_data value is in the C code +_bad_data = -999.0 # I'm defining here the flags for difference scenes. Eventually I want to find a better way of doing this land = 1 @@ -27,6 +30,9 @@ def find_scene(data): lat = data['latitude'].values lon = data['longitude'].values sza = data['solar_zenith'].values + b065 = data['M05'].values + b086 = data['M07'].values + elev = data[].values # !!!!!!!!!!! THIS NEEDS TO BE DEFINED IN read_data() day = np.zeros((3232, 3200)) day[sza <= 85] = 1 @@ -43,57 +49,175 @@ def find_scene(data): scene_flag['night'][sza > 85] = 1 scene_flag[np.abs(lat) > 60]['polar'] = 1 - ################## need to pass refang (once I figure out what it is) and sunglint_angle. The latter + # ################# need to pass refang (once I figure out what it is) and sunglint_angle. The latter # comes from the thresholds file. In the C code is snglnt_bounds[3] idx = np.nonzero((scene_flag['day'] == 1) & (refang <= sunglint_angle)) scene_flag['sunglint'][idx] = 1 + # Force consistency between lsf and ecosystem type for water + idx = np.nonzero((lsf == 0) | (lsf >= 5) & (lsf < 7)) + eco[idx] = 14 + + # start by defining anythings as land + scene_flag['land'] = 1 + scene_flag['water'] = 0 + + # Fix-up for missing ecosystem data in eastern Greenland and north-eastern Siberia. + # Without this, these regions become completely "coast". + idx = np.nonzero((lsf != 255) & (lsf == 1) | (lsf == 4)) + scene_flag['land'][idx] = 1 + + idx = np.nonzero((lsf != 255) & (eco == 14)) + + idx = np.nonzero((lsf != 255) & (eco == 14) & (lat < 64.0)) + scene_flag['coast'][idx] = 1 + + idx = np.nonzero((lsf != 255) & (eco == 14) & + (lat >= 67.5) & (lon < -40.0) & (lon > -168.6) | (lon > -12.5)) + scene_flag['coast'][idx] = 1 + + idx = np.nonzero((lsf != 255) & (eco == 14) & + (lat >= 64.0) & (lat < 67.5) & (lon < -40.0) & (lon > -168.5) | (lon > -30.0)) + scene_flag['coast'][idx] = 1 + + idx = np.nonzero(lsf == 2) + scene_flag['coast'][idx] = 1 + scene_flag['land'][idx] = 1 + + idx = np.nonzero(lsf == 3) + scene_flag['land'][idx] = 1 + scene_flag['sh_lake'][idx] = 1 + + # Need shallow lakes to be processed as "coast" for day, but not night + idx = np.nonzero((lsf == 3) & (day == 1)) + scene_flag['coast'][idx] = 1 + + idx = np.nonzero((lsf == 3) & (day == 0)) + scene_flag['sh_ocean'][idx] = 1 + + # if land/sea flag is missing, then calculate visible ratio to determine if land or water. + idx = np.nonzero((lsf == 255) & (b065 != _bad_data) & (b086 != _bad_data) & (b086/b065 > 0.9)) + + scene_flag['land'] = 1 + idx = np.nonzero((lsf == 255) & (b065 != _bad_data) & (b086 != _bad_data) & (b086/b065 <= 0.9)) + + # Check surface elevation + # First, define "Greenland". + idx = np.nonzero((scene_flag['land'] == 1) & + (lat >= 60.0) & (lat < 67.0) & (lon >= -60.0) & (lon < -30.0)) + scene_flag['greenland'][idx] = 1 + + idx = np.nonzero((scene_flag['land'] == 1) & + (lat >= 67.0) & (lat < 75.0) & (lon >= -60.0) & (lon < -10.0)) + scene_flag['greenland'][idx] = 1 + + idx = np.nonzero((scene_flag['land'] == 1) & + (lat >= 75.0) & (lon >= -70.0) & (lon < -10.0)) + scene_flag['greenland'][idx] = 1 + + scene_flag['high_elevation'][elev > 2000] = 1 + idx = np.nonzero((elev > 200) & (scene_flag['greenland'] == 1) & (scene_flag['land'] == 1)) + scene_flag['high_elevation'][idx] = 1 + + idx = np.nonzero((lat >= 75.0) & (lat <= 79.0) & (lon >= -73.0) & (lon <= -50.0) & + (scene_flag['land'] == 1)) + scene_flag['high_elevation'][idx] = 1 + + scene_flag['antarctica'][lat < -60.0] = 1 + ################################## - # CONTINUE FROM HERE # + # somewhere here I need to add # + # the 11um elevation correction # ################################## - # Force consistency between lsf and ecosystem type for water - idx = np.nonzero((lsf == 0) | ((lsf >= 5) & (lsf <= 7))) - eco[idx] = 14 + # this is a temporary variable for the 11um elevation correction + elev_correction = elev/1000.0 * 5.0 - idx = np.nonzero((lsf == 1) | (lsf == 4)) - tmp[idx] = tmp[idx] + land + ## Get surface temperature from NWP and SST fields + ## if it's land get it from GDAS/GEOS5 + #sfctmp[scene_flag['land'] == 1] = sfct + ## otherwise use the ReynoldsSST + #sfctmp[scene_flag['land'] == 0] = reynSST - idx = np.nonzero(eco == 14) + # Use background NDVI to define "desert" + idx = np.nonzero((scene_flag['land'] == 1) & (ndvibk < 0.3)) + scene_flag['desert'][idx] = 1 + idx = np.nonzero((scene_flag['land'] == 1) & (lat < -69.0)) + scene_flag['desert'][idx] = 1 - # fix-up for missing ecosystem data in eastern Greenland and north-eastern Siberia. - # Without this, these regions become completely "coast". - idx1 = np.nonzero((eco == 14) & (lat < 64)) - idx2 = np.nonzero((eco == 14) & (lat >= 67.5) & (lon > -168.5) & (lon < -40)) - idx3 = np.nonzero((eco == 14) & (lat >= 67.5) & (lon > -30)) - idx4 = np.nonzero((eco == 14) & (lat >= 64) & (lat < 67.5) & (lon > -168.5) & (lon < -40)) - idx5 = np.nonzero((eco == 14) & (lat >= 64) & (lat < 67.5) & (lon > -30)) - tmp[idx1] = tmp[idx1] + coast - tmp[idx2] = tmp[idx2] + coast - tmp[idx3] = tmp[idx3] + coast - tmp[idx4] = tmp[idx4] + coast - tmp[idx5] = tmp[idx5] + coast - - tmp[lsf == 2] = tmp[lsf == 2] + land + coast - # need shallow lakes to be processed as "coast" for day, but not night - tmp[(lsf == 3) & (day == 1)] = tmp[(lsf == 3) & (day == 1)] + land + sh_lake + coast - tmp[(lsf > 4) & (lsf != 255)] = tmp[(lsf > 4) & (lsf != 255)] + water + sh_ocean - - # need to cover the case where eco is 255 and I use te vis ratio between gbnd065 and gbnd086 - # to determine if land or water - - greenland_flag = 0 - hi_elevation_flag = 0 - antarctic_flag = 0 - desert_flag = 0 - vrused = 0 # visible ratio test used based on eco_type. Check C code - - map_snow_flag = 0 - map_ice_flag = 0 - ndsi_snow_flag = 0 - ice_flag = 0 - new_zealand_flag = 0 + idx = np.nonzero((eco == 2) | (eco == 8) | (eco == 11) | (eco == 40) | (eco == 41) | (eco == 46) | + (eco == 51) | (eco == 52) | (eco == 59) | (eco == 71) | (eco == 50)) + scene_flag['vrused'] = 1 + scene_flag['vrused'][idx] = 0 + + snow_fraction = geos_data['snowfr'] + perm_ice_fraction = geos_data['landicefr'] + ice_fraction = geos_data['icefr'] + + idx = np.nonzero((snow_fraction > 0.10) & (snow_fraction <= 1.0)) + scene_flag['map_snow'] = 1 + + idx = np.nonzero((perm_ice_fraction > 0.10) & (perm_ice_fraction <= 1.0)) + scene_flag['map_snow'][idx] = 1 + + idx = np.nonzero((ice_fraction > 0.10) & (ice_fraction <= 1.0)) + scene_flag['map_ice'][idx] = 1 + + # need to define this function and write this block better + if day == 1: + # Run quick version of D. Hall's snow detection algorithm + scene_flag['ndsi_snow'] = run_snow_mask() + + idx = np.nonzero((day == 1) & (water == 1) & (lat >= -60.0) & (lat <= 25.0) & + (scene_flag['map_snow'] == 1) & (scene_flag['ndsi_snow'] == 1)) + scene_flag['ice'][idx] = 1 + + idx = np.nonzero((day == 1) & (water == 1) & (lat < -60.0) & + (scene_flag['ndsi_snow'] == 1)) + scene_flag['ice'][idx] = 1 + + idx = np.nonzero((day == 1) & (water == 1) & (lsf == 3) | (lsf == 5) & + (scene_flag['ndsi_snow'] == 1)) + scene_flag['ice'][idx] = 1 + + idx = np.nonzero((day == 1) & (water == 1) & + (scene_flag['map_ice'] == 1) & (scene_flag['ndsi_snow'] == 1)) + scene_flag['ice'][idx] = 1 + + # Define New Zealand region which receives snow but snow map does not show it. + idx = np.nonzero((day == 1) & (land == 1) & + (lat >= 48.0) & (lat <= -34.0) & (lon >= 165.0) & (lon <= 180.0)) + scene_flag['new_zealand'] = 1 + + idx = np.nonzero((day == 1) & (land == 1) & (lat >= -60.0) & (lat <= 25.0) & + (scene_flag['map_snow'] == 1) & (scene_flag['ndsi_snow'] == 1) | + (scene_flag['new_zealand'] == 1)) + scene_flag['snow'][idx] = 1 + + idx = np.nonzero((day == 1) & (land == 1) & (lat < -60.0)) + scne_flag['snow'][idx] = 1 + + idx = np.nonzero((day == 1) & (land == 1) & (scene_flag['ndsi_snow'] == 1)) + scne_flag['snow'][idx] = 1 + + idx = np.nonzero((day == 0) & (scene_flag['map_snow'] == 1) & + (sfctmp > 280.0) & (elev < 500.0)) + scene_flag['snow'][idx] = 0 + + idx = np.nonzero((day == 0) & (scene_flag['map_snow'] == 1) & + (sfctmp > 280.0) & (elev < 500.0)) + scene_flag['ice'][idx] = 0 + + idx = np.nonzero((day == 0) & (lat > 86.0)) + scene_flag['ice'] = 1 + + ################################## + # CONTINUE FROM HERE # + ################################## + # Check regional uniformity + # Check for data border pixels + # NEED TO UNDERSTAND WHAT THIS PART DOES return scene -- GitLab