diff --git a/build/lib.win-amd64-3.8/claude_low_level_library.cp38-win_amd64.pyd b/build/lib.win-amd64-3.8/claude_low_level_library.cp38-win_amd64.pyd index 0171c42..ff7b430 100644 Binary files a/build/lib.win-amd64-3.8/claude_low_level_library.cp38-win_amd64.pyd and b/build/lib.win-amd64-3.8/claude_low_level_library.cp38-win_amd64.pyd differ diff --git a/build/lib.win-amd64-3.8/claude_top_level_library.cp38-win_amd64.pyd b/build/lib.win-amd64-3.8/claude_top_level_library.cp38-win_amd64.pyd index 51ed77a..e985b46 100644 Binary files a/build/lib.win-amd64-3.8/claude_top_level_library.cp38-win_amd64.pyd and b/build/lib.win-amd64-3.8/claude_top_level_library.cp38-win_amd64.pyd differ diff --git a/build/temp.win-amd64-3.8/Release/claude_low_level_library.cp38-win_amd64.exp b/build/temp.win-amd64-3.8/Release/claude_low_level_library.cp38-win_amd64.exp index 9fdf6e2..4206cfb 100644 Binary files a/build/temp.win-amd64-3.8/Release/claude_low_level_library.cp38-win_amd64.exp and b/build/temp.win-amd64-3.8/Release/claude_low_level_library.cp38-win_amd64.exp differ diff --git a/build/temp.win-amd64-3.8/Release/claude_low_level_library.cp38-win_amd64.lib b/build/temp.win-amd64-3.8/Release/claude_low_level_library.cp38-win_amd64.lib index 977537a..35d5fb0 100644 Binary files a/build/temp.win-amd64-3.8/Release/claude_low_level_library.cp38-win_amd64.lib and b/build/temp.win-amd64-3.8/Release/claude_low_level_library.cp38-win_amd64.lib differ diff --git a/build/temp.win-amd64-3.8/Release/claude_low_level_library.obj b/build/temp.win-amd64-3.8/Release/claude_low_level_library.obj index 7d716d2..5bda989 100644 Binary files a/build/temp.win-amd64-3.8/Release/claude_low_level_library.obj and b/build/temp.win-amd64-3.8/Release/claude_low_level_library.obj differ diff --git a/build/temp.win-amd64-3.8/Release/claude_top_level_library.cp38-win_amd64.exp b/build/temp.win-amd64-3.8/Release/claude_top_level_library.cp38-win_amd64.exp index 218390d..c859d40 100644 Binary files a/build/temp.win-amd64-3.8/Release/claude_top_level_library.cp38-win_amd64.exp and b/build/temp.win-amd64-3.8/Release/claude_top_level_library.cp38-win_amd64.exp differ diff --git a/build/temp.win-amd64-3.8/Release/claude_top_level_library.cp38-win_amd64.lib b/build/temp.win-amd64-3.8/Release/claude_top_level_library.cp38-win_amd64.lib index a722868..ab46ea2 100644 Binary files a/build/temp.win-amd64-3.8/Release/claude_top_level_library.cp38-win_amd64.lib and b/build/temp.win-amd64-3.8/Release/claude_top_level_library.cp38-win_amd64.lib differ diff --git a/build/temp.win-amd64-3.8/Release/claude_top_level_library.obj b/build/temp.win-amd64-3.8/Release/claude_top_level_library.obj index 27799b4..c899cfe 100644 Binary files a/build/temp.win-amd64-3.8/Release/claude_top_level_library.obj and b/build/temp.win-amd64-3.8/Release/claude_top_level_library.obj differ diff --git a/claude_low_level_library.c b/claude_low_level_library.c index 5b4798e..7553cba 100644 --- a/claude_low_level_library.c +++ b/claude_low_level_library.c @@ -1231,25 +1231,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* k #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) -#endif - -/* PyIntCompare.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); - /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); @@ -1710,6 +1691,7 @@ static const char __pyx_k_sigma[] = "sigma"; static const char __pyx_k_solar[] = "solar"; static const char __pyx_k_value[] = "value"; static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_inv_90[] = "inv_90"; static const char __pyx_k_cos_lon[] = "cos_lon"; static const char __pyx_k_nlevels[] = "nlevels"; static const char __pyx_k_profile[] = "profile"; @@ -1727,7 +1709,7 @@ static const char __pyx_k_scalar_gradient_z[] = "scalar_gradient_z"; static const char __pyx_k_thermal_radiation[] = "thermal_radiation"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_scalar_gradient_x_2D[] = "scalar_gradient_x_2D"; -static const char __pyx_k_scalar_gradient_y_2d[] = "scalar_gradient_y_2d"; +static const char __pyx_k_scalar_gradient_y_2D[] = "scalar_gradient_y_2D"; static const char __pyx_k_scalar_gradient_z_1D[] = "scalar_gradient_z_1D"; static const char __pyx_k_surface_optical_depth[] = "surface_optical_depth"; static const char __pyx_k_claude_low_level_library[] = "claude_low_level_library"; @@ -1761,6 +1743,7 @@ static PyObject *__pyx_n_s_dz; static PyObject *__pyx_n_s_i; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_insolation; +static PyObject *__pyx_n_s_inv_90; static PyObject *__pyx_n_s_j; static PyObject *__pyx_n_s_k; static PyObject *__pyx_n_s_lat; @@ -1784,7 +1767,7 @@ static PyObject *__pyx_n_s_range; static PyObject *__pyx_n_s_scalar_gradient_x; static PyObject *__pyx_n_s_scalar_gradient_x_2D; static PyObject *__pyx_n_s_scalar_gradient_y; -static PyObject *__pyx_n_s_scalar_gradient_y_2d; +static PyObject *__pyx_n_s_scalar_gradient_y_2D; static PyObject *__pyx_n_s_scalar_gradient_z; static PyObject *__pyx_n_s_scalar_gradient_z_1D; static PyObject *__pyx_n_s_sigma; @@ -1799,20 +1782,18 @@ static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; static PyObject *__pyx_n_s_value; static PyObject *__pyx_n_s_year; static PyObject *__pyx_pf_24claude_low_level_library_scalar_gradient_x(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dx, __pyx_t_5numpy_int_t __pyx_v_nlon, __pyx_t_5numpy_int_t __pyx_v_i, __pyx_t_5numpy_int_t __pyx_v_j, __pyx_t_5numpy_int_t __pyx_v_k); /* proto */ -static PyObject *__pyx_pf_24claude_low_level_library_2scalar_gradient_x_2D(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_dx, PyObject *__pyx_v_nlon, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ +static PyObject *__pyx_pf_24claude_low_level_library_2scalar_gradient_x_2D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dx, __pyx_t_5numpy_int_t __pyx_v_nlon, __pyx_t_5numpy_int_t __pyx_v_i, __pyx_t_5numpy_int_t __pyx_v_j); /* proto */ static PyObject *__pyx_pf_24claude_low_level_library_4scalar_gradient_y(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_dy, __pyx_t_5numpy_int_t __pyx_v_nlat, __pyx_t_5numpy_int_t __pyx_v_i, __pyx_t_5numpy_int_t __pyx_v_j, __pyx_t_5numpy_int_t __pyx_v_k); /* proto */ -static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_dy, PyObject *__pyx_v_nlat, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */ -static PyObject *__pyx_pf_24claude_low_level_library_8scalar_gradient_z(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_dz, PyObject *__pyx_v_i, PyObject *__pyx_v_j, PyObject *__pyx_v_k); /* proto */ +static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_dy, __pyx_t_5numpy_int_t __pyx_v_nlat, __pyx_t_5numpy_int_t __pyx_v_i, __pyx_t_5numpy_int_t __pyx_v_j); /* proto */ +static PyObject *__pyx_pf_24claude_low_level_library_8scalar_gradient_z(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dz, __pyx_t_5numpy_int_t __pyx_v_i, __pyx_t_5numpy_int_t __pyx_v_j, __pyx_t_5numpy_int_t __pyx_v_k); /* proto */ static PyObject *__pyx_pf_24claude_low_level_library_10scalar_gradient_z_1D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dz, __pyx_t_5numpy_int_t __pyx_v_k); /* proto */ static PyObject *__pyx_pf_24claude_low_level_library_12surface_optical_depth(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_lat); /* proto */ static PyObject *__pyx_pf_24claude_low_level_library_14thermal_radiation(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_a); /* proto */ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_insolation, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_lat, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_lon, __pyx_t_5numpy_int_t __pyx_v_t, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_day, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_year, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_axial_tilt); /* proto */ -static PyObject *__pyx_pf_24claude_low_level_library_18profile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a); /* proto */ +static PyObject *__pyx_pf_24claude_low_level_library_18profile(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ -static PyObject *__pyx_float_2_5; static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; static PyObject *__pyx_int_4; static PyObject *__pyx_int_90; @@ -1988,7 +1969,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_scalar_gradient_x(CYTHON_UN * def scalar_gradient_x(np.ndarray a,np.ndarray dx,np.int_t nlon,np.int_t i,np.int_t j,np.int_t k): * return (a[i,(j+1)%nlon,k]-a[i,(j-1)%nlon,k])/dx[i] # <<<<<<<<<<<<<< * - * def scalar_gradient_x_2D(a,dx,nlon,i,j): + * def scalar_gradient_x_2D(np.ndarray a,np.ndarray dx,np.int_t nlon,np.int_t i,np.int_t j): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) @@ -2081,7 +2062,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_scalar_gradient_x(CYTHON_UN /* "claude_low_level_library.pyx":16 * return (a[i,(j+1)%nlon,k]-a[i,(j-1)%nlon,k])/dx[i] * - * def scalar_gradient_x_2D(a,dx,nlon,i,j): # <<<<<<<<<<<<<< + * def scalar_gradient_x_2D(np.ndarray a,np.ndarray dx,np.int_t nlon,np.int_t i,np.int_t j): # <<<<<<<<<<<<<< * return (a[i,(j+1)%nlon]-a[i,(j-1)%nlon])/dx[i] * */ @@ -2090,11 +2071,11 @@ static PyObject *__pyx_pf_24claude_low_level_library_scalar_gradient_x(CYTHON_UN static PyObject *__pyx_pw_24claude_low_level_library_3scalar_gradient_x_2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_24claude_low_level_library_3scalar_gradient_x_2D = {"scalar_gradient_x_2D", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_low_level_library_3scalar_gradient_x_2D, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_24claude_low_level_library_3scalar_gradient_x_2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_a = 0; - PyObject *__pyx_v_dx = 0; - PyObject *__pyx_v_nlon = 0; - PyObject *__pyx_v_i = 0; - PyObject *__pyx_v_j = 0; + PyArrayObject *__pyx_v_a = 0; + PyArrayObject *__pyx_v_dx = 0; + __pyx_t_5numpy_int_t __pyx_v_nlon; + __pyx_t_5numpy_int_t __pyx_v_i; + __pyx_t_5numpy_int_t __pyx_v_j; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2163,11 +2144,11 @@ static PyObject *__pyx_pw_24claude_low_level_library_3scalar_gradient_x_2D(PyObj values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } - __pyx_v_a = values[0]; - __pyx_v_dx = values[1]; - __pyx_v_nlon = values[2]; - __pyx_v_i = values[3]; - __pyx_v_j = values[4]; + __pyx_v_a = ((PyArrayObject *)values[0]); + __pyx_v_dx = ((PyArrayObject *)values[1]); + __pyx_v_nlon = __Pyx_PyInt_As_npy_long(values[2]); if (unlikely((__pyx_v_nlon == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error) + __pyx_v_i = __Pyx_PyInt_As_npy_long(values[3]); if (unlikely((__pyx_v_i == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error) + __pyx_v_j = __Pyx_PyInt_As_npy_long(values[4]); if (unlikely((__pyx_v_j == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; @@ -2177,19 +2158,27 @@ static PyObject *__pyx_pw_24claude_low_level_library_3scalar_gradient_x_2D(PyObj __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) __PYX_ERR(0, 16, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dx), __pyx_ptype_5numpy_ndarray, 1, "dx", 0))) __PYX_ERR(0, 16, __pyx_L1_error) __pyx_r = __pyx_pf_24claude_low_level_library_2scalar_gradient_x_2D(__pyx_self, __pyx_v_a, __pyx_v_dx, __pyx_v_nlon, __pyx_v_i, __pyx_v_j); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_24claude_low_level_library_2scalar_gradient_x_2D(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_dx, PyObject *__pyx_v_nlon, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { +static PyObject *__pyx_pf_24claude_low_level_library_2scalar_gradient_x_2D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dx, __pyx_t_5numpy_int_t __pyx_v_nlon, __pyx_t_5numpy_int_t __pyx_v_i, __pyx_t_5numpy_int_t __pyx_v_j) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + __pyx_t_5numpy_int_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2197,62 +2186,70 @@ static PyObject *__pyx_pf_24claude_low_level_library_2scalar_gradient_x_2D(CYTHO /* "claude_low_level_library.pyx":17 * - * def scalar_gradient_x_2D(a,dx,nlon,i,j): + * def scalar_gradient_x_2D(np.ndarray a,np.ndarray dx,np.int_t nlon,np.int_t i,np.int_t j): * return (a[i,(j+1)%nlon]-a[i,(j-1)%nlon])/dx[i] # <<<<<<<<<<<<<< * * # gradient of scalar field a in the local y direction at point i,j */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_j, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Remainder(__pyx_t_1, __pyx_v_nlon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_j, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Remainder(__pyx_t_1, __pyx_v_nlon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_j + 1); + if (unlikely(__pyx_v_nlon == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 17, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__Pyx_mod___pyx_t_5numpy_int_t(__pyx_t_2, __pyx_v_nlon)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __pyx_t_1 = 0; __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__pyx_v_j - 1); + if (unlikely(__pyx_v_nlon == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + __PYX_ERR(0, 17, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__Pyx_mod___pyx_t_5numpy_int_t(__pyx_t_2, __pyx_v_nlon)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_dx, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dx), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; /* "claude_low_level_library.pyx":16 * return (a[i,(j+1)%nlon,k]-a[i,(j-1)%nlon,k])/dx[i] * - * def scalar_gradient_x_2D(a,dx,nlon,i,j): # <<<<<<<<<<<<<< + * def scalar_gradient_x_2D(np.ndarray a,np.ndarray dx,np.int_t nlon,np.int_t i,np.int_t j): # <<<<<<<<<<<<<< * return (a[i,(j+1)%nlon]-a[i,(j-1)%nlon])/dx[i] * */ @@ -2260,8 +2257,9 @@ static PyObject *__pyx_pf_24claude_low_level_library_2scalar_gradient_x_2D(CYTHO /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("claude_low_level_library.scalar_gradient_x_2D", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -2579,7 +2577,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_4scalar_gradient_y(CYTHON_U * else: * return (a[i+1,j,k]-a[i-1,j,k])/dy # <<<<<<<<<<<<<< * - * def scalar_gradient_y_2d(a,dy,nlat,i,j): + * def scalar_gradient_y_2D(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t j): */ /*else*/ { __Pyx_XDECREF(__pyx_r); @@ -2664,26 +2662,26 @@ static PyObject *__pyx_pf_24claude_low_level_library_4scalar_gradient_y(CYTHON_U /* "claude_low_level_library.pyx":28 * return (a[i+1,j,k]-a[i-1,j,k])/dy * - * def scalar_gradient_y_2d(a,dy,nlat,i,j): # <<<<<<<<<<<<<< + * def scalar_gradient_y_2D(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t j): # <<<<<<<<<<<<<< * if i == 0: * return 2*(a[i+1,j]-a[i,j])/dy */ /* Python wrapper */ -static PyObject *__pyx_pw_24claude_low_level_library_7scalar_gradient_y_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_24claude_low_level_library_7scalar_gradient_y_2d = {"scalar_gradient_y_2d", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_low_level_library_7scalar_gradient_y_2d, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_24claude_low_level_library_7scalar_gradient_y_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_a = 0; - PyObject *__pyx_v_dy = 0; - PyObject *__pyx_v_nlat = 0; - PyObject *__pyx_v_i = 0; - PyObject *__pyx_v_j = 0; +static PyObject *__pyx_pw_24claude_low_level_library_7scalar_gradient_y_2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_24claude_low_level_library_7scalar_gradient_y_2D = {"scalar_gradient_y_2D", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_low_level_library_7scalar_gradient_y_2D, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_24claude_low_level_library_7scalar_gradient_y_2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_a = 0; + __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_dy; + __pyx_t_5numpy_int_t __pyx_v_nlat; + __pyx_t_5numpy_int_t __pyx_v_i; + __pyx_t_5numpy_int_t __pyx_v_j; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("scalar_gradient_y_2d (wrapper)", 0); + __Pyx_RefNannySetupContext("scalar_gradient_y_2D (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_dy,&__pyx_n_s_nlat,&__pyx_n_s_i,&__pyx_n_s_j,0}; PyObject* values[5] = {0,0,0,0,0}; @@ -2713,29 +2711,29 @@ static PyObject *__pyx_pw_24claude_low_level_library_7scalar_gradient_y_2d(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2d", 1, 5, 5, 1); __PYX_ERR(0, 28, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2D", 1, 5, 5, 1); __PYX_ERR(0, 28, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nlat)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2d", 1, 5, 5, 2); __PYX_ERR(0, 28, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2D", 1, 5, 5, 2); __PYX_ERR(0, 28, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2d", 1, 5, 5, 3); __PYX_ERR(0, 28, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2D", 1, 5, 5, 3); __PYX_ERR(0, 28, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_j)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2d", 1, 5, 5, 4); __PYX_ERR(0, 28, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2D", 1, 5, 5, 4); __PYX_ERR(0, 28, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scalar_gradient_y_2d") < 0)) __PYX_ERR(0, 28, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scalar_gradient_y_2D") < 0)) __PYX_ERR(0, 28, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -2746,101 +2744,113 @@ static PyObject *__pyx_pw_24claude_low_level_library_7scalar_gradient_y_2d(PyObj values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } - __pyx_v_a = values[0]; - __pyx_v_dy = values[1]; - __pyx_v_nlat = values[2]; - __pyx_v_i = values[3]; - __pyx_v_j = values[4]; + __pyx_v_a = ((PyArrayObject *)values[0]); + __pyx_v_dy = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dy == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L3_error) + __pyx_v_nlat = __Pyx_PyInt_As_npy_long(values[2]); if (unlikely((__pyx_v_nlat == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L3_error) + __pyx_v_i = __Pyx_PyInt_As_npy_long(values[3]); if (unlikely((__pyx_v_i == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L3_error) + __pyx_v_j = __Pyx_PyInt_As_npy_long(values[4]); if (unlikely((__pyx_v_j == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 28, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2d", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 28, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("scalar_gradient_y_2D", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 28, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("claude_low_level_library.scalar_gradient_y_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("claude_low_level_library.scalar_gradient_y_2D", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_24claude_low_level_library_6scalar_gradient_y_2d(__pyx_self, __pyx_v_a, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_r = __pyx_pf_24claude_low_level_library_6scalar_gradient_y_2D(__pyx_self, __pyx_v_a, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_dy, PyObject *__pyx_v_nlat, PyObject *__pyx_v_i, PyObject *__pyx_v_j) { +static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_dy, __pyx_t_5numpy_int_t __pyx_v_nlat, __pyx_t_5numpy_int_t __pyx_v_i, __pyx_t_5numpy_int_t __pyx_v_j) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("scalar_gradient_y_2d", 0); + __Pyx_RefNannySetupContext("scalar_gradient_y_2D", 0); /* "claude_low_level_library.pyx":29 * - * def scalar_gradient_y_2d(a,dy,nlat,i,j): + * def scalar_gradient_y_2D(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t j): * if i == 0: # <<<<<<<<<<<<<< * return 2*(a[i+1,j]-a[i,j])/dy * elif i == nlat-1: */ - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_i, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = ((__pyx_v_i == 0) != 0); + if (__pyx_t_1) { /* "claude_low_level_library.pyx":30 - * def scalar_gradient_y_2d(a,dy,nlat,i,j): + * def scalar_gradient_y_2D(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t j): * if i == 0: * return 2*(a[i+1,j]-a[i,j])/dy # <<<<<<<<<<<<<< * elif i == nlat-1: * return 2*(a[i,j]-a[i-1,j])/dy */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_npy_long((__pyx_v_i + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_j); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_j); - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_dy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* "claude_low_level_library.pyx":29 * - * def scalar_gradient_y_2d(a,dy,nlat,i,j): + * def scalar_gradient_y_2D(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t j): * if i == 0: # <<<<<<<<<<<<<< * return 2*(a[i+1,j]-a[i,j])/dy * elif i == nlat-1: @@ -2854,13 +2864,8 @@ static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2d(CYTHO * return 2*(a[i,j]-a[i-1,j])/dy * else: */ - __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_nlat, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_i, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { + __pyx_t_1 = ((__pyx_v_i == (__pyx_v_nlat - 1)) != 0); + if (__pyx_t_1) { /* "claude_low_level_library.pyx":32 * return 2*(a[i+1,j]-a[i,j])/dy @@ -2870,42 +2875,51 @@ static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2d(CYTHO * return (a[i+1,j]-a[i-1,j])/dy */ __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_npy_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_j); - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_4 = PyNumber_Subtract(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_j); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; /* "claude_low_level_library.pyx":31 @@ -2922,43 +2936,50 @@ static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2d(CYTHO * else: * return (a[i+1,j]-a[i-1,j])/dy # <<<<<<<<<<<<<< * - * def scalar_gradient_z(a,dz,i,j,k): + * def scalar_gradient_z(np.ndarray a,np.ndarray dz,np.int_t i,np.int_t j,np.int_t k): */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_j); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_npy_long((__pyx_v_i + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_j); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __pyx_t_5 = 0; __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_dy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; @@ -2967,17 +2988,18 @@ static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2d(CYTHO /* "claude_low_level_library.pyx":28 * return (a[i+1,j,k]-a[i-1,j,k])/dy * - * def scalar_gradient_y_2d(a,dy,nlat,i,j): # <<<<<<<<<<<<<< + * def scalar_gradient_y_2D(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t j): # <<<<<<<<<<<<<< * if i == 0: * return 2*(a[i+1,j]-a[i,j])/dy */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("claude_low_level_library.scalar_gradient_y_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("claude_low_level_library.scalar_gradient_y_2D", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2988,7 +3010,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2d(CYTHO /* "claude_low_level_library.pyx":36 * return (a[i+1,j]-a[i-1,j])/dy * - * def scalar_gradient_z(a,dz,i,j,k): # <<<<<<<<<<<<<< + * def scalar_gradient_z(np.ndarray a,np.ndarray dz,np.int_t i,np.int_t j,np.int_t k): # <<<<<<<<<<<<<< * cdef np.int_t nlevels = len(dz) * if k == 0: */ @@ -2997,11 +3019,11 @@ static PyObject *__pyx_pf_24claude_low_level_library_6scalar_gradient_y_2d(CYTHO static PyObject *__pyx_pw_24claude_low_level_library_9scalar_gradient_z(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_24claude_low_level_library_9scalar_gradient_z = {"scalar_gradient_z", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_low_level_library_9scalar_gradient_z, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_24claude_low_level_library_9scalar_gradient_z(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_a = 0; - PyObject *__pyx_v_dz = 0; - PyObject *__pyx_v_i = 0; - PyObject *__pyx_v_j = 0; - PyObject *__pyx_v_k = 0; + PyArrayObject *__pyx_v_a = 0; + PyArrayObject *__pyx_v_dz = 0; + __pyx_t_5numpy_int_t __pyx_v_i; + __pyx_t_5numpy_int_t __pyx_v_j; + __pyx_t_5numpy_int_t __pyx_v_k; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3070,11 +3092,11 @@ static PyObject *__pyx_pw_24claude_low_level_library_9scalar_gradient_z(PyObject values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } - __pyx_v_a = values[0]; - __pyx_v_dz = values[1]; - __pyx_v_i = values[2]; - __pyx_v_j = values[3]; - __pyx_v_k = values[4]; + __pyx_v_a = ((PyArrayObject *)values[0]); + __pyx_v_dz = ((PyArrayObject *)values[1]); + __pyx_v_i = __Pyx_PyInt_As_npy_long(values[2]); if (unlikely((__pyx_v_i == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + __pyx_v_j = __Pyx_PyInt_As_npy_long(values[3]); if (unlikely((__pyx_v_j == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) + __pyx_v_k = __Pyx_PyInt_As_npy_long(values[4]); if (unlikely((__pyx_v_k == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; @@ -3084,22 +3106,30 @@ static PyObject *__pyx_pw_24claude_low_level_library_9scalar_gradient_z(PyObject __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) __PYX_ERR(0, 36, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dz), __pyx_ptype_5numpy_ndarray, 1, "dz", 0))) __PYX_ERR(0, 36, __pyx_L1_error) __pyx_r = __pyx_pf_24claude_low_level_library_8scalar_gradient_z(__pyx_self, __pyx_v_a, __pyx_v_dz, __pyx_v_i, __pyx_v_j, __pyx_v_k); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_24claude_low_level_library_8scalar_gradient_z(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_dz, PyObject *__pyx_v_i, PyObject *__pyx_v_j, PyObject *__pyx_v_k) { +static PyObject *__pyx_pf_24claude_low_level_library_8scalar_gradient_z(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dz, __pyx_t_5numpy_int_t __pyx_v_i, __pyx_t_5numpy_int_t __pyx_v_j, __pyx_t_5numpy_int_t __pyx_v_k) { __pyx_t_5numpy_int_t __pyx_v_nlevels; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3107,26 +3137,23 @@ static PyObject *__pyx_pf_24claude_low_level_library_8scalar_gradient_z(CYTHON_U /* "claude_low_level_library.pyx":37 * - * def scalar_gradient_z(a,dz,i,j,k): + * def scalar_gradient_z(np.ndarray a,np.ndarray dz,np.int_t i,np.int_t j,np.int_t k): * cdef np.int_t nlevels = len(dz) # <<<<<<<<<<<<<< * if k == 0: * return (a[i,j,k+1]-a[i,j,k])/dz[k] */ - __pyx_t_1 = PyObject_Length(__pyx_v_dz); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_dz)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 37, __pyx_L1_error) __pyx_v_nlevels = __pyx_t_1; /* "claude_low_level_library.pyx":38 - * def scalar_gradient_z(a,dz,i,j,k): + * def scalar_gradient_z(np.ndarray a,np.ndarray dz,np.int_t i,np.int_t j,np.int_t k): * cdef np.int_t nlevels = len(dz) * if k == 0: # <<<<<<<<<<<<<< * return (a[i,j,k+1]-a[i,j,k])/dz[k] * elif k == nlevels-1: */ - __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_k, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + __pyx_t_2 = ((__pyx_v_k == 0) != 0); + if (__pyx_t_2) { /* "claude_low_level_library.pyx":39 * cdef np.int_t nlevels = len(dz) @@ -3136,52 +3163,62 @@ static PyObject *__pyx_pf_24claude_low_level_library_8scalar_gradient_z(CYTHON_U * return (a[i,j,k]-a[i,j,k-1])/dz[k] */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_j); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_k); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_npy_long((__pyx_v_k + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_dz, __pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3); + __pyx_t_6 = 0; + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Subtract(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dz), __pyx_v_k, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; /* "claude_low_level_library.pyx":38 - * def scalar_gradient_z(a,dz,i,j,k): + * def scalar_gradient_z(np.ndarray a,np.ndarray dz,np.int_t i,np.int_t j,np.int_t k): * cdef np.int_t nlevels = len(dz) * if k == 0: # <<<<<<<<<<<<<< * return (a[i,j,k+1]-a[i,j,k])/dz[k] @@ -3196,13 +3233,8 @@ static PyObject *__pyx_pf_24claude_low_level_library_8scalar_gradient_z(CYTHON_U * return (a[i,j,k]-a[i,j,k-1])/dz[k] * else: */ - __pyx_t_2 = __Pyx_PyInt_From_npy_long((__pyx_v_nlevels - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_k, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) - __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, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_3) { + __pyx_t_2 = ((__pyx_v_k == (__pyx_v_nlevels - 1)) != 0); + if (__pyx_t_2) { /* "claude_low_level_library.pyx":41 * return (a[i,j,k+1]-a[i,j,k])/dz[k] @@ -3212,48 +3244,58 @@ static PyObject *__pyx_pf_24claude_low_level_library_8scalar_gradient_z(CYTHON_U * return (a[i,j,k+1]-a[i,j,k-1])/(2*dz[k]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_k); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_j); __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_7); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_dz, __pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyInt_From_npy_long((__pyx_v_k - 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Subtract(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dz), __pyx_v_k, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; goto __pyx_L0; /* "claude_low_level_library.pyx":40 @@ -3274,69 +3316,79 @@ static PyObject *__pyx_pf_24claude_low_level_library_8scalar_gradient_z(CYTHON_U */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_j); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_npy_long((__pyx_v_k + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_6); + __pyx_t_7 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_From_npy_long((__pyx_v_k - 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_j); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_7); + __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_a), __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_4 = PyNumber_Subtract(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_dz, __pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dz), __pyx_v_k, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyNumber_Multiply(__pyx_int_2, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; goto __pyx_L0; } /* "claude_low_level_library.pyx":36 * return (a[i+1,j]-a[i-1,j])/dy * - * def scalar_gradient_z(a,dz,i,j,k): # <<<<<<<<<<<<<< + * def scalar_gradient_z(np.ndarray a,np.ndarray dz,np.int_t i,np.int_t j,np.int_t k): # <<<<<<<<<<<<<< * cdef np.int_t nlevels = len(dz) * if k == 0: */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("claude_low_level_library.scalar_gradient_z", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3610,8 +3662,8 @@ static PyObject *__pyx_pf_24claude_low_level_library_10scalar_gradient_z_1D(CYTH * return (a[k+1]-a[k-1])/(2*dz[k]) * * def surface_optical_depth(DTYPE_f lat): # <<<<<<<<<<<<<< - * return 4 + np.cos(lat*inv_90)*2.5 - * + * cdef DTYPE_f inv_90 + * return 4 + np.cos(lat*inv_90)*2 */ /* Python wrapper */ @@ -3642,6 +3694,7 @@ static PyObject *__pyx_pw_24claude_low_level_library_13surface_optical_depth(PyO } static PyObject *__pyx_pf_24claude_low_level_library_12surface_optical_depth(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_lat) { + __pyx_t_24claude_low_level_library_DTYPE_f __pyx_v_inv_90; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3653,20 +3706,20 @@ static PyObject *__pyx_pf_24claude_low_level_library_12surface_optical_depth(CYT int __pyx_clineno = 0; __Pyx_RefNannySetupContext("surface_optical_depth", 0); - /* "claude_low_level_library.pyx":55 - * + /* "claude_low_level_library.pyx":56 * def surface_optical_depth(DTYPE_f lat): - * return 4 + np.cos(lat*inv_90)*2.5 # <<<<<<<<<<<<<< + * cdef DTYPE_f inv_90 + * return 4 + np.cos(lat*inv_90)*2 # <<<<<<<<<<<<<< * * def thermal_radiation(DTYPE_f a): */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble((__pyx_v_lat * __pyx_v_24claude_low_level_library_inv_90)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble((__pyx_v_lat * __pyx_v_inv_90)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3681,13 +3734,13 @@ static PyObject *__pyx_pf_24claude_low_level_library_12surface_optical_depth(CYT __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_float_2_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_AddCObj(__pyx_int_4, __pyx_t_3, 4, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_AddCObj(__pyx_int_4, __pyx_t_3, 4, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; @@ -3698,8 +3751,8 @@ static PyObject *__pyx_pf_24claude_low_level_library_12surface_optical_depth(CYT * return (a[k+1]-a[k-1])/(2*dz[k]) * * def surface_optical_depth(DTYPE_f lat): # <<<<<<<<<<<<<< - * return 4 + np.cos(lat*inv_90)*2.5 - * + * cdef DTYPE_f inv_90 + * return 4 + np.cos(lat*inv_90)*2 */ /* function exit code */ @@ -3716,8 +3769,8 @@ static PyObject *__pyx_pf_24claude_low_level_library_12surface_optical_depth(CYT return __pyx_r; } -/* "claude_low_level_library.pyx":57 - * return 4 + np.cos(lat*inv_90)*2.5 +/* "claude_low_level_library.pyx":58 + * return 4 + np.cos(lat*inv_90)*2 * * def thermal_radiation(DTYPE_f a): # <<<<<<<<<<<<<< * cdef DTYPE_f sigma = 5.67E-8 @@ -3736,7 +3789,7 @@ static PyObject *__pyx_pw_24claude_low_level_library_15thermal_radiation(PyObjec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("thermal_radiation (wrapper)", 0); assert(__pyx_arg_a); { - __pyx_v_a = __pyx_PyFloat_AsDouble(__pyx_arg_a); if (unlikely((__pyx_v_a == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 57, __pyx_L3_error) + __pyx_v_a = __pyx_PyFloat_AsDouble(__pyx_arg_a); if (unlikely((__pyx_v_a == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3761,7 +3814,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_14thermal_radiation(CYTHON_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("thermal_radiation", 0); - /* "claude_low_level_library.pyx":58 + /* "claude_low_level_library.pyx":59 * * def thermal_radiation(DTYPE_f a): * cdef DTYPE_f sigma = 5.67E-8 # <<<<<<<<<<<<<< @@ -3770,7 +3823,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_14thermal_radiation(CYTHON_ */ __pyx_v_sigma = 5.67E-8; - /* "claude_low_level_library.pyx":59 + /* "claude_low_level_library.pyx":60 * def thermal_radiation(DTYPE_f a): * cdef DTYPE_f sigma = 5.67E-8 * return sigma*(a**4) # <<<<<<<<<<<<<< @@ -3778,14 +3831,14 @@ static PyObject *__pyx_pf_24claude_low_level_library_14thermal_radiation(CYTHON_ * # power incident on (lat,lon) at time t */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sigma * pow(__pyx_v_a, 4.0))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_sigma * pow(__pyx_v_a, 4.0))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "claude_low_level_library.pyx":57 - * return 4 + np.cos(lat*inv_90)*2.5 + /* "claude_low_level_library.pyx":58 + * return 4 + np.cos(lat*inv_90)*2 * * def thermal_radiation(DTYPE_f a): # <<<<<<<<<<<<<< * cdef DTYPE_f sigma = 5.67E-8 @@ -3803,7 +3856,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_14thermal_radiation(CYTHON_ return __pyx_r; } -/* "claude_low_level_library.pyx":62 +/* "claude_low_level_library.pyx":63 * * # power incident on (lat,lon) at time t * def solar(DTYPE_f insolation,DTYPE_f lat,DTYPE_f lon,np.int_t t,DTYPE_f day,DTYPE_f year,DTYPE_f axial_tilt): # <<<<<<<<<<<<<< @@ -3861,41 +3914,41 @@ static PyObject *__pyx_pw_24claude_low_level_library_17solar(PyObject *__pyx_sel case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 1); __PYX_ERR(0, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 1); __PYX_ERR(0, 63, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lon)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 2); __PYX_ERR(0, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 2); __PYX_ERR(0, 63, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 3); __PYX_ERR(0, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 3); __PYX_ERR(0, 63, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_day)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 4); __PYX_ERR(0, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 4); __PYX_ERR(0, 63, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_year)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 5); __PYX_ERR(0, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 5); __PYX_ERR(0, 63, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_axial_tilt)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 6); __PYX_ERR(0, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, 6); __PYX_ERR(0, 63, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solar") < 0)) __PYX_ERR(0, 62, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solar") < 0)) __PYX_ERR(0, 63, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -3908,17 +3961,17 @@ static PyObject *__pyx_pw_24claude_low_level_library_17solar(PyObject *__pyx_sel values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } - __pyx_v_insolation = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_insolation == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L3_error) - __pyx_v_lat = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_lat == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L3_error) - __pyx_v_lon = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_lon == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L3_error) - __pyx_v_t = __Pyx_PyInt_As_npy_long(values[3]); if (unlikely((__pyx_v_t == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L3_error) - __pyx_v_day = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_day == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L3_error) - __pyx_v_year = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_year == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L3_error) - __pyx_v_axial_tilt = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_axial_tilt == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L3_error) + __pyx_v_insolation = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_insolation == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L3_error) + __pyx_v_lat = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_lat == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L3_error) + __pyx_v_lon = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_lon == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L3_error) + __pyx_v_t = __Pyx_PyInt_As_npy_long(values[3]); if (unlikely((__pyx_v_t == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L3_error) + __pyx_v_day = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_day == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L3_error) + __pyx_v_year = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_year == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L3_error) + __pyx_v_axial_tilt = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_axial_tilt == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 62, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("solar", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 63, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("claude_low_level_library.solar", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3953,7 +4006,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("solar", 0); - /* "claude_low_level_library.pyx":63 + /* "claude_low_level_library.pyx":64 * # power incident on (lat,lon) at time t * def solar(DTYPE_f insolation,DTYPE_f lat,DTYPE_f lon,np.int_t t,DTYPE_f day,DTYPE_f year,DTYPE_f axial_tilt): * cdef float sun_longitude = -t % day # <<<<<<<<<<<<<< @@ -3963,38 +4016,38 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_1 = (-__pyx_v_t); if (unlikely(__pyx_v_day == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()"); - __PYX_ERR(0, 63, __pyx_L1_error) + __PYX_ERR(0, 64, __pyx_L1_error) } __pyx_v_sun_longitude = __Pyx_mod___pyx_t_24claude_low_level_library_DTYPE_f(__pyx_t_1, __pyx_v_day); - /* "claude_low_level_library.pyx":64 + /* "claude_low_level_library.pyx":65 * def solar(DTYPE_f insolation,DTYPE_f lat,DTYPE_f lon,np.int_t t,DTYPE_f day,DTYPE_f year,DTYPE_f axial_tilt): * cdef float sun_longitude = -t % day * cdef float sun_latitude = axial_tilt*np.cos(t*2*np.pi/year) # <<<<<<<<<<<<<< * cdef float value = insolation*np.cos((lat-sun_latitude)*inv_180) * cdef float lon_diff, cos_lon */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_axial_tilt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_axial_tilt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_npy_long((__pyx_v_t * 2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_npy_long((__pyx_v_t * 2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_pi); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_pi); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyFloat_FromDouble(__pyx_v_year); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_year); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -4011,32 +4064,32 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_5); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_5); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_sun_latitude = __pyx_t_8; - /* "claude_low_level_library.pyx":65 + /* "claude_low_level_library.pyx":66 * cdef float sun_longitude = -t % day * cdef float sun_latitude = axial_tilt*np.cos(t*2*np.pi/year) * cdef float value = insolation*np.cos((lat-sun_latitude)*inv_180) # <<<<<<<<<<<<<< * cdef float lon_diff, cos_lon * */ - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_insolation); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_insolation); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_lat - __pyx_v_sun_latitude) * __pyx_v_24claude_low_level_library_inv_180)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_lat - __pyx_v_sun_latitude) * __pyx_v_24claude_low_level_library_inv_180)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -4051,18 +4104,18 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_value = __pyx_t_8; - /* "claude_low_level_library.pyx":68 + /* "claude_low_level_library.pyx":69 * cdef float lon_diff, cos_lon * * if value < 0: # <<<<<<<<<<<<<< @@ -4072,7 +4125,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_9 = ((__pyx_v_value < 0.0) != 0); if (__pyx_t_9) { - /* "claude_low_level_library.pyx":69 + /* "claude_low_level_library.pyx":70 * * if value < 0: * return 0 # <<<<<<<<<<<<<< @@ -4084,7 +4137,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_r = __pyx_int_0; goto __pyx_L0; - /* "claude_low_level_library.pyx":68 + /* "claude_low_level_library.pyx":69 * cdef float lon_diff, cos_lon * * if value < 0: # <<<<<<<<<<<<<< @@ -4093,7 +4146,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj */ } - /* "claude_low_level_library.pyx":71 + /* "claude_low_level_library.pyx":72 * return 0 * else: * sun_longitude *= 360/day # <<<<<<<<<<<<<< @@ -4103,11 +4156,11 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj /*else*/ { if (unlikely(__pyx_v_day == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "float division"); - __PYX_ERR(0, 71, __pyx_L1_error) + __PYX_ERR(0, 72, __pyx_L1_error) } __pyx_v_sun_longitude = (__pyx_v_sun_longitude * (360.0 / __pyx_v_day)); - /* "claude_low_level_library.pyx":72 + /* "claude_low_level_library.pyx":73 * else: * sun_longitude *= 360/day * lon_diff = lon-sun_longitude # <<<<<<<<<<<<<< @@ -4116,19 +4169,19 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj */ __pyx_v_lon_diff = (__pyx_v_lon - __pyx_v_sun_longitude); - /* "claude_low_level_library.pyx":73 + /* "claude_low_level_library.pyx":74 * sun_longitude *= 360/day * lon_diff = lon-sun_longitude * cos_lon = np.cos(lon_diff*inv_180) # <<<<<<<<<<<<<< * value *= cos_lon * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyFloat_FromDouble((__pyx_v_lon_diff * __pyx_v_24claude_low_level_library_inv_180)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble((__pyx_v_lon_diff * __pyx_v_24claude_low_level_library_inv_180)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { @@ -4143,14 +4196,14 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_cos_lon = __pyx_t_8; - /* "claude_low_level_library.pyx":74 + /* "claude_low_level_library.pyx":75 * lon_diff = lon-sun_longitude * cos_lon = np.cos(lon_diff*inv_180) * value *= cos_lon # <<<<<<<<<<<<<< @@ -4159,7 +4212,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj */ __pyx_v_value = (__pyx_v_value * __pyx_v_cos_lon); - /* "claude_low_level_library.pyx":76 + /* "claude_low_level_library.pyx":77 * value *= cos_lon * * if value < 0: # <<<<<<<<<<<<<< @@ -4169,7 +4222,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_9 = ((__pyx_v_value < 0.0) != 0); if (__pyx_t_9) { - /* "claude_low_level_library.pyx":77 + /* "claude_low_level_library.pyx":78 * * if value < 0: * if lat + sun_latitude > 90: # <<<<<<<<<<<<<< @@ -4179,7 +4232,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_9 = (((__pyx_v_lat + __pyx_v_sun_latitude) > 90.0) != 0); if (__pyx_t_9) { - /* "claude_low_level_library.pyx":78 + /* "claude_low_level_library.pyx":79 * if value < 0: * if lat + sun_latitude > 90: * return insolation*np.cos((lat+sun_latitude)*inv_180)*cos_lon # <<<<<<<<<<<<<< @@ -4187,14 +4240,14 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj * return insolation*np.cos((lat+sun_latitude)*inv_180)*cos_lon */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_insolation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_insolation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_lat + __pyx_v_sun_latitude) * __pyx_v_24claude_low_level_library_inv_180)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_lat + __pyx_v_sun_latitude) * __pyx_v_24claude_low_level_library_inv_180)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -4209,16 +4262,16 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_cos_lon); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_cos_lon); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -4226,7 +4279,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_4 = 0; goto __pyx_L0; - /* "claude_low_level_library.pyx":77 + /* "claude_low_level_library.pyx":78 * * if value < 0: * if lat + sun_latitude > 90: # <<<<<<<<<<<<<< @@ -4235,7 +4288,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj */ } - /* "claude_low_level_library.pyx":79 + /* "claude_low_level_library.pyx":80 * if lat + sun_latitude > 90: * return insolation*np.cos((lat+sun_latitude)*inv_180)*cos_lon * elif lat + sun_latitude < -90: # <<<<<<<<<<<<<< @@ -4245,7 +4298,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_9 = (((__pyx_v_lat + __pyx_v_sun_latitude) < -90.0) != 0); if (__pyx_t_9) { - /* "claude_low_level_library.pyx":80 + /* "claude_low_level_library.pyx":81 * return insolation*np.cos((lat+sun_latitude)*inv_180)*cos_lon * elif lat + sun_latitude < -90: * return insolation*np.cos((lat+sun_latitude)*inv_180)*cos_lon # <<<<<<<<<<<<<< @@ -4253,14 +4306,14 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj * return 0 */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_insolation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_insolation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_lat + __pyx_v_sun_latitude) * __pyx_v_24claude_low_level_library_inv_180)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_lat + __pyx_v_sun_latitude) * __pyx_v_24claude_low_level_library_inv_180)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -4275,16 +4328,16 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_cos_lon); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_cos_lon); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -4292,7 +4345,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj __pyx_t_4 = 0; goto __pyx_L0; - /* "claude_low_level_library.pyx":79 + /* "claude_low_level_library.pyx":80 * if lat + sun_latitude > 90: * return insolation*np.cos((lat+sun_latitude)*inv_180)*cos_lon * elif lat + sun_latitude < -90: # <<<<<<<<<<<<<< @@ -4301,7 +4354,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj */ } - /* "claude_low_level_library.pyx":82 + /* "claude_low_level_library.pyx":83 * return insolation*np.cos((lat+sun_latitude)*inv_180)*cos_lon * else: * return 0 # <<<<<<<<<<<<<< @@ -4315,7 +4368,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj goto __pyx_L0; } - /* "claude_low_level_library.pyx":76 + /* "claude_low_level_library.pyx":77 * value *= cos_lon * * if value < 0: # <<<<<<<<<<<<<< @@ -4324,16 +4377,16 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj */ } - /* "claude_low_level_library.pyx":84 + /* "claude_low_level_library.pyx":85 * return 0 * else: * return value # <<<<<<<<<<<<<< * - * def profile(a): + * def profile(np.ndarray a): */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -4341,7 +4394,7 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj } } - /* "claude_low_level_library.pyx":62 + /* "claude_low_level_library.pyx":63 * * # power incident on (lat,lon) at time t * def solar(DTYPE_f insolation,DTYPE_f lat,DTYPE_f lon,np.int_t t,DTYPE_f day,DTYPE_f year,DTYPE_f axial_tilt): # <<<<<<<<<<<<<< @@ -4365,10 +4418,10 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj return __pyx_r; } -/* "claude_low_level_library.pyx":86 +/* "claude_low_level_library.pyx":87 * return value * - * def profile(a): # <<<<<<<<<<<<<< + * def profile(np.ndarray a): # <<<<<<<<<<<<<< * return np.mean(np.mean(a,axis=0),axis=0) */ @@ -4376,17 +4429,25 @@ static PyObject *__pyx_pf_24claude_low_level_library_16solar(CYTHON_UNUSED PyObj static PyObject *__pyx_pw_24claude_low_level_library_19profile(PyObject *__pyx_self, PyObject *__pyx_v_a); /*proto*/ static PyMethodDef __pyx_mdef_24claude_low_level_library_19profile = {"profile", (PyCFunction)__pyx_pw_24claude_low_level_library_19profile, METH_O, 0}; static PyObject *__pyx_pw_24claude_low_level_library_19profile(PyObject *__pyx_self, PyObject *__pyx_v_a) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("profile (wrapper)", 0); - __pyx_r = __pyx_pf_24claude_low_level_library_18profile(__pyx_self, ((PyObject *)__pyx_v_a)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_r = __pyx_pf_24claude_low_level_library_18profile(__pyx_self, ((PyArrayObject *)__pyx_v_a)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_24claude_low_level_library_18profile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a) { +static PyObject *__pyx_pf_24claude_low_level_library_18profile(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4399,44 +4460,44 @@ static PyObject *__pyx_pf_24claude_low_level_library_18profile(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("profile", 0); - /* "claude_low_level_library.pyx":87 + /* "claude_low_level_library.pyx":88 * - * def profile(a): + * def profile(np.ndarray a): * return np.mean(np.mean(a,axis=0),axis=0) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_mean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_mean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_a); - __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_a)); + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 87, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 87, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -4445,10 +4506,10 @@ static PyObject *__pyx_pf_24claude_low_level_library_18profile(CYTHON_UNUSED PyO __pyx_t_1 = 0; goto __pyx_L0; - /* "claude_low_level_library.pyx":86 + /* "claude_low_level_library.pyx":87 * return value * - * def profile(a): # <<<<<<<<<<<<<< + * def profile(np.ndarray a): # <<<<<<<<<<<<<< * return np.mean(np.mean(a,axis=0),axis=0) */ @@ -6982,6 +7043,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_insolation, __pyx_k_insolation, sizeof(__pyx_k_insolation), 0, 0, 1, 1}, + {&__pyx_n_s_inv_90, __pyx_k_inv_90, sizeof(__pyx_k_inv_90), 0, 0, 1, 1}, {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, {&__pyx_n_s_lat, __pyx_k_lat, sizeof(__pyx_k_lat), 0, 0, 1, 1}, @@ -7005,7 +7067,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_scalar_gradient_x, __pyx_k_scalar_gradient_x, sizeof(__pyx_k_scalar_gradient_x), 0, 0, 1, 1}, {&__pyx_n_s_scalar_gradient_x_2D, __pyx_k_scalar_gradient_x_2D, sizeof(__pyx_k_scalar_gradient_x_2D), 0, 0, 1, 1}, {&__pyx_n_s_scalar_gradient_y, __pyx_k_scalar_gradient_y, sizeof(__pyx_k_scalar_gradient_y), 0, 0, 1, 1}, - {&__pyx_n_s_scalar_gradient_y_2d, __pyx_k_scalar_gradient_y_2d, sizeof(__pyx_k_scalar_gradient_y_2d), 0, 0, 1, 1}, + {&__pyx_n_s_scalar_gradient_y_2D, __pyx_k_scalar_gradient_y_2D, sizeof(__pyx_k_scalar_gradient_y_2D), 0, 0, 1, 1}, {&__pyx_n_s_scalar_gradient_z, __pyx_k_scalar_gradient_z, sizeof(__pyx_k_scalar_gradient_z), 0, 0, 1, 1}, {&__pyx_n_s_scalar_gradient_z_1D, __pyx_k_scalar_gradient_z_1D, sizeof(__pyx_k_scalar_gradient_z_1D), 0, 0, 1, 1}, {&__pyx_n_s_sigma, __pyx_k_sigma, sizeof(__pyx_k_sigma), 0, 0, 1, 1}, @@ -7127,7 +7189,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { /* "claude_low_level_library.pyx":16 * return (a[i,(j+1)%nlon,k]-a[i,(j-1)%nlon,k])/dx[i] * - * def scalar_gradient_x_2D(a,dx,nlon,i,j): # <<<<<<<<<<<<<< + * def scalar_gradient_x_2D(np.ndarray a,np.ndarray dx,np.int_t nlon,np.int_t i,np.int_t j): # <<<<<<<<<<<<<< * return (a[i,(j+1)%nlon]-a[i,(j-1)%nlon])/dx[i] * */ @@ -7151,19 +7213,19 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { /* "claude_low_level_library.pyx":28 * return (a[i+1,j,k]-a[i-1,j,k])/dy * - * def scalar_gradient_y_2d(a,dy,nlat,i,j): # <<<<<<<<<<<<<< + * def scalar_gradient_y_2D(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t j): # <<<<<<<<<<<<<< * if i == 0: * return 2*(a[i+1,j]-a[i,j])/dy */ __pyx_tuple__14 = PyTuple_Pack(5, __pyx_n_s_a, __pyx_n_s_dy, __pyx_n_s_nlat, __pyx_n_s_i, __pyx_n_s_j); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_scalar_gradient_y_2d, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_scalar_gradient_y_2D, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 28, __pyx_L1_error) /* "claude_low_level_library.pyx":36 * return (a[i+1,j]-a[i-1,j])/dy * - * def scalar_gradient_z(a,dz,i,j,k): # <<<<<<<<<<<<<< + * def scalar_gradient_z(np.ndarray a,np.ndarray dz,np.int_t i,np.int_t j,np.int_t k): # <<<<<<<<<<<<<< * cdef np.int_t nlevels = len(dz) * if k == 0: */ @@ -7188,48 +7250,48 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return (a[k+1]-a[k-1])/(2*dz[k]) * * def surface_optical_depth(DTYPE_f lat): # <<<<<<<<<<<<<< - * return 4 + np.cos(lat*inv_90)*2.5 - * + * cdef DTYPE_f inv_90 + * return 4 + np.cos(lat*inv_90)*2 */ - __pyx_tuple__20 = PyTuple_Pack(2, __pyx_n_s_lat, __pyx_n_s_lat); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(3, __pyx_n_s_lat, __pyx_n_s_lat, __pyx_n_s_inv_90); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_surface_optical_depth, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_surface_optical_depth, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 54, __pyx_L1_error) - /* "claude_low_level_library.pyx":57 - * return 4 + np.cos(lat*inv_90)*2.5 + /* "claude_low_level_library.pyx":58 + * return 4 + np.cos(lat*inv_90)*2 * * def thermal_radiation(DTYPE_f a): # <<<<<<<<<<<<<< * cdef DTYPE_f sigma = 5.67E-8 * return sigma*(a**4) */ - __pyx_tuple__22 = PyTuple_Pack(3, __pyx_n_s_a, __pyx_n_s_a, __pyx_n_s_sigma); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(3, __pyx_n_s_a, __pyx_n_s_a, __pyx_n_s_sigma); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_thermal_radiation, 57, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_thermal_radiation, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 58, __pyx_L1_error) - /* "claude_low_level_library.pyx":62 + /* "claude_low_level_library.pyx":63 * * # power incident on (lat,lon) at time t * def solar(DTYPE_f insolation,DTYPE_f lat,DTYPE_f lon,np.int_t t,DTYPE_f day,DTYPE_f year,DTYPE_f axial_tilt): # <<<<<<<<<<<<<< * cdef float sun_longitude = -t % day * cdef float sun_latitude = axial_tilt*np.cos(t*2*np.pi/year) */ - __pyx_tuple__24 = PyTuple_Pack(12, __pyx_n_s_insolation, __pyx_n_s_lat, __pyx_n_s_lon, __pyx_n_s_t, __pyx_n_s_day, __pyx_n_s_year, __pyx_n_s_axial_tilt, __pyx_n_s_sun_longitude, __pyx_n_s_sun_latitude, __pyx_n_s_value, __pyx_n_s_lon_diff, __pyx_n_s_cos_lon); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(12, __pyx_n_s_insolation, __pyx_n_s_lat, __pyx_n_s_lon, __pyx_n_s_t, __pyx_n_s_day, __pyx_n_s_year, __pyx_n_s_axial_tilt, __pyx_n_s_sun_longitude, __pyx_n_s_sun_latitude, __pyx_n_s_value, __pyx_n_s_lon_diff, __pyx_n_s_cos_lon); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_solar, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_solar, 63, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 63, __pyx_L1_error) - /* "claude_low_level_library.pyx":86 + /* "claude_low_level_library.pyx":87 * return value * - * def profile(a): # <<<<<<<<<<<<<< + * def profile(np.ndarray a): # <<<<<<<<<<<<<< * return np.mean(np.mean(a,axis=0),axis=0) */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_a); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_a); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_profile, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_low_level_library_pyx, __pyx_n_s_profile, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -7239,9 +7301,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_float_2_5 = PyFloat_FromDouble(2.5); if (unlikely(!__pyx_float_2_5)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_90 = PyInt_FromLong(90); if (unlikely(!__pyx_int_90)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -7616,7 +7676,7 @@ if (!__Pyx_RefNanny) { /* "claude_low_level_library.pyx":16 * return (a[i,(j+1)%nlon,k]-a[i,(j-1)%nlon,k])/dx[i] * - * def scalar_gradient_x_2D(a,dx,nlon,i,j): # <<<<<<<<<<<<<< + * def scalar_gradient_x_2D(np.ndarray a,np.ndarray dx,np.int_t nlon,np.int_t i,np.int_t j): # <<<<<<<<<<<<<< * return (a[i,(j+1)%nlon]-a[i,(j-1)%nlon])/dx[i] * */ @@ -7640,19 +7700,19 @@ if (!__Pyx_RefNanny) { /* "claude_low_level_library.pyx":28 * return (a[i+1,j,k]-a[i-1,j,k])/dy * - * def scalar_gradient_y_2d(a,dy,nlat,i,j): # <<<<<<<<<<<<<< + * def scalar_gradient_y_2D(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t j): # <<<<<<<<<<<<<< * if i == 0: * return 2*(a[i+1,j]-a[i,j])/dy */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_low_level_library_7scalar_gradient_y_2d, NULL, __pyx_n_s_claude_low_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_low_level_library_7scalar_gradient_y_2D, NULL, __pyx_n_s_claude_low_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_scalar_gradient_y_2d, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_scalar_gradient_y_2D, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "claude_low_level_library.pyx":36 * return (a[i+1,j]-a[i-1,j])/dy * - * def scalar_gradient_z(a,dz,i,j,k): # <<<<<<<<<<<<<< + * def scalar_gradient_z(np.ndarray a,np.ndarray dz,np.int_t i,np.int_t j,np.int_t k): # <<<<<<<<<<<<<< * cdef np.int_t nlevels = len(dz) * if k == 0: */ @@ -7677,47 +7737,47 @@ if (!__Pyx_RefNanny) { * return (a[k+1]-a[k-1])/(2*dz[k]) * * def surface_optical_depth(DTYPE_f lat): # <<<<<<<<<<<<<< - * return 4 + np.cos(lat*inv_90)*2.5 - * + * cdef DTYPE_f inv_90 + * return 4 + np.cos(lat*inv_90)*2 */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_low_level_library_13surface_optical_depth, NULL, __pyx_n_s_claude_low_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_surface_optical_depth, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "claude_low_level_library.pyx":57 - * return 4 + np.cos(lat*inv_90)*2.5 + /* "claude_low_level_library.pyx":58 + * return 4 + np.cos(lat*inv_90)*2 * * def thermal_radiation(DTYPE_f a): # <<<<<<<<<<<<<< * cdef DTYPE_f sigma = 5.67E-8 * return sigma*(a**4) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_low_level_library_15thermal_radiation, NULL, __pyx_n_s_claude_low_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_low_level_library_15thermal_radiation, NULL, __pyx_n_s_claude_low_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_thermal_radiation, __pyx_t_1) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_thermal_radiation, __pyx_t_1) < 0) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "claude_low_level_library.pyx":62 + /* "claude_low_level_library.pyx":63 * * # power incident on (lat,lon) at time t * def solar(DTYPE_f insolation,DTYPE_f lat,DTYPE_f lon,np.int_t t,DTYPE_f day,DTYPE_f year,DTYPE_f axial_tilt): # <<<<<<<<<<<<<< * cdef float sun_longitude = -t % day * cdef float sun_latitude = axial_tilt*np.cos(t*2*np.pi/year) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_low_level_library_17solar, NULL, __pyx_n_s_claude_low_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_low_level_library_17solar, NULL, __pyx_n_s_claude_low_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_solar, __pyx_t_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_solar, __pyx_t_1) < 0) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "claude_low_level_library.pyx":86 + /* "claude_low_level_library.pyx":87 * return value * - * def profile(a): # <<<<<<<<<<<<<< + * def profile(np.ndarray a): # <<<<<<<<<<<<<< * return np.mean(np.mean(a,axis=0),axis=0) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_low_level_library_19profile, NULL, __pyx_n_s_claude_low_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_low_level_library_19profile, NULL, __pyx_n_s_claude_low_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_profile, __pyx_t_1) < 0) __PYX_ERR(0, 86, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_profile, __pyx_t_1) < 0) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "claude_low_level_library.pyx":1 @@ -8067,321 +8127,6 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } #endif -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); -} -#endif - -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a - b); - if (likely((x^a) >= 0 || (x^~b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - } - x = a - b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla - llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("subtract", return NULL) - result = ((double)a) - (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); -} -#endif - -/* PyIntCompare */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { - if (op1 == op2) { - Py_RETURN_TRUE; - } - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - int unequal; - unsigned long uintval; - Py_ssize_t size = Py_SIZE(op1); - const digit* digits = ((PyLongObject*)op1)->ob_digit; - if (intval == 0) { - if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } else if (intval < 0) { - if (size >= 0) - Py_RETURN_FALSE; - intval = -intval; - size = -size; - } else { - if (size <= 0) - Py_RETURN_FALSE; - } - uintval = (unsigned long) intval; -#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 4)) { - unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 3)) { - unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 2)) { - unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 1)) { - unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif - unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); - if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - return ( - PyObject_RichCompare(op1, op2, Py_EQ)); -} - /* PyIntBinop */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { diff --git a/claude_low_level_library.cp38-win_amd64.pyd b/claude_low_level_library.cp38-win_amd64.pyd index 0171c42..ff7b430 100644 Binary files a/claude_low_level_library.cp38-win_amd64.pyd and b/claude_low_level_library.cp38-win_amd64.pyd differ diff --git a/claude_low_level_library.pyx b/claude_low_level_library.pyx index aa6994c..db03ae5 100644 --- a/claude_low_level_library.pyx +++ b/claude_low_level_library.pyx @@ -13,7 +13,7 @@ cdef float inv_90 = np.pi/90 def scalar_gradient_x(np.ndarray a,np.ndarray dx,np.int_t nlon,np.int_t i,np.int_t j,np.int_t k): return (a[i,(j+1)%nlon,k]-a[i,(j-1)%nlon,k])/dx[i] -def scalar_gradient_x_2D(a,dx,nlon,i,j): +def scalar_gradient_x_2D(np.ndarray a,np.ndarray dx,np.int_t nlon,np.int_t i,np.int_t j): return (a[i,(j+1)%nlon]-a[i,(j-1)%nlon])/dx[i] # gradient of scalar field a in the local y direction at point i,j @@ -25,7 +25,7 @@ def scalar_gradient_y(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t else: return (a[i+1,j,k]-a[i-1,j,k])/dy -def scalar_gradient_y_2d(a,dy,nlat,i,j): +def scalar_gradient_y_2D(np.ndarray a,DTYPE_f dy,np.int_t nlat,np.int_t i,np.int_t j): if i == 0: return 2*(a[i+1,j]-a[i,j])/dy elif i == nlat-1: @@ -33,7 +33,7 @@ def scalar_gradient_y_2d(a,dy,nlat,i,j): else: return (a[i+1,j]-a[i-1,j])/dy -def scalar_gradient_z(a,dz,i,j,k): +def scalar_gradient_z(np.ndarray a,np.ndarray dz,np.int_t i,np.int_t j,np.int_t k): cdef np.int_t nlevels = len(dz) if k == 0: return (a[i,j,k+1]-a[i,j,k])/dz[k] @@ -52,7 +52,8 @@ def scalar_gradient_z_1D(np.ndarray a,np.ndarray dz,np.int_t k): return (a[k+1]-a[k-1])/(2*dz[k]) def surface_optical_depth(DTYPE_f lat): - return 4 + np.cos(lat*inv_90)*2.5 + cdef DTYPE_f inv_90 + return 4 + np.cos(lat*inv_90)*2 def thermal_radiation(DTYPE_f a): cdef DTYPE_f sigma = 5.67E-8 @@ -83,5 +84,5 @@ def solar(DTYPE_f insolation,DTYPE_f lat,DTYPE_f lon,np.int_t t,DTYPE_f day,DT else: return value -def profile(a): +def profile(np.ndarray a): return np.mean(np.mean(a,axis=0),axis=0) \ No newline at end of file diff --git a/claude_top_level_library.c b/claude_top_level_library.c index 181420f..f02cb85 100644 --- a/claude_top_level_library.c +++ b/claude_top_level_library.c @@ -1203,6 +1203,12 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1298,30 +1304,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); -/* SliceObject.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* IterFinish.proto */ -static CYTHON_INLINE int __Pyx_IterFinish(void); - -/* UnpackItemEndCheck.proto */ -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); - -/* ArgTypeTest.proto */ -#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ - __Pyx__ArgTypeTest(obj, type, name, exact)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); @@ -1412,6 +1394,13 @@ static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, long int (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) #endif +/* PyObjectCallNoArg.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif + /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; @@ -1462,6 +1451,12 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); @@ -1543,6 +1538,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_long(npy_long value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value); + /* RealImag.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -1728,6 +1726,7 @@ static const char __pyx_k_v[] = "v"; static const char __pyx_k_w[] = "w"; static const char __pyx_k_au[] = "au"; static const char __pyx_k_av[] = "av"; +static const char __pyx_k_aw[] = "aw"; static const char __pyx_k_dt[] = "dt"; static const char __pyx_k_dx[] = "dx"; static const char __pyx_k_dy[] = "dy"; @@ -1735,29 +1734,37 @@ static const char __pyx_k_dz[] = "dz"; static const char __pyx_k_fl[] = "fl"; static const char __pyx_k_np[] = "np"; static const char __pyx_k_day[] = "day"; +static const char __pyx_k_fft[] = "fft"; static const char __pyx_k_lat[] = "lat"; static const char __pyx_k_lon[] = "lon"; +static const char __pyx_k_fftn[] = "fftn"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "__name__"; static const char __pyx_k_nlat[] = "nlat"; static const char __pyx_k_nlon[] = "nlon"; -static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_real[] = "real"; +static const char __pyx_k_test[] = "test"; static const char __pyx_k_year[] = "year"; +static const char __pyx_k_ifftn[] = "ifftn"; static const char __pyx_k_numpy[] = "numpy"; static const char __pyx_k_range[] = "range"; -static const char __pyx_k_shape[] = "shape"; static const char __pyx_k_solar[] = "solar"; static const char __pyx_k_zeros[] = "zeros"; static const char __pyx_k_albedo[] = "albedo"; static const char __pyx_k_arange[] = "arange"; static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_inv_dx[] = "inv_dx"; +static const char __pyx_k_inv_dy[] = "inv_dy"; static const char __pyx_k_output[] = "output"; +static const char __pyx_k_test_2[] = "__test__"; +static const char __pyx_k_tolist[] = "tolist"; static const char __pyx_k_u_temp[] = "u_temp"; static const char __pyx_k_v_temp[] = "v_temp"; static const char __pyx_k_w_temp[] = "w_temp"; static const char __pyx_k_gravity[] = "gravity"; static const char __pyx_k_heights[] = "heights"; static const char __pyx_k_nlevels[] = "nlevels"; +static const char __pyx_k_sun_lat[] = "sun_lat"; static const char __pyx_k_coriolis[] = "coriolis"; static const char __pyx_k_low_level[] = "low_level"; static const char __pyx_k_ValueError[] = "ValueError"; @@ -1766,21 +1773,30 @@ static const char __pyx_k_insolation[] = "insolation"; static const char __pyx_k_zeros_like[] = "zeros_like"; static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_air_density[] = "air_density"; +static const char __pyx_k_inv_density[] = "inv_density"; +static const char __pyx_k_inv_dt_grav[] = "inv_dt_grav"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; static const char __pyx_k_air_pressure[] = "air_pressure"; +static const char __pyx_k_laplacian_2D[] = "laplacian_2D"; +static const char __pyx_k_laplacian_3D[] = "laplacian_3D"; static const char __pyx_k_old_pressure[] = "old_pressure"; +static const char __pyx_k_smoothing_3D[] = "smoothing_3D"; static const char __pyx_k_optical_depth[] = "optical_depth"; static const char __pyx_k_density_profile[] = "density_profile"; static const char __pyx_k_pressure_profile[] = "pressure_profile"; +static const char __pyx_k_smooth_parameter[] = "smooth_parameter"; static const char __pyx_k_upward_radiation[] = "upward_radiation"; static const char __pyx_k_scalar_gradient_x[] = "scalar_gradient_x"; static const char __pyx_k_scalar_gradient_y[] = "scalar_gradient_y"; +static const char __pyx_k_scalar_gradient_z[] = "scalar_gradient_z"; static const char __pyx_k_temperature_atmos[] = "temperature_atmos"; static const char __pyx_k_temperature_world[] = "temperature_world"; static const char __pyx_k_thermal_radiation[] = "thermal_radiation"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_downward_radiation[] = "downward_radiation"; static const char __pyx_k_heat_capacity_earth[] = "heat_capacity_earth"; +static const char __pyx_k_scalar_gradient_x_2D[] = "scalar_gradient_x_2D"; +static const char __pyx_k_scalar_gradient_y_2D[] = "scalar_gradient_y_2D"; static const char __pyx_k_scalar_gradient_z_1D[] = "scalar_gradient_z_1D"; static const char __pyx_k_velocity_calculation[] = "velocity_calculation"; static const char __pyx_k_radiation_calculation[] = "radiation_calculation"; @@ -1811,6 +1827,7 @@ static PyObject *__pyx_n_s_albedo; static PyObject *__pyx_n_s_arange; static PyObject *__pyx_n_s_au; static PyObject *__pyx_n_s_av; +static PyObject *__pyx_n_s_aw; static PyObject *__pyx_n_s_axial_tilt; static PyObject *__pyx_n_s_claude_low_level_library; static PyObject *__pyx_n_s_claude_top_level_library; @@ -1825,15 +1842,24 @@ static PyObject *__pyx_n_s_dt; static PyObject *__pyx_n_s_dx; static PyObject *__pyx_n_s_dy; static PyObject *__pyx_n_s_dz; +static PyObject *__pyx_n_s_fft; +static PyObject *__pyx_n_s_fftn; static PyObject *__pyx_n_s_fl; static PyObject *__pyx_n_s_gravity; static PyObject *__pyx_n_s_heat_capacity_earth; static PyObject *__pyx_n_s_heights; static PyObject *__pyx_n_s_i; +static PyObject *__pyx_n_s_ifftn; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_insolation; +static PyObject *__pyx_n_s_inv_density; +static PyObject *__pyx_n_s_inv_dt_grav; +static PyObject *__pyx_n_s_inv_dx; +static PyObject *__pyx_n_s_inv_dy; static PyObject *__pyx_n_s_j; static PyObject *__pyx_n_s_k; +static PyObject *__pyx_n_s_laplacian_2D; +static PyObject *__pyx_n_s_laplacian_3D; static PyObject *__pyx_n_s_lat; static PyObject *__pyx_n_s_lon; static PyObject *__pyx_n_s_low_level; @@ -1854,17 +1880,25 @@ static PyObject *__pyx_n_s_output; static PyObject *__pyx_n_s_pressure_profile; static PyObject *__pyx_n_s_radiation_calculation; static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_real; static PyObject *__pyx_n_s_scalar_gradient_x; +static PyObject *__pyx_n_s_scalar_gradient_x_2D; static PyObject *__pyx_n_s_scalar_gradient_y; +static PyObject *__pyx_n_s_scalar_gradient_y_2D; +static PyObject *__pyx_n_s_scalar_gradient_z; static PyObject *__pyx_n_s_scalar_gradient_z_1D; -static PyObject *__pyx_n_s_shape; +static PyObject *__pyx_n_s_smooth_parameter; +static PyObject *__pyx_n_s_smoothing_3D; static PyObject *__pyx_n_s_solar; +static PyObject *__pyx_n_s_sun_lat; static PyObject *__pyx_n_s_surface_optical_depth; static PyObject *__pyx_n_s_t; static PyObject *__pyx_n_s_temperature_atmos; static PyObject *__pyx_n_s_temperature_world; static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_test_2; static PyObject *__pyx_n_s_thermal_radiation; +static PyObject *__pyx_n_s_tolist; static PyObject *__pyx_n_s_u; static PyObject *__pyx_n_s_u_temp; static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; @@ -1877,17 +1911,23 @@ static PyObject *__pyx_n_s_w_temp; static PyObject *__pyx_n_s_year; static PyObject *__pyx_n_s_zeros; static PyObject *__pyx_n_s_zeros_like; -static PyObject *__pyx_pf_24claude_top_level_library_divergence_with_scalar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_u, PyObject *__pyx_v_v, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy); /* proto */ -static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_temperature_world, PyArrayObject *__pyx_v_temperature_atmos, PyArrayObject *__pyx_v_air_pressure, PyArrayObject *__pyx_v_air_density, PyArrayObject *__pyx_v_heat_capacity_earth, PyArrayObject *__pyx_v_albedo, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_insolation, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, PyArrayObject *__pyx_v_heights, PyArrayObject *__pyx_v_dz, __pyx_t_5numpy_int_t __pyx_v_t, __pyx_t_5numpy_int_t __pyx_v_dt, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_day, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_year, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_axial_tilt); /* proto */ -static PyObject *__pyx_pf_24claude_top_level_library_4velocity_calculation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_u, PyObject *__pyx_v_v, PyObject *__pyx_v_air_pressure, PyObject *__pyx_v_old_pressure, PyObject *__pyx_v_air_density, PyObject *__pyx_v_coriolis, PyObject *__pyx_v_gravity, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy, PyObject *__pyx_v_dt); /* proto */ +static PyObject *__pyx_pf_24claude_top_level_library_laplacian_2D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dx, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy); /* proto */ +static PyObject *__pyx_pf_24claude_top_level_library_2laplacian_3D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dx, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy, PyArrayObject *__pyx_v_dz); /* proto */ +static PyObject *__pyx_pf_24claude_top_level_library_4divergence_with_scalar(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_u, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dx, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy, PyArrayObject *__pyx_v_dz); /* proto */ +static PyObject *__pyx_pf_24claude_top_level_library_6radiation_calculation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_temperature_world, PyArrayObject *__pyx_v_temperature_atmos, PyArrayObject *__pyx_v_air_pressure, PyArrayObject *__pyx_v_air_density, PyArrayObject *__pyx_v_heat_capacity_earth, PyArrayObject *__pyx_v_albedo, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_insolation, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, PyArrayObject *__pyx_v_heights, PyArrayObject *__pyx_v_dz, __pyx_t_5numpy_int_t __pyx_v_t, __pyx_t_5numpy_int_t __pyx_v_dt, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_day, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_year, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_axial_tilt); /* proto */ +static PyObject *__pyx_pf_24claude_top_level_library_8velocity_calculation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_u, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_air_pressure, PyArrayObject *__pyx_v_old_pressure, PyArrayObject *__pyx_v_air_density, PyArrayObject *__pyx_v_coriolis, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_gravity, PyArrayObject *__pyx_v_dx, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dt); /* proto */ +static PyObject *__pyx_pf_24claude_top_level_library_10smoothing_3D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_smooth_parameter); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static PyObject *__pyx_float_0_8; static PyObject *__pyx_float_1E3; +static PyObject *__pyx_float_0_05; static PyObject *__pyx_float_0_95; static PyObject *__pyx_float_20E3; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; static PyObject *__pyx_int_4; static PyObject *__pyx_int_5; static PyObject *__pyx_int_900; @@ -1903,30 +1943,1689 @@ static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_codeobj__11; -static PyObject *__pyx_codeobj__13; -static PyObject *__pyx_codeobj__15; +static PyObject *__pyx_tuple__11; +static PyObject *__pyx_tuple__13; +static PyObject *__pyx_tuple__15; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__19; +static PyObject *__pyx_tuple__21; +static PyObject *__pyx_codeobj__12; +static PyObject *__pyx_codeobj__14; +static PyObject *__pyx_codeobj__16; +static PyObject *__pyx_codeobj__18; +static PyObject *__pyx_codeobj__20; +static PyObject *__pyx_codeobj__22; /* Late includes */ -/* "claude_top_level_library.pyx":26 +/* "claude_top_level_library.pyx":11 * - * # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field - * def divergence_with_scalar(a,u,v,dx,dy): # <<<<<<<<<<<<<< - * output = np.zeros_like(a) - * nlat, nlon, nlevels = output.shape[:] + * # laplacian of scalar field a + * def laplacian_2D(np.ndarray a,np.ndarray dx,DTYPE_f dy): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.int_t nlat,nlon,i,j */ /* Python wrapper */ -static PyObject *__pyx_pw_24claude_top_level_library_1divergence_with_scalar(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_24claude_top_level_library_1divergence_with_scalar = {"divergence_with_scalar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_top_level_library_1divergence_with_scalar, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_24claude_top_level_library_1divergence_with_scalar(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_a = 0; - PyObject *__pyx_v_u = 0; - PyObject *__pyx_v_v = 0; - PyObject *__pyx_v_dx = 0; - PyObject *__pyx_v_dy = 0; +static PyObject *__pyx_pw_24claude_top_level_library_1laplacian_2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_24claude_top_level_library_1laplacian_2D = {"laplacian_2D", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_top_level_library_1laplacian_2D, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_24claude_top_level_library_1laplacian_2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_a = 0; + PyArrayObject *__pyx_v_dx = 0; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("laplacian_2D (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_dx,&__pyx_n_s_dy,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("laplacian_2D", 1, 3, 3, 1); __PYX_ERR(0, 11, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("laplacian_2D", 1, 3, 3, 2); __PYX_ERR(0, 11, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "laplacian_2D") < 0)) __PYX_ERR(0, 11, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_a = ((PyArrayObject *)values[0]); + __pyx_v_dx = ((PyArrayObject *)values[1]); + __pyx_v_dy = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dy == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("laplacian_2D", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 11, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("claude_top_level_library.laplacian_2D", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) __PYX_ERR(0, 11, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dx), __pyx_ptype_5numpy_ndarray, 1, "dx", 0))) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_r = __pyx_pf_24claude_top_level_library_laplacian_2D(__pyx_self, __pyx_v_a, __pyx_v_dx, __pyx_v_dy); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_24claude_top_level_library_laplacian_2D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dx, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy) { + PyArrayObject *__pyx_v_output = 0; + __pyx_t_5numpy_int_t __pyx_v_nlat; + __pyx_t_5numpy_int_t __pyx_v_nlon; + __pyx_t_5numpy_int_t __pyx_v_i; + __pyx_t_5numpy_int_t __pyx_v_j; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_inv_dx; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_inv_dy; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + __pyx_t_5numpy_int_t __pyx_t_9; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_t_10; + __pyx_t_5numpy_int_t __pyx_t_11; + __pyx_t_5numpy_int_t __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("laplacian_2D", 0); + + /* "claude_top_level_library.pyx":12 + * # laplacian of scalar field a + * def laplacian_2D(np.ndarray a,np.ndarray dx,DTYPE_f dy): + * cdef np.ndarray output = np.zeros_like(a) # <<<<<<<<<<<<<< + * cdef np.int_t nlat,nlon,i,j + * cdef DTYPE_f inv_dx, inv_dy + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v_a)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_a)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_v_output = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "claude_top_level_library.pyx":15 + * cdef np.int_t nlat,nlon,i,j + * cdef DTYPE_f inv_dx, inv_dy + * nlat = a.shape[0] # <<<<<<<<<<<<<< + * nlon = a.shape[1] + * inv_dy = 1/dy + */ + __pyx_v_nlat = (__pyx_v_a->dimensions[0]); + + /* "claude_top_level_library.pyx":16 + * cdef DTYPE_f inv_dx, inv_dy + * nlat = a.shape[0] + * nlon = a.shape[1] # <<<<<<<<<<<<<< + * inv_dy = 1/dy + * for i in np.arange(1,nlat-1): + */ + __pyx_v_nlon = (__pyx_v_a->dimensions[1]); + + /* "claude_top_level_library.pyx":17 + * nlat = a.shape[0] + * nlon = a.shape[1] + * inv_dy = 1/dy # <<<<<<<<<<<<<< + * for i in np.arange(1,nlat-1): + * inv_dx = dx[i] + */ + if (unlikely(__pyx_v_dy == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 17, __pyx_L1_error) + } + __pyx_v_inv_dy = (1.0 / __pyx_v_dy); + + /* "claude_top_level_library.pyx":18 + * nlon = a.shape[1] + * inv_dy = 1/dy + * for i in np.arange(1,nlat-1): # <<<<<<<<<<<<<< + * inv_dx = dx[i] + * for j in range(nlon): + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_npy_long((__pyx_v_nlat - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_1, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_1, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_int_1); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 18, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 18, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 18, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_8(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 18, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_9 = __Pyx_PyInt_As_npy_long(__pyx_t_1); if (unlikely((__pyx_t_9 == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_9; + + /* "claude_top_level_library.pyx":19 + * inv_dy = 1/dy + * for i in np.arange(1,nlat-1): + * inv_dx = dx[i] # <<<<<<<<<<<<<< + * for j in range(nlon): + * output[i,j] = (low_level.scalar_gradient_x_2D(a,dx,nlon,i,j) - low_level.scalar_gradient_x_2D(a,dx,nlon,i,j))*inv_dx + (low_level.scalar_gradient_y_2D(a,dy,nlat,i+1,j) - low_level.scalar_gradient_y_2D(a,dy,nlat,i-1,j))*inv_dy + */ + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dx), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_10 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_inv_dx = __pyx_t_10; + + /* "claude_top_level_library.pyx":20 + * for i in np.arange(1,nlat-1): + * inv_dx = dx[i] + * for j in range(nlon): # <<<<<<<<<<<<<< + * output[i,j] = (low_level.scalar_gradient_x_2D(a,dx,nlon,i,j) - low_level.scalar_gradient_x_2D(a,dx,nlon,i,j))*inv_dx + (low_level.scalar_gradient_y_2D(a,dy,nlat,i+1,j) - low_level.scalar_gradient_y_2D(a,dy,nlat,i-1,j))*inv_dy + * return output + */ + __pyx_t_9 = __pyx_v_nlon; + __pyx_t_11 = __pyx_t_9; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; + + /* "claude_top_level_library.pyx":21 + * inv_dx = dx[i] + * for j in range(nlon): + * output[i,j] = (low_level.scalar_gradient_x_2D(a,dx,nlon,i,j) - low_level.scalar_gradient_x_2D(a,dx,nlon,i,j))*inv_dx + (low_level.scalar_gradient_y_2D(a,dy,nlat,i+1,j) - low_level.scalar_gradient_y_2D(a,dy,nlat,i-1,j))*inv_dy # <<<<<<<<<<<<<< + * return output + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_low_level); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_scalar_gradient_x_2D); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_nlon); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dx), __pyx_t_6, __pyx_t_4, __pyx_t_13}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dx), __pyx_t_6, __pyx_t_4, __pyx_t_13}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } else + #endif + { + __pyx_t_15 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + if (__pyx_t_14) { + __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); __pyx_t_14 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_5, ((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_5, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_15, 4+__pyx_t_5, __pyx_t_13); + __pyx_t_6 = 0; + __pyx_t_4 = 0; + __pyx_t_13 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_low_level); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_scalar_gradient_x_2D); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyInt_From_npy_long(__pyx_v_nlon); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_14 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_13)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dx), __pyx_t_15, __pyx_t_4, __pyx_t_6}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dx), __pyx_t_15, __pyx_t_4, __pyx_t_6}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_16 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + if (__pyx_t_14) { + __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_5, ((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_5, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_5, __pyx_t_6); + __pyx_t_15 = 0; + __pyx_t_4 = 0; + __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_inv_dx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_13, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_low_level); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_scalar_gradient_y_2D); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_nlat); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyInt_From_npy_long((__pyx_v_i + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_15 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_16); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_16, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_16)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, ((PyObject *)__pyx_v_a), __pyx_t_13, __pyx_t_6, __pyx_t_4, __pyx_t_15}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, ((PyObject *)__pyx_v_a), __pyx_t_13, __pyx_t_6, __pyx_t_4, __pyx_t_15}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } else + #endif + { + __pyx_t_17 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + if (__pyx_t_14) { + __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_14); __pyx_t_14 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_5, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_5, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_17, 3+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_17, 4+__pyx_t_5, __pyx_t_15); + __pyx_t_13 = 0; + __pyx_t_6 = 0; + __pyx_t_4 = 0; + __pyx_t_15 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_low_level); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_scalar_gradient_y_2D); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_nlat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyInt_From_npy_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_13 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_15, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_15)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, ((PyObject *)__pyx_v_a), __pyx_t_17, __pyx_t_4, __pyx_t_6, __pyx_t_13}; + __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, ((PyObject *)__pyx_v_a), __pyx_t_17, __pyx_t_4, __pyx_t_6, __pyx_t_13}; + __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } else + #endif + { + __pyx_t_18 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + if (__pyx_t_14) { + __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_14); __pyx_t_14 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_5, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_5, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_18, 4+__pyx_t_5, __pyx_t_13); + __pyx_t_17 = 0; + __pyx_t_4 = 0; + __pyx_t_6 = 0; + __pyx_t_13 = 0; + __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_18, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyNumber_Subtract(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = PyFloat_FromDouble(__pyx_v_inv_dy); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_1); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_output), __pyx_t_15, __pyx_t_16) < 0)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + + /* "claude_top_level_library.pyx":18 + * nlon = a.shape[1] + * inv_dy = 1/dy + * for i in np.arange(1,nlat-1): # <<<<<<<<<<<<<< + * inv_dx = dx[i] + * for j in range(nlon): + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "claude_top_level_library.pyx":22 + * for j in range(nlon): + * output[i,j] = (low_level.scalar_gradient_x_2D(a,dx,nlon,i,j) - low_level.scalar_gradient_x_2D(a,dx,nlon,i,j))*inv_dx + (low_level.scalar_gradient_y_2D(a,dy,nlat,i+1,j) - low_level.scalar_gradient_y_2D(a,dy,nlat,i-1,j))*inv_dy + * return output # <<<<<<<<<<<<<< + * + * def laplacian_3D(np.ndarray a,np.ndarray dx,DTYPE_f dy,np.ndarray dz): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_output)); + __pyx_r = ((PyObject *)__pyx_v_output); + goto __pyx_L0; + + /* "claude_top_level_library.pyx":11 + * + * # laplacian of scalar field a + * def laplacian_2D(np.ndarray a,np.ndarray dx,DTYPE_f dy): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.int_t nlat,nlon,i,j + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_AddTraceback("claude_top_level_library.laplacian_2D", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_output); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "claude_top_level_library.pyx":24 + * return output + * + * def laplacian_3D(np.ndarray a,np.ndarray dx,DTYPE_f dy,np.ndarray dz): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.int_t nlat,nlon,nlevels,i,j,k + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_24claude_top_level_library_3laplacian_3D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_24claude_top_level_library_3laplacian_3D = {"laplacian_3D", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_top_level_library_3laplacian_3D, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_24claude_top_level_library_3laplacian_3D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_a = 0; + PyArrayObject *__pyx_v_dx = 0; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy; + PyArrayObject *__pyx_v_dz = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("laplacian_3D (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_dx,&__pyx_n_s_dy,&__pyx_n_s_dz,0}; + PyObject* values[4] = {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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("laplacian_3D", 1, 4, 4, 1); __PYX_ERR(0, 24, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("laplacian_3D", 1, 4, 4, 2); __PYX_ERR(0, 24, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dz)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("laplacian_3D", 1, 4, 4, 3); __PYX_ERR(0, 24, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "laplacian_3D") < 0)) __PYX_ERR(0, 24, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_a = ((PyArrayObject *)values[0]); + __pyx_v_dx = ((PyArrayObject *)values[1]); + __pyx_v_dy = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dy == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 24, __pyx_L3_error) + __pyx_v_dz = ((PyArrayObject *)values[3]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("laplacian_3D", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 24, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("claude_top_level_library.laplacian_3D", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) __PYX_ERR(0, 24, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dx), __pyx_ptype_5numpy_ndarray, 1, "dx", 0))) __PYX_ERR(0, 24, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dz), __pyx_ptype_5numpy_ndarray, 1, "dz", 0))) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_r = __pyx_pf_24claude_top_level_library_2laplacian_3D(__pyx_self, __pyx_v_a, __pyx_v_dx, __pyx_v_dy, __pyx_v_dz); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_24claude_top_level_library_2laplacian_3D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_dx, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy, PyArrayObject *__pyx_v_dz) { + PyArrayObject *__pyx_v_output = 0; + __pyx_t_5numpy_int_t __pyx_v_nlat; + __pyx_t_5numpy_int_t __pyx_v_nlon; + __pyx_t_5numpy_int_t __pyx_v_nlevels; + __pyx_t_5numpy_int_t __pyx_v_i; + __pyx_t_5numpy_int_t __pyx_v_j; + __pyx_t_5numpy_int_t __pyx_v_k; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_inv_dx; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_inv_dy; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + __pyx_t_5numpy_int_t __pyx_t_9; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_t_10; + __pyx_t_5numpy_int_t __pyx_t_11; + __pyx_t_5numpy_int_t __pyx_t_12; + __pyx_t_5numpy_int_t __pyx_t_13; + __pyx_t_5numpy_int_t __pyx_t_14; + __pyx_t_5numpy_int_t __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("laplacian_3D", 0); + + /* "claude_top_level_library.pyx":25 + * + * def laplacian_3D(np.ndarray a,np.ndarray dx,DTYPE_f dy,np.ndarray dz): + * cdef np.ndarray output = np.zeros_like(a) # <<<<<<<<<<<<<< + * cdef np.int_t nlat,nlon,nlevels,i,j,k + * cdef DTYPE_f inv_dx, inv_dy + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v_a)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_a)); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_v_output = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "claude_top_level_library.pyx":28 + * cdef np.int_t nlat,nlon,nlevels,i,j,k + * cdef DTYPE_f inv_dx, inv_dy + * nlat = a.shape[0] # <<<<<<<<<<<<<< + * nlon = a.shape[1] + * nlevels = a.shape[2] + */ + __pyx_v_nlat = (__pyx_v_a->dimensions[0]); + + /* "claude_top_level_library.pyx":29 + * cdef DTYPE_f inv_dx, inv_dy + * nlat = a.shape[0] + * nlon = a.shape[1] # <<<<<<<<<<<<<< + * nlevels = a.shape[2] + * inv_dy = 1/dy + */ + __pyx_v_nlon = (__pyx_v_a->dimensions[1]); + + /* "claude_top_level_library.pyx":30 + * nlat = a.shape[0] + * nlon = a.shape[1] + * nlevels = a.shape[2] # <<<<<<<<<<<<<< + * inv_dy = 1/dy + * for i in np.arange(1,nlat-1): + */ + __pyx_v_nlevels = (__pyx_v_a->dimensions[2]); + + /* "claude_top_level_library.pyx":31 + * nlon = a.shape[1] + * nlevels = a.shape[2] + * inv_dy = 1/dy # <<<<<<<<<<<<<< + * for i in np.arange(1,nlat-1): + * inv_dx = 1/dx[i] + */ + if (unlikely(__pyx_v_dy == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 31, __pyx_L1_error) + } + __pyx_v_inv_dy = (1.0 / __pyx_v_dy); + + /* "claude_top_level_library.pyx":32 + * nlevels = a.shape[2] + * inv_dy = 1/dy + * for i in np.arange(1,nlat-1): # <<<<<<<<<<<<<< + * inv_dx = 1/dx[i] + * for j in range(nlon): + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From_npy_long((__pyx_v_nlat - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_1, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_1, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_int_1); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 32, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 32, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 32, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_8(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 32, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_9 = __Pyx_PyInt_As_npy_long(__pyx_t_1); if (unlikely((__pyx_t_9 == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_9; + + /* "claude_top_level_library.pyx":33 + * inv_dy = 1/dy + * for i in np.arange(1,nlat-1): + * inv_dx = 1/dx[i] # <<<<<<<<<<<<<< + * for j in range(nlon): + * for k in range(nlevels-1): + */ + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dx), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_10 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_inv_dx = __pyx_t_10; + + /* "claude_top_level_library.pyx":34 + * for i in np.arange(1,nlat-1): + * inv_dx = 1/dx[i] + * for j in range(nlon): # <<<<<<<<<<<<<< + * for k in range(nlevels-1): + * output[i,j,k] = (low_level.scalar_gradient_x(a,dx,nlon,i,j,k) - low_level.scalar_gradient_x(a,dx,nlon,i,j,k))*inv_dx + (low_level.scalar_gradient_y(a,dy,nlat,i+1,j,k) - low_level.scalar_gradient_y(a,dy,nlat,i-1,j,k))*inv_dy + (low_level.scalar_gradient_z(a,dz,i,j,k+1)-low_level.scalar_gradient_z(a,dz,i,j,k-1))/(2*dz[k]) + */ + __pyx_t_9 = __pyx_v_nlon; + __pyx_t_11 = __pyx_t_9; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_j = __pyx_t_12; + + /* "claude_top_level_library.pyx":35 + * inv_dx = 1/dx[i] + * for j in range(nlon): + * for k in range(nlevels-1): # <<<<<<<<<<<<<< + * output[i,j,k] = (low_level.scalar_gradient_x(a,dx,nlon,i,j,k) - low_level.scalar_gradient_x(a,dx,nlon,i,j,k))*inv_dx + (low_level.scalar_gradient_y(a,dy,nlat,i+1,j,k) - low_level.scalar_gradient_y(a,dy,nlat,i-1,j,k))*inv_dy + (low_level.scalar_gradient_z(a,dz,i,j,k+1)-low_level.scalar_gradient_z(a,dz,i,j,k-1))/(2*dz[k]) + * return output + */ + __pyx_t_13 = (__pyx_v_nlevels - 1); + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_k = __pyx_t_15; + + /* "claude_top_level_library.pyx":36 + * for j in range(nlon): + * for k in range(nlevels-1): + * output[i,j,k] = (low_level.scalar_gradient_x(a,dx,nlon,i,j,k) - low_level.scalar_gradient_x(a,dx,nlon,i,j,k))*inv_dx + (low_level.scalar_gradient_y(a,dy,nlat,i+1,j,k) - low_level.scalar_gradient_y(a,dy,nlat,i-1,j,k))*inv_dy + (low_level.scalar_gradient_z(a,dz,i,j,k+1)-low_level.scalar_gradient_z(a,dz,i,j,k-1))/(2*dz[k]) # <<<<<<<<<<<<<< + * return output + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_low_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_nlon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dx), __pyx_t_1, __pyx_t_4, __pyx_t_16, __pyx_t_17}; + __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dx), __pyx_t_1, __pyx_t_4, __pyx_t_16, __pyx_t_17}; + __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } else + #endif + { + __pyx_t_19 = PyTuple_New(6+__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + if (__pyx_t_18) { + __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_18); __pyx_t_18 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_5, ((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_5, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_19, 3+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_19, 4+__pyx_t_5, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_19, 5+__pyx_t_5, __pyx_t_17); + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_16 = 0; + __pyx_t_17 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_19, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_low_level); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyInt_From_npy_long(__pyx_v_nlon); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_18 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_17); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_17, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_17)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dx), __pyx_t_19, __pyx_t_16, __pyx_t_4, __pyx_t_1}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dx), __pyx_t_19, __pyx_t_16, __pyx_t_4, __pyx_t_1}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + { + __pyx_t_20 = PyTuple_New(6+__pyx_t_5); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + if (__pyx_t_18) { + __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_18); __pyx_t_18 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_5, ((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_5, __pyx_t_19); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_5, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_20, 4+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_20, 5+__pyx_t_5, __pyx_t_1); + __pyx_t_19 = 0; + __pyx_t_16 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + } + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = PyNumber_Subtract(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_inv_dx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_17, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_low_level); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_nlat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_From_npy_long((__pyx_v_i + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_19 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_18 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_20); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_20, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_20)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_a), __pyx_t_17, __pyx_t_1, __pyx_t_4, __pyx_t_16, __pyx_t_19}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_a), __pyx_t_17, __pyx_t_1, __pyx_t_4, __pyx_t_16, __pyx_t_19}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + } else + #endif + { + __pyx_t_21 = PyTuple_New(6+__pyx_t_5); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + if (__pyx_t_18) { + __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18); __pyx_t_18 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_5, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_5, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_21, 3+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_21, 4+__pyx_t_5, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_21, 5+__pyx_t_5, __pyx_t_19); + __pyx_t_17 = 0; + __pyx_t_1 = 0; + __pyx_t_4 = 0; + __pyx_t_16 = 0; + __pyx_t_19 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + } + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_low_level); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_nlat); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_4 = __Pyx_PyInt_From_npy_long((__pyx_v_i - 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_a), __pyx_t_21, __pyx_t_16, __pyx_t_4, __pyx_t_1, __pyx_t_17}; + __pyx_t_20 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_a), __pyx_t_21, __pyx_t_16, __pyx_t_4, __pyx_t_1, __pyx_t_17}; + __pyx_t_20 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_5, 6+__pyx_t_5); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } else + #endif + { + __pyx_t_22 = PyTuple_New(6+__pyx_t_5); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + if (__pyx_t_18) { + __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_18); __pyx_t_18 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_5, __pyx_t_21); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_22, 2+__pyx_t_5, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_22, 3+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_22, 4+__pyx_t_5, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_22, 5+__pyx_t_5, __pyx_t_17); + __pyx_t_21 = 0; + __pyx_t_16 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_t_17 = 0; + __pyx_t_20 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_22, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + } + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = PyNumber_Subtract(__pyx_t_3, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_20 = PyFloat_FromDouble(__pyx_v_inv_dy); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_3 = PyNumber_Multiply(__pyx_t_19, __pyx_t_20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_20 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_low_level); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_scalar_gradient_z); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_22 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_17 = __Pyx_PyInt_From_npy_long((__pyx_v_k + 1)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_1 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[6] = {__pyx_t_1, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dz), __pyx_t_6, __pyx_t_22, __pyx_t_17}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[6] = {__pyx_t_1, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dz), __pyx_t_6, __pyx_t_22, __pyx_t_17}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } else + #endif + { + __pyx_t_4 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__pyx_t_1) { + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_INCREF(((PyObject *)__pyx_v_dz)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dz)); + PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, ((PyObject *)__pyx_v_dz)); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_5, __pyx_t_22); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_5, __pyx_t_17); + __pyx_t_6 = 0; + __pyx_t_22 = 0; + __pyx_t_17 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_low_level); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_scalar_gradient_z); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_22 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_6 = __Pyx_PyInt_From_npy_long((__pyx_v_k - 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_17); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_17, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_17)) { + PyObject *__pyx_temp[6] = {__pyx_t_1, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dz), __pyx_t_4, __pyx_t_22, __pyx_t_6}; + __pyx_t_19 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) { + PyObject *__pyx_temp[6] = {__pyx_t_1, ((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_dz), __pyx_t_4, __pyx_t_22, __pyx_t_6}; + __pyx_t_19 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_16 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + if (__pyx_t_1) { + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1); __pyx_t_1 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_a)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); + PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_5, ((PyObject *)__pyx_v_a)); + __Pyx_INCREF(((PyObject *)__pyx_v_dz)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dz)); + PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_5, ((PyObject *)__pyx_v_dz)); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_5, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_5, __pyx_t_22); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_5, __pyx_t_6); + __pyx_t_4 = 0; + __pyx_t_22 = 0; + __pyx_t_6 = 0; + __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_16, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = PyNumber_Subtract(__pyx_t_3, __pyx_t_19); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dz), __pyx_v_k, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_19); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyNumber_Divide(__pyx_t_17, __pyx_t_3); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_20, __pyx_t_19); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_20 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_19); + __Pyx_GIVEREF(__pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_20); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_17); + __pyx_t_19 = 0; + __pyx_t_20 = 0; + __pyx_t_17 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_output), __pyx_t_16, __pyx_t_3) < 0)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + } + + /* "claude_top_level_library.pyx":32 + * nlevels = a.shape[2] + * inv_dy = 1/dy + * for i in np.arange(1,nlat-1): # <<<<<<<<<<<<<< + * inv_dx = 1/dx[i] + * for j in range(nlon): + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "claude_top_level_library.pyx":37 + * for k in range(nlevels-1): + * output[i,j,k] = (low_level.scalar_gradient_x(a,dx,nlon,i,j,k) - low_level.scalar_gradient_x(a,dx,nlon,i,j,k))*inv_dx + (low_level.scalar_gradient_y(a,dy,nlat,i+1,j,k) - low_level.scalar_gradient_y(a,dy,nlat,i-1,j,k))*inv_dy + (low_level.scalar_gradient_z(a,dz,i,j,k+1)-low_level.scalar_gradient_z(a,dz,i,j,k-1))/(2*dz[k]) + * return output # <<<<<<<<<<<<<< + * + * # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_output)); + __pyx_r = ((PyObject *)__pyx_v_output); + goto __pyx_L0; + + /* "claude_top_level_library.pyx":24 + * return output + * + * def laplacian_3D(np.ndarray a,np.ndarray dx,DTYPE_f dy,np.ndarray dz): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.int_t nlat,nlon,nlevels,i,j,k + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_AddTraceback("claude_top_level_library.laplacian_3D", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_output); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "claude_top_level_library.pyx":40 + * + * # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field + * def divergence_with_scalar(np.ndarray a,np.ndarray u,np.ndarray v,np.ndarray w,np.ndarray dx,DTYPE_f dy,np.ndarray dz): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.ndarray au, av, aw + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_24claude_top_level_library_5divergence_with_scalar(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_24claude_top_level_library_5divergence_with_scalar = {"divergence_with_scalar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_top_level_library_5divergence_with_scalar, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_24claude_top_level_library_5divergence_with_scalar(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_a = 0; + PyArrayObject *__pyx_v_u = 0; + PyArrayObject *__pyx_v_v = 0; + PyArrayObject *__pyx_v_w = 0; + PyArrayObject *__pyx_v_dx = 0; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy; + PyArrayObject *__pyx_v_dz = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1934,12 +3633,16 @@ static PyObject *__pyx_pw_24claude_top_level_library_1divergence_with_scalar(PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("divergence_with_scalar (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_u,&__pyx_n_s_v,&__pyx_n_s_dx,&__pyx_n_s_dy,0}; - PyObject* values[5] = {0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_u,&__pyx_n_s_v,&__pyx_n_s_w,&__pyx_n_s_dx,&__pyx_n_s_dy,&__pyx_n_s_dz,0}; + PyObject* values[7] = {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 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -1962,31 +3665,43 @@ static PyObject *__pyx_pw_24claude_top_level_library_1divergence_with_scalar(PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 5, 5, 1); __PYX_ERR(0, 26, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 7, 7, 1); __PYX_ERR(0, 40, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 5, 5, 2); __PYX_ERR(0, 26, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 7, 7, 2); __PYX_ERR(0, 40, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 5, 5, 3); __PYX_ERR(0, 26, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 7, 7, 3); __PYX_ERR(0, 40, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: - if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--; + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 5, 5, 4); __PYX_ERR(0, 26, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 7, 7, 4); __PYX_ERR(0, 40, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 5: + if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 7, 7, 5); __PYX_ERR(0, 40, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dz)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 7, 7, 6); __PYX_ERR(0, 40, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divergence_with_scalar") < 0)) __PYX_ERR(0, 26, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divergence_with_scalar") < 0)) __PYX_ERR(0, 40, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -1994,71 +3709,90 @@ static PyObject *__pyx_pw_24claude_top_level_library_1divergence_with_scalar(PyO values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } - __pyx_v_a = values[0]; - __pyx_v_u = values[1]; - __pyx_v_v = values[2]; - __pyx_v_dx = values[3]; - __pyx_v_dy = values[4]; + __pyx_v_a = ((PyArrayObject *)values[0]); + __pyx_v_u = ((PyArrayObject *)values[1]); + __pyx_v_v = ((PyArrayObject *)values[2]); + __pyx_v_w = ((PyArrayObject *)values[3]); + __pyx_v_dx = ((PyArrayObject *)values[4]); + __pyx_v_dy = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_dy == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error) + __pyx_v_dz = ((PyArrayObject *)values[6]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 26, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("divergence_with_scalar", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 40, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("claude_top_level_library.divergence_with_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_24claude_top_level_library_divergence_with_scalar(__pyx_self, __pyx_v_a, __pyx_v_u, __pyx_v_v, __pyx_v_dx, __pyx_v_dy); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) __PYX_ERR(0, 40, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_5numpy_ndarray, 1, "u", 0))) __PYX_ERR(0, 40, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 40, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 40, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dx), __pyx_ptype_5numpy_ndarray, 1, "dx", 0))) __PYX_ERR(0, 40, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dz), __pyx_ptype_5numpy_ndarray, 1, "dz", 0))) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_r = __pyx_pf_24claude_top_level_library_4divergence_with_scalar(__pyx_self, __pyx_v_a, __pyx_v_u, __pyx_v_v, __pyx_v_w, __pyx_v_dx, __pyx_v_dy, __pyx_v_dz); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_24claude_top_level_library_divergence_with_scalar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_u, PyObject *__pyx_v_v, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy) { - PyObject *__pyx_v_output = NULL; - PyObject *__pyx_v_nlat = NULL; - PyObject *__pyx_v_nlon = NULL; - PyObject *__pyx_v_nlevels = NULL; - PyObject *__pyx_v_au = NULL; - PyObject *__pyx_v_av = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_j = NULL; - PyObject *__pyx_v_k = NULL; +static PyObject *__pyx_pf_24claude_top_level_library_4divergence_with_scalar(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_u, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dx, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy, PyArrayObject *__pyx_v_dz) { + PyArrayObject *__pyx_v_output = 0; + PyArrayObject *__pyx_v_au = 0; + PyArrayObject *__pyx_v_av = 0; + PyArrayObject *__pyx_v_aw = 0; + __pyx_t_5numpy_int_t __pyx_v_nlat; + __pyx_t_5numpy_int_t __pyx_v_nlon; + __pyx_t_5numpy_int_t __pyx_v_nlevels; + __pyx_t_5numpy_int_t __pyx_v_i; + __pyx_t_5numpy_int_t __pyx_v_j; + __pyx_t_5numpy_int_t __pyx_v_k; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *(*__pyx_t_6)(PyObject *); - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - Py_ssize_t __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); + __pyx_t_5numpy_int_t __pyx_t_4; + __pyx_t_5numpy_int_t __pyx_t_5; + __pyx_t_5numpy_int_t __pyx_t_6; + __pyx_t_5numpy_int_t __pyx_t_7; + __pyx_t_5numpy_int_t __pyx_t_8; + __pyx_t_5numpy_int_t __pyx_t_9; + __pyx_t_5numpy_int_t __pyx_t_10; + __pyx_t_5numpy_int_t __pyx_t_11; + __pyx_t_5numpy_int_t __pyx_t_12; PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; + PyObject *__pyx_t_14 = NULL; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; + int __pyx_t_17; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("divergence_with_scalar", 0); - /* "claude_top_level_library.pyx":27 + /* "claude_top_level_library.pyx":41 * # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field - * def divergence_with_scalar(a,u,v,dx,dy): - * output = np.zeros_like(a) # <<<<<<<<<<<<<< - * nlat, nlon, nlevels = output.shape[:] - * + * def divergence_with_scalar(np.ndarray a,np.ndarray u,np.ndarray v,np.ndarray w,np.ndarray dx,DTYPE_f dy,np.ndarray dz): + * cdef np.ndarray output = np.zeros_like(a) # <<<<<<<<<<<<<< + * cdef np.ndarray au, av, aw + * cdef np.int_t nlat, nlon, nlevels, i, j, k */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -2071,464 +3805,408 @@ static PyObject *__pyx_pf_24claude_top_level_library_divergence_with_scalar(CYTH __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_a) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_a); + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v_a)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_a)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_output = __pyx_t_1; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_v_output = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":28 - * def divergence_with_scalar(a,u,v,dx,dy): - * output = np.zeros_like(a) - * nlat, nlon, nlevels = output.shape[:] # <<<<<<<<<<<<<< + /* "claude_top_level_library.pyx":45 + * cdef np.int_t nlat, nlon, nlevels, i, j, k + * + * nlat = output.shape[0] # <<<<<<<<<<<<<< + * nlon = output.shape[1] + * nlevels = output.shape[2] + */ + __pyx_v_nlat = (__pyx_v_output->dimensions[0]); + + /* "claude_top_level_library.pyx":46 + * + * nlat = output.shape[0] + * nlon = output.shape[1] # <<<<<<<<<<<<<< + * nlevels = output.shape[2] + * + */ + __pyx_v_nlon = (__pyx_v_output->dimensions[1]); + + /* "claude_top_level_library.pyx":47 + * nlat = output.shape[0] + * nlon = output.shape[1] + * nlevels = output.shape[2] # <<<<<<<<<<<<<< * * au = a*u */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_output, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, NULL, NULL, &__pyx_slice_, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 28, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_1 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - __pyx_t_4 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) __PYX_ERR(0, 28, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 28, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_v_nlat = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_v_nlon = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_v_nlevels = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_nlevels = (__pyx_v_output->dimensions[2]); - /* "claude_top_level_library.pyx":30 - * nlat, nlon, nlevels = output.shape[:] + /* "claude_top_level_library.pyx":49 + * nlevels = output.shape[2] * * au = a*u # <<<<<<<<<<<<<< * av = a*v - * + * aw = a*w */ - __pyx_t_3 = PyNumber_Multiply(__pyx_v_a, __pyx_v_u); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_au = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_u)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_v_au = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":31 + /* "claude_top_level_library.pyx":50 * * au = a*u * av = a*v # <<<<<<<<<<<<<< + * aw = a*w + * + */ + __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_v_av = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "claude_top_level_library.pyx":51 + * au = a*u + * av = a*v + * aw = a*w # <<<<<<<<<<<<<< * * for i in range(nlat): */ - __pyx_t_3 = PyNumber_Multiply(__pyx_v_a, __pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_av = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_v_aw = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":33 - * av = a*v + /* "claude_top_level_library.pyx":53 + * aw = a*w * * for i in range(nlat): # <<<<<<<<<<<<<< * for j in range(nlon): * for k in range(nlevels): */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_nlat); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 33, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 33, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 33, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_8(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 33, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_4 = __pyx_v_nlat; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "claude_top_level_library.pyx":34 + /* "claude_top_level_library.pyx":54 * * for i in range(nlat): * for j in range(nlon): # <<<<<<<<<<<<<< * for k in range(nlevels): - * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) #+ 0.1*scalar_gradient_z(a*w,i,j,k) + * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) + 0.05*low_level.scalar_gradient_z(aw,dz,i,j,k) */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_nlon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 34, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 34, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 34, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_10(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 34, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_7 = __pyx_v_nlon; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_j = __pyx_t_9; - /* "claude_top_level_library.pyx":35 + /* "claude_top_level_library.pyx":55 * for i in range(nlat): * for j in range(nlon): * for k in range(nlevels): # <<<<<<<<<<<<<< - * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) #+ 0.1*scalar_gradient_z(a*w,i,j,k) + * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) + 0.05*low_level.scalar_gradient_z(aw,dz,i,j,k) * return output */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_nlevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 35, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 35, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 35, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_12(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 35, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_10 = __pyx_v_nlevels; + __pyx_t_11 = __pyx_t_10; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_k = __pyx_t_12; - /* "claude_top_level_library.pyx":36 + /* "claude_top_level_library.pyx":56 * for j in range(nlon): * for k in range(nlevels): - * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) #+ 0.1*scalar_gradient_z(a*w,i,j,k) # <<<<<<<<<<<<<< + * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) + 0.05*low_level.scalar_gradient_z(aw,dz,i,j,k) # <<<<<<<<<<<<<< * return output * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_low_level); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); - __pyx_t_14 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[7] = {__pyx_t_5, __pyx_v_au, __pyx_v_dx, __pyx_v_nlon, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_14, 6+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[7] = {__pyx_t_5, __pyx_v_au, __pyx_v_dx, __pyx_v_nlon, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_14, 6+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_15 = PyTuple_New(6+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_v_au); - __Pyx_GIVEREF(__pyx_v_au); - PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_v_au); - __Pyx_INCREF(__pyx_v_dx); - __Pyx_GIVEREF(__pyx_v_dx); - PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_v_dx); - __Pyx_INCREF(__pyx_v_nlon); - __Pyx_GIVEREF(__pyx_v_nlon); - PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_14, __pyx_v_nlon); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_14, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_15, 4+__pyx_t_14, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_15, 5+__pyx_t_14, __pyx_v_k); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_low_level); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = NULL; - __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_14 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[7] = {__pyx_t_15, __pyx_v_av, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 6+__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_13); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[7] = {__pyx_t_15, __pyx_v_av, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 6+__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_13); - } else - #endif - { - __pyx_t_16 = PyTuple_New(6+__pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_15) { - __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL; - } - __Pyx_INCREF(__pyx_v_av); - __Pyx_GIVEREF(__pyx_v_av); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_14, __pyx_v_av); - __Pyx_INCREF(__pyx_v_dy); - __Pyx_GIVEREF(__pyx_v_dy); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_14, __pyx_v_dy); - __Pyx_INCREF(__pyx_v_nlat); - __Pyx_GIVEREF(__pyx_v_nlat); - PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_14, __pyx_v_nlat); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_14, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_14, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_16, 5+__pyx_t_14, __pyx_v_k); - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_low_level); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nlon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_k); - if (unlikely(PyObject_SetItem(__pyx_v_output, __pyx_t_13, __pyx_t_5) < 0)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "claude_top_level_library.pyx":35 - * for i in range(nlat): - * for j in range(nlon): - * for k in range(nlevels): # <<<<<<<<<<<<<< - * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) #+ 0.1*scalar_gradient_z(a*w,i,j,k) - * return output - */ + __pyx_t_14 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = NULL; + __pyx_t_17 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_16)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_16); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_17 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[7] = {__pyx_t_16, ((PyObject *)__pyx_v_au), ((PyObject *)__pyx_v_dx), __pyx_t_3, __pyx_t_13, __pyx_t_14, __pyx_t_15}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_17, 6+__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[7] = {__pyx_t_16, ((PyObject *)__pyx_v_au), ((PyObject *)__pyx_v_dx), __pyx_t_3, __pyx_t_13, __pyx_t_14, __pyx_t_15}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_17, 6+__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } else + #endif + { + __pyx_t_18 = PyTuple_New(6+__pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + if (__pyx_t_16) { + __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_16); __pyx_t_16 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_au)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_au)); + PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_17, ((PyObject *)__pyx_v_au)); + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_17, ((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_17, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_17, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_18, 4+__pyx_t_17, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_18, 5+__pyx_t_17, __pyx_t_15); + __pyx_t_3 = 0; + __pyx_t_13 = 0; + __pyx_t_14 = 0; + __pyx_t_15 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_low_level); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_14 = __Pyx_PyInt_From_npy_long(__pyx_v_nlat); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_19 = NULL; + __pyx_t_17 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_15); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_15, function); + __pyx_t_17 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_15)) { + PyObject *__pyx_temp[7] = {__pyx_t_19, ((PyObject *)__pyx_v_av), __pyx_t_18, __pyx_t_14, __pyx_t_13, __pyx_t_3, __pyx_t_16}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_17, 6+__pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) { + PyObject *__pyx_temp[7] = {__pyx_t_19, ((PyObject *)__pyx_v_av), __pyx_t_18, __pyx_t_14, __pyx_t_13, __pyx_t_3, __pyx_t_16}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_17, 6+__pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } else + #endif + { + __pyx_t_20 = PyTuple_New(6+__pyx_t_17); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + if (__pyx_t_19) { + __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_av)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_av)); + PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_17, ((PyObject *)__pyx_v_av)); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_17, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_17, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_17, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_20, 4+__pyx_t_17, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_20, 5+__pyx_t_17, __pyx_t_16); + __pyx_t_18 = 0; + __pyx_t_14 = 0; + __pyx_t_13 = 0; + __pyx_t_3 = 0; + __pyx_t_16 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + } + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_low_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_scalar_gradient_z); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = NULL; + __pyx_t_17 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_20); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_20, function); + __pyx_t_17 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_20)) { + PyObject *__pyx_temp[6] = {__pyx_t_13, ((PyObject *)__pyx_v_aw), ((PyObject *)__pyx_v_dz), __pyx_t_1, __pyx_t_16, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_17, 5+__pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) { + PyObject *__pyx_temp[6] = {__pyx_t_13, ((PyObject *)__pyx_v_aw), ((PyObject *)__pyx_v_dz), __pyx_t_1, __pyx_t_16, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_17, 5+__pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_14 = PyTuple_New(5+__pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_aw)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_aw)); + PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_17, ((PyObject *)__pyx_v_aw)); + __Pyx_INCREF(((PyObject *)__pyx_v_dz)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dz)); + PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_17, ((PyObject *)__pyx_v_dz)); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_17, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_17, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_17, __pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_16 = 0; + __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_20 = PyNumber_Multiply(__pyx_float_0_05, __pyx_t_2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_15, __pyx_t_20); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_20 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_15 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_20); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_14); + __pyx_t_20 = 0; + __pyx_t_15 = 0; + __pyx_t_14 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_output), __pyx_t_3, __pyx_t_2) < 0)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "claude_top_level_library.pyx":34 - * - * for i in range(nlat): - * for j in range(nlon): # <<<<<<<<<<<<<< - * for k in range(nlevels): - * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) #+ 0.1*scalar_gradient_z(a*w,i,j,k) - */ } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "claude_top_level_library.pyx":33 - * av = a*v - * - * for i in range(nlat): # <<<<<<<<<<<<<< - * for j in range(nlon): - * for k in range(nlevels): - */ } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "claude_top_level_library.pyx":37 + /* "claude_top_level_library.pyx":57 * for k in range(nlevels): - * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) #+ 0.1*scalar_gradient_z(a*w,i,j,k) + * output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) + 0.05*low_level.scalar_gradient_z(aw,dz,i,j,k) * return output # <<<<<<<<<<<<<< * * def radiation_calculation(np.ndarray temperature_world, np.ndarray temperature_atmos, np.ndarray air_pressure, np.ndarray air_density, np.ndarray heat_capacity_earth, np.ndarray albedo, DTYPE_f insolation, np.ndarray lat, np.ndarray lon, np.ndarray heights, np.ndarray dz, np.int_t t, np.int_t dt, DTYPE_f day, DTYPE_f year, DTYPE_f axial_tilt): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_output); - __pyx_r = __pyx_v_output; + __Pyx_INCREF(((PyObject *)__pyx_v_output)); + __pyx_r = ((PyObject *)__pyx_v_output); goto __pyx_L0; - /* "claude_top_level_library.pyx":26 + /* "claude_top_level_library.pyx":40 * * # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field - * def divergence_with_scalar(a,u,v,dx,dy): # <<<<<<<<<<<<<< - * output = np.zeros_like(a) - * nlat, nlon, nlevels = output.shape[:] + * def divergence_with_scalar(np.ndarray a,np.ndarray u,np.ndarray v,np.ndarray w,np.ndarray dx,DTYPE_f dy,np.ndarray dz): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.ndarray au, av, aw */ /* function exit code */ @@ -2536,29 +4214,26 @@ static PyObject *__pyx_pf_24claude_top_level_library_divergence_with_scalar(CYTH __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_15); __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); __Pyx_AddTraceback("claude_top_level_library.divergence_with_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_output); - __Pyx_XDECREF(__pyx_v_nlat); - __Pyx_XDECREF(__pyx_v_nlon); - __Pyx_XDECREF(__pyx_v_nlevels); - __Pyx_XDECREF(__pyx_v_au); - __Pyx_XDECREF(__pyx_v_av); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_j); - __Pyx_XDECREF(__pyx_v_k); + __Pyx_XDECREF((PyObject *)__pyx_v_output); + __Pyx_XDECREF((PyObject *)__pyx_v_au); + __Pyx_XDECREF((PyObject *)__pyx_v_av); + __Pyx_XDECREF((PyObject *)__pyx_v_aw); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "claude_top_level_library.pyx":39 +/* "claude_top_level_library.pyx":59 * return output * * def radiation_calculation(np.ndarray temperature_world, np.ndarray temperature_atmos, np.ndarray air_pressure, np.ndarray air_density, np.ndarray heat_capacity_earth, np.ndarray albedo, DTYPE_f insolation, np.ndarray lat, np.ndarray lon, np.ndarray heights, np.ndarray dz, np.int_t t, np.int_t dt, DTYPE_f day, DTYPE_f year, DTYPE_f axial_tilt): # <<<<<<<<<<<<<< @@ -2567,9 +4242,9 @@ static PyObject *__pyx_pf_24claude_top_level_library_divergence_with_scalar(CYTH */ /* Python wrapper */ -static PyObject *__pyx_pw_24claude_top_level_library_3radiation_calculation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_24claude_top_level_library_3radiation_calculation = {"radiation_calculation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_top_level_library_3radiation_calculation, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_24claude_top_level_library_3radiation_calculation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_24claude_top_level_library_7radiation_calculation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_24claude_top_level_library_7radiation_calculation = {"radiation_calculation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_top_level_library_7radiation_calculation, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_24claude_top_level_library_7radiation_calculation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_temperature_world = 0; PyArrayObject *__pyx_v_temperature_atmos = 0; PyArrayObject *__pyx_v_air_pressure = 0; @@ -2643,95 +4318,95 @@ static PyObject *__pyx_pw_24claude_top_level_library_3radiation_calculation(PyOb case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_temperature_atmos)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 1); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 1); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_air_pressure)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 2); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 2); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_air_density)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 3); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 3); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_heat_capacity_earth)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 4); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 4); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_albedo)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 5); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 5); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_insolation)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 6); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 6); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 7); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 7); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lon)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 8); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 8); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_heights)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 9); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 9); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dz)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 10); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 10); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 11); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 11); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dt)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 12); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 12); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_day)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 13); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 13); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 14: if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_year)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 14); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 14); __PYX_ERR(0, 59, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 15: if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_axial_tilt)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 15); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, 15); __PYX_ERR(0, 59, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "radiation_calculation") < 0)) __PYX_ERR(0, 39, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "radiation_calculation") < 0)) __PYX_ERR(0, 59, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 16) { goto __pyx_L5_argtuple_error; @@ -2759,36 +4434,36 @@ static PyObject *__pyx_pw_24claude_top_level_library_3radiation_calculation(PyOb __pyx_v_air_density = ((PyArrayObject *)values[3]); __pyx_v_heat_capacity_earth = ((PyArrayObject *)values[4]); __pyx_v_albedo = ((PyArrayObject *)values[5]); - __pyx_v_insolation = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_insolation == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) + __pyx_v_insolation = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_insolation == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) __pyx_v_lat = ((PyArrayObject *)values[7]); __pyx_v_lon = ((PyArrayObject *)values[8]); __pyx_v_heights = ((PyArrayObject *)values[9]); __pyx_v_dz = ((PyArrayObject *)values[10]); - __pyx_v_t = __Pyx_PyInt_As_npy_long(values[11]); if (unlikely((__pyx_v_t == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) - __pyx_v_dt = __Pyx_PyInt_As_npy_long(values[12]); if (unlikely((__pyx_v_dt == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) - __pyx_v_day = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_day == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) - __pyx_v_year = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_year == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) - __pyx_v_axial_tilt = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_axial_tilt == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) + __pyx_v_t = __Pyx_PyInt_As_npy_long(values[11]); if (unlikely((__pyx_v_t == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + __pyx_v_dt = __Pyx_PyInt_As_npy_long(values[12]); if (unlikely((__pyx_v_dt == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + __pyx_v_day = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_day == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + __pyx_v_year = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_year == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) + __pyx_v_axial_tilt = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_axial_tilt == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 39, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("radiation_calculation", 1, 16, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 59, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("claude_top_level_library.radiation_calculation", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_temperature_world), __pyx_ptype_5numpy_ndarray, 1, "temperature_world", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_temperature_atmos), __pyx_ptype_5numpy_ndarray, 1, "temperature_atmos", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_air_pressure), __pyx_ptype_5numpy_ndarray, 1, "air_pressure", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_air_density), __pyx_ptype_5numpy_ndarray, 1, "air_density", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_heat_capacity_earth), __pyx_ptype_5numpy_ndarray, 1, "heat_capacity_earth", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_albedo), __pyx_ptype_5numpy_ndarray, 1, "albedo", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5numpy_ndarray, 1, "lat", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lon), __pyx_ptype_5numpy_ndarray, 1, "lon", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_heights), __pyx_ptype_5numpy_ndarray, 1, "heights", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dz), __pyx_ptype_5numpy_ndarray, 1, "dz", 0))) __PYX_ERR(0, 39, __pyx_L1_error) - __pyx_r = __pyx_pf_24claude_top_level_library_2radiation_calculation(__pyx_self, __pyx_v_temperature_world, __pyx_v_temperature_atmos, __pyx_v_air_pressure, __pyx_v_air_density, __pyx_v_heat_capacity_earth, __pyx_v_albedo, __pyx_v_insolation, __pyx_v_lat, __pyx_v_lon, __pyx_v_heights, __pyx_v_dz, __pyx_v_t, __pyx_v_dt, __pyx_v_day, __pyx_v_year, __pyx_v_axial_tilt); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_temperature_world), __pyx_ptype_5numpy_ndarray, 1, "temperature_world", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_temperature_atmos), __pyx_ptype_5numpy_ndarray, 1, "temperature_atmos", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_air_pressure), __pyx_ptype_5numpy_ndarray, 1, "air_pressure", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_air_density), __pyx_ptype_5numpy_ndarray, 1, "air_density", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_heat_capacity_earth), __pyx_ptype_5numpy_ndarray, 1, "heat_capacity_earth", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_albedo), __pyx_ptype_5numpy_ndarray, 1, "albedo", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lat), __pyx_ptype_5numpy_ndarray, 1, "lat", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lon), __pyx_ptype_5numpy_ndarray, 1, "lon", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_heights), __pyx_ptype_5numpy_ndarray, 1, "heights", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dz), __pyx_ptype_5numpy_ndarray, 1, "dz", 0))) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_r = __pyx_pf_24claude_top_level_library_6radiation_calculation(__pyx_self, __pyx_v_temperature_world, __pyx_v_temperature_atmos, __pyx_v_air_pressure, __pyx_v_air_density, __pyx_v_heat_capacity_earth, __pyx_v_albedo, __pyx_v_insolation, __pyx_v_lat, __pyx_v_lon, __pyx_v_heights, __pyx_v_dz, __pyx_v_t, __pyx_v_dt, __pyx_v_day, __pyx_v_year, __pyx_v_axial_tilt); /* function exit code */ goto __pyx_L0; @@ -2799,7 +4474,7 @@ static PyObject *__pyx_pw_24claude_top_level_library_3radiation_calculation(PyOb return __pyx_r; } -static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_temperature_world, PyArrayObject *__pyx_v_temperature_atmos, PyArrayObject *__pyx_v_air_pressure, PyArrayObject *__pyx_v_air_density, PyArrayObject *__pyx_v_heat_capacity_earth, PyArrayObject *__pyx_v_albedo, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_insolation, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, PyArrayObject *__pyx_v_heights, PyArrayObject *__pyx_v_dz, __pyx_t_5numpy_int_t __pyx_v_t, __pyx_t_5numpy_int_t __pyx_v_dt, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_day, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_year, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_axial_tilt) { +static PyObject *__pyx_pf_24claude_top_level_library_6radiation_calculation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_temperature_world, PyArrayObject *__pyx_v_temperature_atmos, PyArrayObject *__pyx_v_air_pressure, PyArrayObject *__pyx_v_air_density, PyArrayObject *__pyx_v_heat_capacity_earth, PyArrayObject *__pyx_v_albedo, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_insolation, PyArrayObject *__pyx_v_lat, PyArrayObject *__pyx_v_lon, PyArrayObject *__pyx_v_heights, PyArrayObject *__pyx_v_dz, __pyx_t_5numpy_int_t __pyx_v_t, __pyx_t_5numpy_int_t __pyx_v_dt, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_day, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_year, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_axial_tilt) { __pyx_t_5numpy_int_t __pyx_v_nlat; __pyx_t_5numpy_int_t __pyx_v_nlon; __pyx_t_5numpy_int_t __pyx_v_nlevels; @@ -2812,6 +4487,7 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH PyArrayObject *__pyx_v_Q = 0; PyArrayObject *__pyx_v_pressure_profile = 0; PyArrayObject *__pyx_v_density_profile = 0; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_sun_lat; PyObject *__pyx_v_k = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2822,40 +4498,41 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH __pyx_t_5numpy_int_t __pyx_t_5; __pyx_t_5numpy_int_t __pyx_t_6; __pyx_t_5numpy_int_t __pyx_t_7; - __pyx_t_5numpy_int_t __pyx_t_8; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_t_8; __pyx_t_5numpy_int_t __pyx_t_9; __pyx_t_5numpy_int_t __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - Py_ssize_t __pyx_t_13; - PyObject *(*__pyx_t_14)(PyObject *); - PyObject *__pyx_t_15 = NULL; + __pyx_t_5numpy_int_t __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + Py_ssize_t __pyx_t_14; + PyObject *(*__pyx_t_15)(PyObject *); PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; - int __pyx_t_18; - PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_18 = NULL; + int __pyx_t_19; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; PyObject *__pyx_t_24 = NULL; PyObject *__pyx_t_25 = NULL; + PyObject *__pyx_t_26 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("radiation_calculation", 0); - /* "claude_top_level_library.pyx":42 + /* "claude_top_level_library.pyx":62 * # calculate change in temperature of ground and atmosphere due to radiative imbalance * cdef np.int_t nlat,nlon,nlevels,i,j * cdef DTYPE_f fl = 0.1 # <<<<<<<<<<<<<< * cdef np.ndarray upward_radiation,downward_radiation,optical_depth,Q, pressure_profile, density_profile - * + * cdef DTYPE_f sun_lat */ __pyx_v_fl = 0.1; - /* "claude_top_level_library.pyx":45 - * cdef np.ndarray upward_radiation,downward_radiation,optical_depth,Q, pressure_profile, density_profile + /* "claude_top_level_library.pyx":66 + * cdef DTYPE_f sun_lat * * nlat = temperature_atmos.shape[0] # <<<<<<<<<<<<<< * nlon = temperature_atmos.shape[1] @@ -2863,7 +4540,7 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH */ __pyx_v_nlat = (__pyx_v_temperature_atmos->dimensions[0]); - /* "claude_top_level_library.pyx":46 + /* "claude_top_level_library.pyx":67 * * nlat = temperature_atmos.shape[0] * nlon = temperature_atmos.shape[1] # <<<<<<<<<<<<<< @@ -2872,7 +4549,7 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH */ __pyx_v_nlon = (__pyx_v_temperature_atmos->dimensions[1]); - /* "claude_top_level_library.pyx":47 + /* "claude_top_level_library.pyx":68 * nlat = temperature_atmos.shape[0] * nlon = temperature_atmos.shape[1] * nlevels = temperature_atmos.shape[2] # <<<<<<<<<<<<<< @@ -2881,19 +4558,19 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH */ __pyx_v_nlevels = (__pyx_v_temperature_atmos->dimensions[2]); - /* "claude_top_level_library.pyx":49 + /* "claude_top_level_library.pyx":70 * nlevels = temperature_atmos.shape[2] * * upward_radiation = np.zeros(nlevels) # <<<<<<<<<<<<<< * downward_radiation = np.zeros(nlevels) * optical_depth = np.zeros(nlevels) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -2908,26 +4585,26 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 49, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 70, __pyx_L1_error) __pyx_v_upward_radiation = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":50 + /* "claude_top_level_library.pyx":71 * * upward_radiation = np.zeros(nlevels) * downward_radiation = np.zeros(nlevels) # <<<<<<<<<<<<<< * optical_depth = np.zeros(nlevels) * Q = np.zeros(nlevels) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -2942,26 +4619,26 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 50, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 71, __pyx_L1_error) __pyx_v_downward_radiation = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":51 + /* "claude_top_level_library.pyx":72 * upward_radiation = np.zeros(nlevels) * downward_radiation = np.zeros(nlevels) * optical_depth = np.zeros(nlevels) # <<<<<<<<<<<<<< * Q = np.zeros(nlevels) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -2976,26 +4653,26 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 51, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 72, __pyx_L1_error) __pyx_v_optical_depth = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":52 + /* "claude_top_level_library.pyx":73 * downward_radiation = np.zeros(nlevels) * optical_depth = np.zeros(nlevels) * Q = np.zeros(nlevels) # <<<<<<<<<<<<<< * * for i in range(nlat): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -3010,109 +4687,202 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 52, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 73, __pyx_L1_error) __pyx_v_Q = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":54 + /* "claude_top_level_library.pyx":75 * Q = np.zeros(nlevels) * * for i in range(nlat): # <<<<<<<<<<<<<< + * sun_lat = low_level.surface_optical_depth(lat[i]) * for j in range(nlon): - * # calculate optical depth */ __pyx_t_5 = __pyx_v_nlat; __pyx_t_6 = __pyx_t_5; for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "claude_top_level_library.pyx":55 + /* "claude_top_level_library.pyx":76 * * for i in range(nlat): + * sun_lat = low_level.surface_optical_depth(lat[i]) # <<<<<<<<<<<<<< + * for j in range(nlon): + * # calculate optical depth + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_low_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_surface_optical_depth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lat), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_sun_lat = __pyx_t_8; + + /* "claude_top_level_library.pyx":77 + * for i in range(nlat): + * sun_lat = low_level.surface_optical_depth(lat[i]) * for j in range(nlon): # <<<<<<<<<<<<<< * # calculate optical depth * pressure_profile = air_pressure[i,j,:] */ - __pyx_t_8 = __pyx_v_nlon; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_j = __pyx_t_10; + __pyx_t_9 = __pyx_v_nlon; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_j = __pyx_t_11; - /* "claude_top_level_library.pyx":57 + /* "claude_top_level_library.pyx":79 * for j in range(nlon): * # calculate optical depth * pressure_profile = air_pressure[i,j,:] # <<<<<<<<<<<<<< * density_profile = air_density[i,j,:] - * optical_depth = low_level.surface_optical_depth(lat[i])*(fl*(pressure_profile/pressure_profile[0]) + (1-fl)*(pressure_profile/pressure_profile[0])**4) + * optical_depth = sun_lat*(fl*(pressure_profile/pressure_profile[0]) + (1-fl)*(pressure_profile/pressure_profile[0])**4) */ - __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __Pyx_INCREF(__pyx_slice_); __Pyx_GIVEREF(__pyx_slice_); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_slice_); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_slice_); __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_air_pressure), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_pressure_profile, ((PyArrayObject *)__pyx_t_2)); - __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_air_pressure), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_pressure_profile, ((PyArrayObject *)__pyx_t_3)); + __pyx_t_3 = 0; - /* "claude_top_level_library.pyx":58 + /* "claude_top_level_library.pyx":80 * # calculate optical depth * pressure_profile = air_pressure[i,j,:] * density_profile = air_density[i,j,:] # <<<<<<<<<<<<<< - * optical_depth = low_level.surface_optical_depth(lat[i])*(fl*(pressure_profile/pressure_profile[0]) + (1-fl)*(pressure_profile/pressure_profile[0])**4) + * optical_depth = sun_lat*(fl*(pressure_profile/pressure_profile[0]) + (1-fl)*(pressure_profile/pressure_profile[0])**4) * */ - __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_INCREF(__pyx_slice_); __Pyx_GIVEREF(__pyx_slice_); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_slice_); + __pyx_t_3 = 0; __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_air_density), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_air_density), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_density_profile, ((PyArrayObject *)__pyx_t_3)); - __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_density_profile, ((PyArrayObject *)__pyx_t_2)); + __pyx_t_2 = 0; - /* "claude_top_level_library.pyx":59 + /* "claude_top_level_library.pyx":81 * pressure_profile = air_pressure[i,j,:] * density_profile = air_density[i,j,:] - * optical_depth = low_level.surface_optical_depth(lat[i])*(fl*(pressure_profile/pressure_profile[0]) + (1-fl)*(pressure_profile/pressure_profile[0])**4) # <<<<<<<<<<<<<< + * optical_depth = sun_lat*(fl*(pressure_profile/pressure_profile[0]) + (1-fl)*(pressure_profile/pressure_profile[0])**4) # <<<<<<<<<<<<<< * * # calculate upward longwave flux, bc is thermal radiation at surface */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_low_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_sun_lat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_fl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_surface_optical_depth); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pressure_profile), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_pressure_profile), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyFloat_FromDouble((1.0 - __pyx_v_fl)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pressure_profile), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_pressure_profile), __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Power(__pyx_t_12, __pyx_int_4, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_optical_depth, ((PyArrayObject *)__pyx_t_12)); + __pyx_t_12 = 0; + + /* "claude_top_level_library.pyx":84 + * + * # calculate upward longwave flux, bc is thermal radiation at surface + * upward_radiation[0] = low_level.thermal_radiation(temperature_world[i,j]) # <<<<<<<<<<<<<< + * for k in np.arange(1,nlevels): + * upward_radiation[k] = (upward_radiation[k-1] - (optical_depth[k]-optical_depth[k-1])*(low_level.thermal_radiation(temperature_atmos[i,j,k])))/(1+optical_depth[k-1]-optical_depth[k]) + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_low_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_thermal_radiation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lat), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_world), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); @@ -3123,77 +4893,31 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); + __pyx_t_12 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_fl); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pressure_profile), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_pressure_profile), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyFloat_FromDouble((1.0 - __pyx_v_fl)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pressure_profile), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_pressure_profile), __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Power(__pyx_t_11, __pyx_int_4, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_DECREF_SET(__pyx_v_optical_depth, ((PyArrayObject *)__pyx_t_11)); - __pyx_t_11 = 0; + if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_upward_radiation), 0, __pyx_t_12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "claude_top_level_library.pyx":62 - * + /* "claude_top_level_library.pyx":85 * # calculate upward longwave flux, bc is thermal radiation at surface - * upward_radiation[0] = low_level.thermal_radiation(temperature_world[i,j]) # <<<<<<<<<<<<<< - * for k in np.arange(1,nlevels): + * upward_radiation[0] = low_level.thermal_radiation(temperature_world[i,j]) + * for k in np.arange(1,nlevels): # <<<<<<<<<<<<<< * upward_radiation[k] = (upward_radiation[k-1] - (optical_depth[k]-optical_depth[k-1])*(low_level.thermal_radiation(temperature_atmos[i,j,k])))/(1+optical_depth[k-1]-optical_depth[k]) + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_low_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_thermal_radiation); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arange); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __pyx_t_2 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_world), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; + __pyx_t_13 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { @@ -3201,213 +4925,179 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_11 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_upward_radiation), 0, __pyx_t_11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "claude_top_level_library.pyx":63 - * # calculate upward longwave flux, bc is thermal radiation at surface - * upward_radiation[0] = low_level.thermal_radiation(temperature_world[i,j]) - * for k in np.arange(1,nlevels): # <<<<<<<<<<<<<< - * upward_radiation[k] = (upward_radiation[k-1] - (optical_depth[k]-optical_depth[k-1])*(low_level.thermal_radiation(temperature_atmos[i,j,k])))/(1+optical_depth[k-1]-optical_depth[k]) - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_12 = 1; + __pyx_t_13 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_1, __pyx_t_3}; - __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 63, __pyx_L1_error) + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_1, __pyx_t_2}; + __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_1, __pyx_t_3}; - __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 63, __pyx_L1_error) + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_1, __pyx_t_2}; + __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { - __pyx_t_2 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_12, __pyx_int_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_12, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_13, __pyx_int_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_13, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) { - __pyx_t_1 = __pyx_t_11; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0; - __pyx_t_14 = NULL; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (likely(PyList_CheckExact(__pyx_t_12)) || PyTuple_CheckExact(__pyx_t_12)) { + __pyx_t_3 = __pyx_t_12; __Pyx_INCREF(__pyx_t_3); __pyx_t_14 = 0; + __pyx_t_15 = NULL; } else { - __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_14 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 85, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (likely(!__pyx_t_15)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_11); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_12); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 85, __pyx_L1_error) #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); #endif } else { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_11); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_12); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 85, __pyx_L1_error) #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); #endif } } else { - __pyx_t_11 = __pyx_t_14(__pyx_t_1); - if (unlikely(!__pyx_t_11)) { + __pyx_t_12 = __pyx_t_15(__pyx_t_3); + if (unlikely(!__pyx_t_12)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 63, __pyx_L1_error) + else __PYX_ERR(0, 85, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_t_12); } - __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_11); - __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_12); + __pyx_t_12 = 0; - /* "claude_top_level_library.pyx":64 + /* "claude_top_level_library.pyx":86 * upward_radiation[0] = low_level.thermal_radiation(temperature_world[i,j]) * for k in np.arange(1,nlevels): * upward_radiation[k] = (upward_radiation[k-1] - (optical_depth[k]-optical_depth[k-1])*(low_level.thermal_radiation(temperature_atmos[i,j,k])))/(1+optical_depth[k-1]-optical_depth[k]) # <<<<<<<<<<<<<< * * # calculate downward longwave flux, bc is zero at TOA (in model) */ - __pyx_t_11 = __Pyx_PyInt_SubtractObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_upward_radiation), __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyInt_SubtractObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_upward_radiation), __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_v_k); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_t_12, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_low_level); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_thermal_radiation); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_low_level); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_thermal_radiation); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); - __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16); + __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17); __Pyx_INCREF(__pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_v_k); - __pyx_t_11 = 0; - __pyx_t_16 = 0; - __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_atmos), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_15); - if (likely(__pyx_t_17)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); - __Pyx_INCREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_v_k); + __pyx_t_12 = 0; + __pyx_t_17 = 0; + __pyx_t_17 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_atmos), __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_16); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); + __Pyx_INCREF(__pyx_t_18); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_15, function); + __Pyx_DECREF_SET(__pyx_t_16, function); } } - __pyx_t_4 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_17, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_16); - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_4 = (__pyx_t_18) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_18, __pyx_t_17) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_16 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyInt_SubtractObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_2, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Subtract(__pyx_t_15, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyInt_SubtractObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_1, 1, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Subtract(__pyx_t_16, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_upward_radiation), __pyx_v_k, __pyx_t_2) < 0)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_upward_radiation), __pyx_v_k, __pyx_t_1) < 0)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":63 + /* "claude_top_level_library.pyx":85 * # calculate upward longwave flux, bc is thermal radiation at surface * upward_radiation[0] = low_level.thermal_radiation(temperature_world[i,j]) * for k in np.arange(1,nlevels): # <<<<<<<<<<<<<< @@ -3415,116 +5105,290 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH * */ } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "claude_top_level_library.pyx":67 + /* "claude_top_level_library.pyx":89 * * # calculate downward longwave flux, bc is zero at TOA (in model) * downward_radiation[-1] = 0 # <<<<<<<<<<<<<< * for k in np.arange(0,nlevels-1)[::-1]: * downward_radiation[k] = (downward_radiation[k+1] - low_level.thermal_radiation(temperature_atmos[i,j,k])*(optical_depth[k+1]-optical_depth[k]))/(1 + optical_depth[k] - optical_depth[k+1]) */ - if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_downward_radiation), -1L, __pyx_int_0, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 67, __pyx_L1_error) + if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_downward_radiation), -1L, __pyx_int_0, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 89, __pyx_L1_error) - /* "claude_top_level_library.pyx":68 + /* "claude_top_level_library.pyx":90 * # calculate downward longwave flux, bc is zero at TOA (in model) * downward_radiation[-1] = 0 * for k in np.arange(0,nlevels-1)[::-1]: # <<<<<<<<<<<<<< * downward_radiation[k] = (downward_radiation[k+1] - low_level.thermal_radiation(temperature_atmos[i,j,k])*(optical_depth[k+1]-optical_depth[k]))/(1 + optical_depth[k] - optical_depth[k+1]) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arange); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_npy_long((__pyx_v_nlevels - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_arange); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_npy_long((__pyx_v_nlevels - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + __pyx_t_13 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_12 = 1; + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_13 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_0, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_0, __pyx_t_1}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_0, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_int_0, __pyx_t_1}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { - __pyx_t_15 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_12, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_12, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_13, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_13, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_slice__2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_14 = 0; + __pyx_t_15 = NULL; + } else { + __pyx_t_14 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 90, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_15)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_2); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 90, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_2); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 90, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_15(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 90, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + + /* "claude_top_level_library.pyx":91 + * downward_radiation[-1] = 0 + * for k in np.arange(0,nlevels-1)[::-1]: + * downward_radiation[k] = (downward_radiation[k+1] - low_level.thermal_radiation(temperature_atmos[i,j,k])*(optical_depth[k+1]-optical_depth[k]))/(1 + optical_depth[k] - optical_depth[k+1]) # <<<<<<<<<<<<<< + * + * # gradient of difference provides heating at each level + */ + __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_downward_radiation), __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_low_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_thermal_radiation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17); + __Pyx_INCREF(__pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_v_k); + __pyx_t_1 = 0; + __pyx_t_17 = 0; + __pyx_t_17 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_atmos), __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_18) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_18, __pyx_t_17) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_17 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_18 = PyNumber_Subtract(__pyx_t_17, __pyx_t_4); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_18); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyNumber_Subtract(__pyx_t_16, __pyx_t_4); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_4, 1, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Subtract(__pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_18, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_downward_radiation), __pyx_v_k, __pyx_t_2) < 0)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "claude_top_level_library.pyx":90 + * # calculate downward longwave flux, bc is zero at TOA (in model) + * downward_radiation[-1] = 0 + * for k in np.arange(0,nlevels-1)[::-1]: # <<<<<<<<<<<<<< + * downward_radiation[k] = (downward_radiation[k+1] - low_level.thermal_radiation(temperature_atmos[i,j,k])*(optical_depth[k+1]-optical_depth[k]))/(1 + optical_depth[k] - optical_depth[k+1]) + * + */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_slice__2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) + + /* "claude_top_level_library.pyx":94 + * + * # gradient of difference provides heating at each level + * for k in np.arange(nlevels): # <<<<<<<<<<<<<< + * Q[k] = -low_level.scalar_gradient_z_1D(upward_radiation-downward_radiation,dz,k)/(1E3*density_profile[k]) + * # make sure model does not have a higher top than 50km!! + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_18 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_18) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_18, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0; - __pyx_t_14 = NULL; + __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_14 = 0; + __pyx_t_15 = NULL; } else { - __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_14 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 94, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (likely(!__pyx_t_15)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_3); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 94, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_3); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 94, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { - __pyx_t_3 = __pyx_t_14(__pyx_t_1); + __pyx_t_3 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 68, __pyx_L1_error) + else __PYX_ERR(0, 94, __pyx_L1_error) } break; } @@ -3533,275 +5397,101 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3); __pyx_t_3 = 0; - /* "claude_top_level_library.pyx":69 - * downward_radiation[-1] = 0 - * for k in np.arange(0,nlevels-1)[::-1]: - * downward_radiation[k] = (downward_radiation[k+1] - low_level.thermal_radiation(temperature_atmos[i,j,k])*(optical_depth[k+1]-optical_depth[k]))/(1 + optical_depth[k] - optical_depth[k+1]) # <<<<<<<<<<<<<< - * - * # gradient of difference provides heating at each level - */ - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_downward_radiation), __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_low_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_thermal_radiation); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_v_k); - __pyx_t_2 = 0; - __pyx_t_16 = 0; - __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_atmos), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_17)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_17, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_16); - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_17 = PyNumber_Subtract(__pyx_t_16, __pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_17); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = PyNumber_Subtract(__pyx_t_15, __pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_15 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_4, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_k, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_optical_depth), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_t_15, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_17, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_downward_radiation), __pyx_v_k, __pyx_t_3) < 0)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "claude_top_level_library.pyx":68 - * # calculate downward longwave flux, bc is zero at TOA (in model) - * downward_radiation[-1] = 0 - * for k in np.arange(0,nlevels-1)[::-1]: # <<<<<<<<<<<<<< - * downward_radiation[k] = (downward_radiation[k+1] - low_level.thermal_radiation(temperature_atmos[i,j,k])*(optical_depth[k+1]-optical_depth[k]))/(1 + optical_depth[k] - optical_depth[k+1]) - * - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "claude_top_level_library.pyx":72 - * - * # gradient of difference provides heating at each level - * for k in np.arange(nlevels): # <<<<<<<<<<<<<< - * Q[k] = -low_level.scalar_gradient_z_1D(upward_radiation-downward_radiation,dz,k)/(1E3*density_profile[k]) - * # make sure model does not have a higher top than 50km!! - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nlevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_17 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_17)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_17, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0; - __pyx_t_14 = NULL; - } else { - __pyx_t_13 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_14 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 72, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 72, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 72, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_14(__pyx_t_4); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 72, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1); - __pyx_t_1 = 0; - - /* "claude_top_level_library.pyx":73 + /* "claude_top_level_library.pyx":95 * # gradient of difference provides heating at each level * for k in np.arange(nlevels): * Q[k] = -low_level.scalar_gradient_z_1D(upward_radiation-downward_radiation,dz,k)/(1E3*density_profile[k]) # <<<<<<<<<<<<<< * # make sure model does not have a higher top than 50km!! * # approximate SW heating of ozone */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_low_level); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_scalar_gradient_z_1D); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_upward_radiation), ((PyObject *)__pyx_v_downward_radiation)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_17); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); - __Pyx_INCREF(__pyx_t_15); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_low_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_scalar_gradient_z_1D); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(((PyObject *)__pyx_v_upward_radiation), ((PyObject *)__pyx_v_downward_radiation)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_16 = NULL; + __pyx_t_13 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) { + __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_18); + if (likely(__pyx_t_16)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18); + __Pyx_INCREF(__pyx_t_16); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_17, function); - __pyx_t_12 = 1; + __Pyx_DECREF_SET(__pyx_t_18, function); + __pyx_t_13 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_t_3, ((PyObject *)__pyx_v_dz), __pyx_v_k}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyFunction_Check(__pyx_t_18)) { + PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_t_2, ((PyObject *)__pyx_v_dz), __pyx_v_k}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_t_3, ((PyObject *)__pyx_v_dz), __pyx_v_k}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) { + PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_t_2, ((PyObject *)__pyx_v_dz), __pyx_v_k}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { - __pyx_t_16 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_15) { - __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL; + __pyx_t_17 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + if (__pyx_t_16) { + __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); __pyx_t_16 = NULL; } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_12, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_13, __pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_dz)); __Pyx_GIVEREF(((PyObject *)__pyx_v_dz)); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_12, ((PyObject *)__pyx_v_dz)); + PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_13, ((PyObject *)__pyx_v_dz)); __Pyx_INCREF(__pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_12, __pyx_v_k); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_13, __pyx_v_k); + __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; } - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_density_profile), __pyx_v_k); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = PyNumber_Multiply(__pyx_float_1E3, __pyx_t_3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_density_profile), __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_16 = PyNumber_Multiply(__pyx_float_1E3, __pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_17, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_18, __pyx_t_17); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_Q), __pyx_v_k, __pyx_t_1) < 0)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_Q), __pyx_v_k, __pyx_t_3) < 0)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "claude_top_level_library.pyx":76 + /* "claude_top_level_library.pyx":98 * # make sure model does not have a higher top than 50km!! * # approximate SW heating of ozone * if heights[k] > 20E3: # <<<<<<<<<<<<<< * Q[k] += low_level.solar(5,lat[i],lon[j],t,day, year, axial_tilt)*((((heights[k]-20E3)/1E3)**2)/(30**2))/(24*60*60) * */ - __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_heights), __pyx_v_k); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_16 = PyObject_RichCompare(__pyx_t_1, __pyx_float_20E3, Py_GT); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (__pyx_t_18) { + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_heights), __pyx_v_k); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = PyObject_RichCompare(__pyx_t_3, __pyx_float_20E3, Py_GT); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + if (__pyx_t_19) { - /* "claude_top_level_library.pyx":77 + /* "claude_top_level_library.pyx":99 * # approximate SW heating of ozone * if heights[k] > 20E3: * Q[k] += low_level.solar(5,lat[i],lon[j],t,day, year, axial_tilt)*((((heights[k]-20E3)/1E3)**2)/(30**2))/(24*60*60) # <<<<<<<<<<<<<< @@ -3809,128 +5499,128 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH * temperature_atmos[i,j,:] += Q*dt */ __Pyx_INCREF(__pyx_v_k); - __pyx_t_16 = __pyx_v_k; - __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_Q), __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_low_level); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_17 = __pyx_v_k; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_Q), __pyx_t_17); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_solar); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lat), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lon), __pyx_v_j, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_low_level); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyInt_From_npy_long(__pyx_v_t); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_19 = PyFloat_FromDouble(__pyx_v_day); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_20 = PyFloat_FromDouble(__pyx_v_year); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_solar); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lat), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lon), __pyx_v_j, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = __Pyx_PyInt_From_npy_long(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_20 = PyFloat_FromDouble(__pyx_v_day); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); - __pyx_t_21 = PyFloat_FromDouble(__pyx_v_axial_tilt); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_21 = PyFloat_FromDouble(__pyx_v_year); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); - __pyx_t_22 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) { - __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_15); - if (likely(__pyx_t_22)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); - __Pyx_INCREF(__pyx_t_22); + __pyx_t_22 = PyFloat_FromDouble(__pyx_v_axial_tilt); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_23 = NULL; + __pyx_t_13 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) { + __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_16); + if (likely(__pyx_t_23)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); + __Pyx_INCREF(__pyx_t_23); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_15, function); - __pyx_t_12 = 1; + __Pyx_DECREF_SET(__pyx_t_16, function); + __pyx_t_13 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_15)) { - PyObject *__pyx_temp[8] = {__pyx_t_22, __pyx_int_5, __pyx_t_3, __pyx_t_2, __pyx_t_11, __pyx_t_19, __pyx_t_20, __pyx_t_21}; - __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_12, 7+__pyx_t_12); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyFunction_Check(__pyx_t_16)) { + PyObject *__pyx_temp[8] = {__pyx_t_23, __pyx_int_5, __pyx_t_2, __pyx_t_1, __pyx_t_12, __pyx_t_20, __pyx_t_21, __pyx_t_22}; + __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_13, 7+__pyx_t_13); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) { - PyObject *__pyx_temp[8] = {__pyx_t_22, __pyx_int_5, __pyx_t_3, __pyx_t_2, __pyx_t_11, __pyx_t_19, __pyx_t_20, __pyx_t_21}; - __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_12, 7+__pyx_t_12); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) { + PyObject *__pyx_temp[8] = {__pyx_t_23, __pyx_int_5, __pyx_t_2, __pyx_t_1, __pyx_t_12, __pyx_t_20, __pyx_t_21, __pyx_t_22}; + __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_13, 7+__pyx_t_13); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; } else #endif { - __pyx_t_23 = PyTuple_New(7+__pyx_t_12); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - if (__pyx_t_22) { - __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_22); __pyx_t_22 = NULL; + __pyx_t_24 = PyTuple_New(7+__pyx_t_13); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + if (__pyx_t_23) { + __Pyx_GIVEREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_23); __pyx_t_23 = NULL; } __Pyx_INCREF(__pyx_int_5); __Pyx_GIVEREF(__pyx_int_5); - PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_12, __pyx_int_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_12, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_13, __pyx_int_5); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_23, 2+__pyx_t_12, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_23, 3+__pyx_t_12, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_23, 4+__pyx_t_12, __pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_13, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_24, 2+__pyx_t_13, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_24, 3+__pyx_t_13, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_23, 5+__pyx_t_12, __pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_24, 4+__pyx_t_13, __pyx_t_20); __Pyx_GIVEREF(__pyx_t_21); - PyTuple_SET_ITEM(__pyx_t_23, 6+__pyx_t_12, __pyx_t_21); - __pyx_t_3 = 0; + PyTuple_SET_ITEM(__pyx_t_24, 5+__pyx_t_13, __pyx_t_21); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_24, 6+__pyx_t_13, __pyx_t_22); __pyx_t_2 = 0; - __pyx_t_11 = 0; - __pyx_t_19 = 0; + __pyx_t_1 = 0; + __pyx_t_12 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_23, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_22 = 0; + __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_24, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; } - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_heights), __pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_23 = __Pyx_PyFloat_SubtractObjC(__pyx_t_15, __pyx_float_20E3, 20E3, 0, 0); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyFloat_DivideObjC(__pyx_t_23, __pyx_float_1E3, 1E3, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyNumber_Power(__pyx_t_15, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyNumber_Divide(__pyx_t_23, __pyx_int_900); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyNumber_Multiply(__pyx_t_17, __pyx_t_15); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_PyNumber_Divide(__pyx_t_23, __pyx_int_86400); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_15); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_Q), __pyx_t_16, __pyx_t_23) < 0)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_heights), __pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_24 = __Pyx_PyFloat_SubtractObjC(__pyx_t_16, __pyx_float_20E3, 20E3, 0, 0); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyFloat_DivideObjC(__pyx_t_24, __pyx_float_1E3, 1E3, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __pyx_t_24 = PyNumber_Power(__pyx_t_16, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_t_24, __pyx_int_900); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __pyx_t_24 = PyNumber_Multiply(__pyx_t_18, __pyx_t_16); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_t_24, __pyx_int_86400); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __pyx_t_24 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_Q), __pyx_t_17, __pyx_t_24) < 0)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - /* "claude_top_level_library.pyx":76 + /* "claude_top_level_library.pyx":98 * # make sure model does not have a higher top than 50km!! * # approximate SW heating of ozone * if heights[k] > 20E3: # <<<<<<<<<<<<<< @@ -3939,7 +5629,7 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH */ } - /* "claude_top_level_library.pyx":72 + /* "claude_top_level_library.pyx":94 * * # gradient of difference provides heating at each level * for k in np.arange(nlevels): # <<<<<<<<<<<<<< @@ -3949,247 +5639,247 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "claude_top_level_library.pyx":79 + /* "claude_top_level_library.pyx":101 * Q[k] += low_level.solar(5,lat[i],lon[j],t,day, year, axial_tilt)*((((heights[k]-20E3)/1E3)**2)/(30**2))/(24*60*60) * * temperature_atmos[i,j,:] += Q*dt # <<<<<<<<<<<<<< * * # update surface temperature with shortwave radiation flux */ - __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_17); __Pyx_INCREF(__pyx_slice_); __Pyx_GIVEREF(__pyx_slice_); - PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_slice_); + PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_slice_); __pyx_t_4 = 0; - __pyx_t_16 = 0; - __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_atmos), __pyx_t_23); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_17 = 0; + __pyx_t_17 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_atmos), __pyx_t_24); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_dt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_16 = PyNumber_Multiply(((PyObject *)__pyx_v_Q), __pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); - __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_dt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_15 = PyNumber_Multiply(((PyObject *)__pyx_v_Q), __pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_17, __pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_temperature_atmos), __pyx_t_23, __pyx_t_4) < 0)) __PYX_ERR(0, 79, __pyx_L1_error) + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_temperature_atmos), __pyx_t_24, __pyx_t_4) < 0)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - /* "claude_top_level_library.pyx":82 + /* "claude_top_level_library.pyx":104 * * # update surface temperature with shortwave radiation flux * temperature_world[i,j] += dt*((1-albedo[i,j])*(low_level.solar(insolation,lat[i],lon[j],t, day, year, axial_tilt) + downward_radiation[0]) - upward_radiation[0])/heat_capacity_earth[i,j] # <<<<<<<<<<<<<< * * return temperature_world, temperature_atmos */ - __pyx_t_23 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_24 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GIVEREF(__pyx_t_23); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_23); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_GIVEREF(__pyx_t_24); + PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_24); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_4); - __pyx_t_23 = 0; + PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4); + __pyx_t_24 = 0; __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_world), __pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_temperature_world), __pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_23 = __Pyx_PyInt_From_npy_long(__pyx_v_dt); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_16 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_24 = __Pyx_PyInt_From_npy_long(__pyx_v_dt); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); - __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_1); - __pyx_t_16 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_albedo), __pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_t_1, 1, 0, 0); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_low_level); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_solar); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyFloat_FromDouble(__pyx_v_insolation); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_20 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lat), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_19 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lon), __pyx_v_j, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_11 = __Pyx_PyInt_From_npy_long(__pyx_v_t); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_day); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_year); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_22 = PyFloat_FromDouble(__pyx_v_axial_tilt); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_3); + __pyx_t_17 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_albedo), __pyx_t_18); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_t_3, 1, 0, 0); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_low_level); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_solar); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_22); - __pyx_t_24 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) { - __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_21); - if (likely(__pyx_t_24)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21); - __Pyx_INCREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = PyFloat_FromDouble(__pyx_v_insolation); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_21 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lat), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_20 = __Pyx_GetItemInt(((PyObject *)__pyx_v_lon), __pyx_v_j, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_12 = __Pyx_PyInt_From_npy_long(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_day); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_year); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_23 = PyFloat_FromDouble(__pyx_v_axial_tilt); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_25 = NULL; + __pyx_t_13 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { + __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_22); + if (likely(__pyx_t_25)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22); + __Pyx_INCREF(__pyx_t_25); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_21, function); - __pyx_t_12 = 1; + __Pyx_DECREF_SET(__pyx_t_22, function); + __pyx_t_13 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_21)) { - PyObject *__pyx_temp[8] = {__pyx_t_24, __pyx_t_16, __pyx_t_20, __pyx_t_19, __pyx_t_11, __pyx_t_2, __pyx_t_3, __pyx_t_22}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_12, 7+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (PyFunction_Check(__pyx_t_22)) { + PyObject *__pyx_temp[8] = {__pyx_t_25, __pyx_t_17, __pyx_t_21, __pyx_t_20, __pyx_t_12, __pyx_t_1, __pyx_t_2, __pyx_t_23}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_13, 7+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) { - PyObject *__pyx_temp[8] = {__pyx_t_24, __pyx_t_16, __pyx_t_20, __pyx_t_19, __pyx_t_11, __pyx_t_2, __pyx_t_3, __pyx_t_22}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_12, 7+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_22)) { + PyObject *__pyx_temp[8] = {__pyx_t_25, __pyx_t_17, __pyx_t_21, __pyx_t_20, __pyx_t_12, __pyx_t_1, __pyx_t_2, __pyx_t_23}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_13, 7+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; } else #endif { - __pyx_t_25 = PyTuple_New(7+__pyx_t_12); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - if (__pyx_t_24) { - __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_24); __pyx_t_24 = NULL; + __pyx_t_26 = PyTuple_New(7+__pyx_t_13); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_26); + if (__pyx_t_25) { + __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_25); __pyx_t_25 = NULL; } - __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_12, __pyx_t_16); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_26, 0+__pyx_t_13, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_26, 1+__pyx_t_13, __pyx_t_21); __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_12, __pyx_t_20); - __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_25, 2+__pyx_t_12, __pyx_t_19); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_25, 3+__pyx_t_12, __pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_26, 2+__pyx_t_13, __pyx_t_20); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_26, 3+__pyx_t_13, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_26, 4+__pyx_t_13, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_25, 4+__pyx_t_12, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_25, 5+__pyx_t_12, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_22); - PyTuple_SET_ITEM(__pyx_t_25, 6+__pyx_t_12, __pyx_t_22); - __pyx_t_16 = 0; + PyTuple_SET_ITEM(__pyx_t_26, 5+__pyx_t_13, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_26, 6+__pyx_t_13, __pyx_t_23); + __pyx_t_17 = 0; + __pyx_t_21 = 0; __pyx_t_20 = 0; - __pyx_t_19 = 0; - __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_22 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_23 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_t_26, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; } - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_21 = __Pyx_GetItemInt(((PyObject *)__pyx_v_downward_radiation), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_t_25 = PyNumber_Add(__pyx_t_1, __pyx_t_21); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_21 = PyNumber_Multiply(__pyx_t_17, __pyx_t_25); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_upward_radiation), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - __pyx_t_17 = PyNumber_Subtract(__pyx_t_21, __pyx_t_25); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = PyNumber_Multiply(__pyx_t_23, __pyx_t_17); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_23 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_17); - __Pyx_GIVEREF(__pyx_t_23); - PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_23); - __pyx_t_17 = 0; - __pyx_t_23 = 0; - __pyx_t_23 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_heat_capacity_earth), __pyx_t_21); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_21 = __Pyx_PyNumber_Divide(__pyx_t_25, __pyx_t_23); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_21); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_22 = __Pyx_GetItemInt(((PyObject *)__pyx_v_downward_radiation), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_26 = PyNumber_Add(__pyx_t_3, __pyx_t_22); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_26); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_22 = PyNumber_Multiply(__pyx_t_18, __pyx_t_26); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + __pyx_t_26 = __Pyx_GetItemInt(((PyObject *)__pyx_v_upward_radiation), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_26); + __pyx_t_18 = PyNumber_Subtract(__pyx_t_22, __pyx_t_26); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + __pyx_t_26 = PyNumber_Multiply(__pyx_t_24, __pyx_t_18); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_26); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_24 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_24); + PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_24); + __pyx_t_18 = 0; + __pyx_t_24 = 0; + __pyx_t_24 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_heat_capacity_earth), __pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_22 = __Pyx_PyNumber_Divide(__pyx_t_26, __pyx_t_24); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __pyx_t_24 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_22); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_temperature_world), __pyx_t_15, __pyx_t_23) < 0)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_temperature_world), __pyx_t_16, __pyx_t_24) < 0)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; } } - /* "claude_top_level_library.pyx":84 + /* "claude_top_level_library.pyx":106 * temperature_world[i,j] += dt*((1-albedo[i,j])*(low_level.solar(insolation,lat[i],lon[j],t, day, year, axial_tilt) + downward_radiation[0]) - upward_radiation[0])/heat_capacity_earth[i,j] * * return temperature_world, temperature_atmos # <<<<<<<<<<<<<< * - * def velocity_calculation(u,v,air_pressure,old_pressure,air_density,coriolis,gravity,dx,dy,dt): + * def velocity_calculation(np.ndarray u,np.ndarray v,np.ndarray air_pressure,np.ndarray old_pressure,np.ndarray air_density,np.ndarray coriolis,DTYPE_f gravity,np.ndarray dx,DTYPE_f dy,DTYPE_f dt): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); + __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); __Pyx_INCREF(((PyObject *)__pyx_v_temperature_world)); __Pyx_GIVEREF(((PyObject *)__pyx_v_temperature_world)); - PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_temperature_world)); + PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_v_temperature_world)); __Pyx_INCREF(((PyObject *)__pyx_v_temperature_atmos)); __Pyx_GIVEREF(((PyObject *)__pyx_v_temperature_atmos)); - PyTuple_SET_ITEM(__pyx_t_15, 1, ((PyObject *)__pyx_v_temperature_atmos)); - __pyx_r = __pyx_t_15; - __pyx_t_15 = 0; + PyTuple_SET_ITEM(__pyx_t_16, 1, ((PyObject *)__pyx_v_temperature_atmos)); + __pyx_r = __pyx_t_16; + __pyx_t_16 = 0; goto __pyx_L0; - /* "claude_top_level_library.pyx":39 + /* "claude_top_level_library.pyx":59 * return output * * def radiation_calculation(np.ndarray temperature_world, np.ndarray temperature_atmos, np.ndarray air_pressure, np.ndarray air_density, np.ndarray heat_capacity_earth, np.ndarray albedo, DTYPE_f insolation, np.ndarray lat, np.ndarray lon, np.ndarray heights, np.ndarray dz, np.int_t t, np.int_t dt, DTYPE_f day, DTYPE_f year, DTYPE_f axial_tilt): # <<<<<<<<<<<<<< @@ -4203,17 +5893,17 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_16); __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_18); __Pyx_XDECREF(__pyx_t_20); __Pyx_XDECREF(__pyx_t_21); __Pyx_XDECREF(__pyx_t_22); __Pyx_XDECREF(__pyx_t_23); __Pyx_XDECREF(__pyx_t_24); __Pyx_XDECREF(__pyx_t_25); + __Pyx_XDECREF(__pyx_t_26); __Pyx_AddTraceback("claude_top_level_library.radiation_calculation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4229,28 +5919,28 @@ static PyObject *__pyx_pf_24claude_top_level_library_2radiation_calculation(CYTH return __pyx_r; } -/* "claude_top_level_library.pyx":86 +/* "claude_top_level_library.pyx":108 * return temperature_world, temperature_atmos * - * def velocity_calculation(u,v,air_pressure,old_pressure,air_density,coriolis,gravity,dx,dy,dt): # <<<<<<<<<<<<<< + * def velocity_calculation(np.ndarray u,np.ndarray v,np.ndarray air_pressure,np.ndarray old_pressure,np.ndarray air_density,np.ndarray coriolis,DTYPE_f gravity,np.ndarray dx,DTYPE_f dy,DTYPE_f dt): # <<<<<<<<<<<<<< * # introduce temporary arrays to update velocity in the atmosphere - * u_temp = np.zeros_like(u) + * cdef np.ndarray u_temp = np.zeros_like(u) */ /* Python wrapper */ -static PyObject *__pyx_pw_24claude_top_level_library_5velocity_calculation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_24claude_top_level_library_5velocity_calculation = {"velocity_calculation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_top_level_library_5velocity_calculation, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_24claude_top_level_library_5velocity_calculation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_u = 0; - PyObject *__pyx_v_v = 0; - PyObject *__pyx_v_air_pressure = 0; - PyObject *__pyx_v_old_pressure = 0; - PyObject *__pyx_v_air_density = 0; - PyObject *__pyx_v_coriolis = 0; - PyObject *__pyx_v_gravity = 0; - PyObject *__pyx_v_dx = 0; - PyObject *__pyx_v_dy = 0; - PyObject *__pyx_v_dt = 0; +static PyObject *__pyx_pw_24claude_top_level_library_9velocity_calculation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_24claude_top_level_library_9velocity_calculation = {"velocity_calculation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_top_level_library_9velocity_calculation, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_24claude_top_level_library_9velocity_calculation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_u = 0; + PyArrayObject *__pyx_v_v = 0; + PyArrayObject *__pyx_v_air_pressure = 0; + PyArrayObject *__pyx_v_old_pressure = 0; + PyArrayObject *__pyx_v_air_density = 0; + PyArrayObject *__pyx_v_coriolis = 0; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_gravity; + PyArrayObject *__pyx_v_dx = 0; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dt; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4296,59 +5986,59 @@ static PyObject *__pyx_pw_24claude_top_level_library_5velocity_calculation(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 1); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 1); __PYX_ERR(0, 108, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_air_pressure)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 2); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 2); __PYX_ERR(0, 108, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_old_pressure)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 3); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 3); __PYX_ERR(0, 108, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_air_density)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 4); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 4); __PYX_ERR(0, 108, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coriolis)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 5); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 5); __PYX_ERR(0, 108, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 6); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 6); __PYX_ERR(0, 108, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 7); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 7); __PYX_ERR(0, 108, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 8); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 8); __PYX_ERR(0, 108, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dt)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 9); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, 9); __PYX_ERR(0, 108, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "velocity_calculation") < 0)) __PYX_ERR(0, 86, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "velocity_calculation") < 0)) __PYX_ERR(0, 108, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { goto __pyx_L5_argtuple_error; @@ -4364,81 +6054,101 @@ static PyObject *__pyx_pw_24claude_top_level_library_5velocity_calculation(PyObj values[8] = PyTuple_GET_ITEM(__pyx_args, 8); values[9] = PyTuple_GET_ITEM(__pyx_args, 9); } - __pyx_v_u = values[0]; - __pyx_v_v = values[1]; - __pyx_v_air_pressure = values[2]; - __pyx_v_old_pressure = values[3]; - __pyx_v_air_density = values[4]; - __pyx_v_coriolis = values[5]; - __pyx_v_gravity = values[6]; - __pyx_v_dx = values[7]; - __pyx_v_dy = values[8]; - __pyx_v_dt = values[9]; + __pyx_v_u = ((PyArrayObject *)values[0]); + __pyx_v_v = ((PyArrayObject *)values[1]); + __pyx_v_air_pressure = ((PyArrayObject *)values[2]); + __pyx_v_old_pressure = ((PyArrayObject *)values[3]); + __pyx_v_air_density = ((PyArrayObject *)values[4]); + __pyx_v_coriolis = ((PyArrayObject *)values[5]); + __pyx_v_gravity = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_gravity == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) + __pyx_v_dx = ((PyArrayObject *)values[7]); + __pyx_v_dy = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_dy == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) + __pyx_v_dt = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_dt == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 86, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("velocity_calculation", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 108, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("claude_top_level_library.velocity_calculation", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_24claude_top_level_library_4velocity_calculation(__pyx_self, __pyx_v_u, __pyx_v_v, __pyx_v_air_pressure, __pyx_v_old_pressure, __pyx_v_air_density, __pyx_v_coriolis, __pyx_v_gravity, __pyx_v_dx, __pyx_v_dy, __pyx_v_dt); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u), __pyx_ptype_5numpy_ndarray, 1, "u", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_air_pressure), __pyx_ptype_5numpy_ndarray, 1, "air_pressure", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old_pressure), __pyx_ptype_5numpy_ndarray, 1, "old_pressure", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_air_density), __pyx_ptype_5numpy_ndarray, 1, "air_density", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coriolis), __pyx_ptype_5numpy_ndarray, 1, "coriolis", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dx), __pyx_ptype_5numpy_ndarray, 1, "dx", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + __pyx_r = __pyx_pf_24claude_top_level_library_8velocity_calculation(__pyx_self, __pyx_v_u, __pyx_v_v, __pyx_v_air_pressure, __pyx_v_old_pressure, __pyx_v_air_density, __pyx_v_coriolis, __pyx_v_gravity, __pyx_v_dx, __pyx_v_dy, __pyx_v_dt); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_24claude_top_level_library_4velocity_calculation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_u, PyObject *__pyx_v_v, PyObject *__pyx_v_air_pressure, PyObject *__pyx_v_old_pressure, PyObject *__pyx_v_air_density, PyObject *__pyx_v_coriolis, PyObject *__pyx_v_gravity, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy, PyObject *__pyx_v_dt) { - PyObject *__pyx_v_u_temp = NULL; - PyObject *__pyx_v_v_temp = NULL; - PyObject *__pyx_v_w_temp = NULL; - PyObject *__pyx_v_nlat = NULL; - PyObject *__pyx_v_nlon = NULL; - PyObject *__pyx_v_nlevels = NULL; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_j = NULL; - PyObject *__pyx_v_k = NULL; - PyObject *__pyx_v_w = NULL; +static PyObject *__pyx_pf_24claude_top_level_library_8velocity_calculation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_u, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_air_pressure, PyArrayObject *__pyx_v_old_pressure, PyArrayObject *__pyx_v_air_density, PyArrayObject *__pyx_v_coriolis, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_gravity, PyArrayObject *__pyx_v_dx, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dy, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_dt) { + PyArrayObject *__pyx_v_u_temp = 0; + PyArrayObject *__pyx_v_v_temp = 0; + PyArrayObject *__pyx_v_w_temp = 0; + __pyx_t_5numpy_int_t __pyx_v_nlat; + __pyx_t_5numpy_int_t __pyx_v_nlon; + __pyx_t_5numpy_int_t __pyx_v_nlevels; + __pyx_t_5numpy_int_t __pyx_v_i; + __pyx_t_5numpy_int_t __pyx_v_j; + __pyx_t_5numpy_int_t __pyx_v_k; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_inv_density; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_inv_dt_grav; + PyArrayObject *__pyx_v_w = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_6 = NULL; int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - Py_ssize_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - Py_ssize_t __pyx_t_12; - PyObject *(*__pyx_t_13)(PyObject *); - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + __pyx_t_5numpy_int_t __pyx_t_11; + __pyx_t_5numpy_int_t __pyx_t_12; + __pyx_t_5numpy_int_t __pyx_t_13; + __pyx_t_5numpy_int_t __pyx_t_14; + __pyx_t_5numpy_int_t __pyx_t_15; + __pyx_t_5numpy_int_t __pyx_t_16; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; + PyObject *__pyx_t_25 = NULL; + PyObject *__pyx_t_26 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("velocity_calculation", 0); - __Pyx_INCREF(__pyx_v_u); - __Pyx_INCREF(__pyx_v_v); + __Pyx_INCREF((PyObject *)__pyx_v_u); + __Pyx_INCREF((PyObject *)__pyx_v_v); - /* "claude_top_level_library.pyx":88 - * def velocity_calculation(u,v,air_pressure,old_pressure,air_density,coriolis,gravity,dx,dy,dt): + /* "claude_top_level_library.pyx":110 + * def velocity_calculation(np.ndarray u,np.ndarray v,np.ndarray air_pressure,np.ndarray old_pressure,np.ndarray air_density,np.ndarray coriolis,DTYPE_f gravity,np.ndarray dx,DTYPE_f dy,DTYPE_f dt): * # introduce temporary arrays to update velocity in the atmosphere - * u_temp = np.zeros_like(u) # <<<<<<<<<<<<<< - * v_temp = np.zeros_like(v) - * w_temp = np.zeros_like(u) + * cdef np.ndarray u_temp = np.zeros_like(u) # <<<<<<<<<<<<<< + * cdef np.ndarray v_temp = np.zeros_like(v) + * cdef np.ndarray w_temp = np.zeros_like(u) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -4451,24 +6161,25 @@ static PyObject *__pyx_pf_24claude_top_level_library_4velocity_calculation(CYTHO __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_u) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_u); + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v_u)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_u)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_u_temp = __pyx_t_1; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_v_u_temp = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":89 + /* "claude_top_level_library.pyx":111 * # introduce temporary arrays to update velocity in the atmosphere - * u_temp = np.zeros_like(u) - * v_temp = np.zeros_like(v) # <<<<<<<<<<<<<< - * w_temp = np.zeros_like(u) + * cdef np.ndarray u_temp = np.zeros_like(u) + * cdef np.ndarray v_temp = np.zeros_like(v) # <<<<<<<<<<<<<< + * cdef np.ndarray w_temp = np.zeros_like(u) * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -4481,24 +6192,25 @@ static PyObject *__pyx_pf_24claude_top_level_library_4velocity_calculation(CYTHO __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_v) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_v); + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_v)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_v)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_v_temp = __pyx_t_1; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_v_v_temp = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":90 - * u_temp = np.zeros_like(u) - * v_temp = np.zeros_like(v) - * w_temp = np.zeros_like(u) # <<<<<<<<<<<<<< + /* "claude_top_level_library.pyx":112 + * cdef np.ndarray u_temp = np.zeros_like(u) + * cdef np.ndarray v_temp = np.zeros_like(v) + * cdef np.ndarray w_temp = np.zeros_like(u) # <<<<<<<<<<<<<< * - * nlat,nlon,nlevels = air_pressure.shape[:] + * cdef np.int_t nlat,nlon,nlevels,i,j,k */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -4511,343 +6223,412 @@ static PyObject *__pyx_pf_24claude_top_level_library_4velocity_calculation(CYTHO __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_u) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_u); + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v_u)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_u)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_w_temp = __pyx_t_1; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_v_w_temp = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":92 - * w_temp = np.zeros_like(u) + /* "claude_top_level_library.pyx":117 + * cdef DTYPE_f inv_density,inv_dt_grav * - * nlat,nlon,nlevels = air_pressure.shape[:] # <<<<<<<<<<<<<< + * nlat = air_pressure.shape[0] # <<<<<<<<<<<<<< + * nlon = air_pressure.shape[1] + * nlevels = air_pressure.shape[2] + */ + __pyx_v_nlat = (__pyx_v_air_pressure->dimensions[0]); + + /* "claude_top_level_library.pyx":118 + * + * nlat = air_pressure.shape[0] + * nlon = air_pressure.shape[1] # <<<<<<<<<<<<<< + * nlevels = air_pressure.shape[2] + * inv_dt_grav = 1/(dt*gravity) + */ + __pyx_v_nlon = (__pyx_v_air_pressure->dimensions[1]); + + /* "claude_top_level_library.pyx":119 + * nlat = air_pressure.shape[0] + * nlon = air_pressure.shape[1] + * nlevels = air_pressure.shape[2] # <<<<<<<<<<<<<< + * inv_dt_grav = 1/(dt*gravity) + * + */ + __pyx_v_nlevels = (__pyx_v_air_pressure->dimensions[2]); + + /* "claude_top_level_library.pyx":120 + * nlon = air_pressure.shape[1] + * nlevels = air_pressure.shape[2] + * inv_dt_grav = 1/(dt*gravity) # <<<<<<<<<<<<<< * * # calculate acceleration of atmosphere using primitive equations on beta-plane */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_air_pressure, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0, NULL, NULL, &__pyx_slice_, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 3)) { - if (size > 3) __Pyx_RaiseTooManyValuesError(3); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 92, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); - } else { - __pyx_t_1 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - __pyx_t_4 = PyList_GET_ITEM(sequence, 2); - } - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) __PYX_ERR(0, 92, __pyx_L1_error) - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 92, __pyx_L1_error) - __pyx_L4_unpacking_done:; + __pyx_t_4 = (__pyx_v_dt * __pyx_v_gravity); + if (unlikely(__pyx_t_4 == 0)) { + PyErr_SetString(PyExc_ZeroDivisionError, "float division"); + __PYX_ERR(0, 120, __pyx_L1_error) } - __pyx_v_nlat = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_v_nlon = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_v_nlevels = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_inv_dt_grav = (1.0 / __pyx_t_4); - /* "claude_top_level_library.pyx":95 + /* "claude_top_level_library.pyx":123 * * # calculate acceleration of atmosphere using primitive equations on beta-plane - * for i in np.arange(1,nlat-1): # <<<<<<<<<<<<<< + * for i in np.arange(3,nlat-3).tolist(): # <<<<<<<<<<<<<< * for j in range(nlon): * for k in range(nlevels): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arange); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_nlat, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = NULL; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arange); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_npy_long((__pyx_v_nlat - 3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = NULL; __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_1); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_int_1, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_int_3, __pyx_t_2}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_int_1, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_int_3, __pyx_t_2}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL; + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; } - __Pyx_INCREF(__pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_int_1); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_INCREF(__pyx_int_3); + __Pyx_GIVEREF(__pyx_int_3); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_int_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tolist); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 123, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 123, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 95, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 123, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_3 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { + __pyx_t_1 = __pyx_t_10(__pyx_t_5); + if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 95, __pyx_L1_error) + else __PYX_ERR(0, 123, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); } - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_11 = __Pyx_PyInt_As_npy_long(__pyx_t_1); if (unlikely((__pyx_t_11 == ((npy_long)-1)) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_11; - /* "claude_top_level_library.pyx":96 + /* "claude_top_level_library.pyx":124 * # calculate acceleration of atmosphere using primitive equations on beta-plane - * for i in np.arange(1,nlat-1): + * for i in np.arange(3,nlat-3).tolist(): * for j in range(nlon): # <<<<<<<<<<<<<< * for k in range(nlevels): - * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)/air_density[i,j,k] ) + * inv_density = 1/air_density[i,j,k] */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_nlon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 96, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 96, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 96, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_11(__pyx_t_5); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 96, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_11 = __pyx_v_nlon; + __pyx_t_12 = __pyx_t_11; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_j = __pyx_t_13; - /* "claude_top_level_library.pyx":97 - * for i in np.arange(1,nlat-1): + /* "claude_top_level_library.pyx":125 + * for i in np.arange(3,nlat-3).tolist(): * for j in range(nlon): * for k in range(nlevels): # <<<<<<<<<<<<<< - * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)/air_density[i,j,k] ) - * v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)/air_density[i,j,k] ) + * inv_density = 1/air_density[i,j,k] + * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)*inv_density ) */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_nlevels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_12 = 0; - __pyx_t_13 = NULL; - } else { - __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 97, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_13)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_13(__pyx_t_4); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 97, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_14 = __pyx_v_nlevels; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_k = __pyx_t_16; - /* "claude_top_level_library.pyx":98 + /* "claude_top_level_library.pyx":126 * for j in range(nlon): * for k in range(nlevels): - * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)/air_density[i,j,k] ) # <<<<<<<<<<<<<< - * v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)/air_density[i,j,k] ) - * w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])/(dt*air_density[i,j,k]*gravity) + * inv_density = 1/air_density[i,j,k] # <<<<<<<<<<<<<< + * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)*inv_density ) + * v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)*inv_density ) */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_k); - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_u_temp, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_v_k); - __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_v_u, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyNumber_Negative(__pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_low_level); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_air_density), __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_int_1, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_inv_density = __pyx_t_4; + + /* "claude_top_level_library.pyx":127 + * for k in range(nlevels): + * inv_density = 1/air_density[i,j,k] + * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)*inv_density ) # <<<<<<<<<<<<<< + * v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)*inv_density ) + * w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])*inv_density*inv_dt_grav + */ + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_8 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_u_temp), __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_dt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = NULL; + __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_17); + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_17 = 0; + __pyx_t_17 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_u), __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyNumber_Negative(__pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_low_level); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_nlon); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_19 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_20 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_21 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_22 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_22)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[7] = {__pyx_t_22, ((PyObject *)__pyx_v_u), ((PyObject *)__pyx_v_dx), __pyx_t_6, __pyx_t_19, __pyx_t_20, __pyx_t_21}; + __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[7] = {__pyx_t_22, ((PyObject *)__pyx_v_u), ((PyObject *)__pyx_v_dx), __pyx_t_6, __pyx_t_19, __pyx_t_20, __pyx_t_21}; + __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + } else + #endif + { + __pyx_t_23 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + if (__pyx_t_22) { + __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_22); __pyx_t_22 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_u)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_u)); + PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_7, ((PyObject *)__pyx_v_u)); + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_7, ((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_23, 2+__pyx_t_7, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_23, 3+__pyx_t_7, __pyx_t_19); + __Pyx_GIVEREF(__pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_23, 4+__pyx_t_7, __pyx_t_20); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_23, 5+__pyx_t_7, __pyx_t_21); + __pyx_t_6 = 0; + __pyx_t_19 = 0; + __pyx_t_20 = 0; + __pyx_t_21 = 0; + __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_23, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Multiply(__pyx_t_18, __pyx_t_17); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_18 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_23 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_23); + __pyx_t_17 = 0; + __pyx_t_18 = 0; + __pyx_t_23 = 0; + __pyx_t_23 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_21); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_low_level); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_18 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_20 = __Pyx_PyInt_From_npy_long(__pyx_v_nlat); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_19 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_22 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_24 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) { - __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17); - if (likely(__pyx_t_16)) { + __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_17); + if (likely(__pyx_t_24)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); - __Pyx_INCREF(__pyx_t_16); + __Pyx_INCREF(__pyx_t_24); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_17, function); __pyx_t_7 = 1; @@ -4855,764 +6636,806 @@ static PyObject *__pyx_pf_24claude_top_level_library_4velocity_calculation(CYTHO } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[7] = {__pyx_t_16, __pyx_v_u, __pyx_v_dx, __pyx_v_nlon, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_GOTREF(__pyx_t_15); + PyObject *__pyx_temp[7] = {__pyx_t_24, ((PyObject *)__pyx_v_u), __pyx_t_18, __pyx_t_20, __pyx_t_19, __pyx_t_6, __pyx_t_22}; + __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[7] = {__pyx_t_16, __pyx_v_u, __pyx_v_dx, __pyx_v_nlon, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_GOTREF(__pyx_t_15); - } else - #endif - { - __pyx_t_18 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - if (__pyx_t_16) { - __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_16); __pyx_t_16 = NULL; - } - __Pyx_INCREF(__pyx_v_u); - __Pyx_GIVEREF(__pyx_v_u); - PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_7, __pyx_v_u); - __Pyx_INCREF(__pyx_v_dx); - __Pyx_GIVEREF(__pyx_v_dx); - PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_7, __pyx_v_dx); - __Pyx_INCREF(__pyx_v_nlon); - __Pyx_GIVEREF(__pyx_v_nlon); - PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_7, __pyx_v_nlon); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_7, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_18, 4+__pyx_t_7, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_18, 5+__pyx_t_7, __pyx_v_k); - __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_18, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); + PyObject *__pyx_temp[7] = {__pyx_t_24, ((PyObject *)__pyx_v_u), __pyx_t_18, __pyx_t_20, __pyx_t_19, __pyx_t_6, __pyx_t_22}; + __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_GOTREF(__pyx_t_21); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + } else + #endif + { + __pyx_t_25 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + if (__pyx_t_24) { + __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_24); __pyx_t_24 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_u)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_u)); + PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_7, ((PyObject *)__pyx_v_u)); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_7, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_25, 2+__pyx_t_7, __pyx_t_20); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_25, 3+__pyx_t_7, __pyx_t_19); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_25, 4+__pyx_t_7, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_25, 5+__pyx_t_7, __pyx_t_22); + __pyx_t_18 = 0; + __pyx_t_20 = 0; + __pyx_t_19 = 0; + __pyx_t_6 = 0; + __pyx_t_22 = 0; + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_25, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; } __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = PyNumber_Multiply(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_17 = PyNumber_Multiply(__pyx_t_23, __pyx_t_21); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_k); - __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_v, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_low_level); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = PyNumber_Subtract(__pyx_t_2, __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coriolis), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_23 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_25 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_23); + __Pyx_GIVEREF(__pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_25); + __pyx_t_2 = 0; + __pyx_t_23 = 0; + __pyx_t_25 = 0; + __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_22); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_22 = PyNumber_Multiply(__pyx_t_17, __pyx_t_25); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = PyNumber_Add(__pyx_t_21, __pyx_t_22); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_low_level); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = __Pyx_PyInt_From_npy_long(__pyx_v_nlon); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_23 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_19 = NULL; __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) { - __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_16); - if (likely(__pyx_t_18)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); - __Pyx_INCREF(__pyx_t_18); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_17); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); + __Pyx_INCREF(__pyx_t_19); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_16, function); + __Pyx_DECREF_SET(__pyx_t_17, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_16)) { - PyObject *__pyx_temp[7] = {__pyx_t_18, __pyx_v_u, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_GOTREF(__pyx_t_15); + if (PyFunction_Check(__pyx_t_17)) { + PyObject *__pyx_temp[7] = {__pyx_t_19, ((PyObject *)__pyx_v_air_pressure), ((PyObject *)__pyx_v_dx), __pyx_t_21, __pyx_t_23, __pyx_t_2, __pyx_t_6}; + __pyx_t_22 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) { - PyObject *__pyx_temp[7] = {__pyx_t_18, __pyx_v_u, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_GOTREF(__pyx_t_15); + if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) { + PyObject *__pyx_temp[7] = {__pyx_t_19, ((PyObject *)__pyx_v_air_pressure), ((PyObject *)__pyx_v_dx), __pyx_t_21, __pyx_t_23, __pyx_t_2, __pyx_t_6}; + __pyx_t_22 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { - __pyx_t_19 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - if (__pyx_t_18) { - __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_18); __pyx_t_18 = NULL; + __pyx_t_20 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + if (__pyx_t_19) { + __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL; } - __Pyx_INCREF(__pyx_v_u); - __Pyx_GIVEREF(__pyx_v_u); - PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_7, __pyx_v_u); - __Pyx_INCREF(__pyx_v_dy); - __Pyx_GIVEREF(__pyx_v_dy); - PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_7, __pyx_v_dy); - __Pyx_INCREF(__pyx_v_nlat); - __Pyx_GIVEREF(__pyx_v_nlat); - PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_7, __pyx_v_nlat); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_19, 3+__pyx_t_7, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_19, 4+__pyx_t_7, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_19, 5+__pyx_t_7, __pyx_v_k); - __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_19, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_air_pressure)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_air_pressure)); + PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_7, ((PyObject *)__pyx_v_air_pressure)); + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_7, ((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_7, __pyx_t_21); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_7, __pyx_t_23); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_20, 4+__pyx_t_7, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_20, 5+__pyx_t_7, __pyx_t_6); + __pyx_t_21 = 0; + __pyx_t_23 = 0; + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_20, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; } - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyNumber_Multiply(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyNumber_Subtract(__pyx_t_17, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_coriolis, __pyx_v_i); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_17 = PyFloat_FromDouble(__pyx_v_inv_density); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_v_k); - __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_v, __pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_20 = PyNumber_Multiply(__pyx_t_22, __pyx_t_17); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = PyNumber_Multiply(__pyx_t_16, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_17 = PyNumber_Subtract(__pyx_t_25, __pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyNumber_Add(__pyx_t_15, __pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __pyx_t_20 = PyNumber_Multiply(__pyx_t_8, __pyx_t_17); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_low_level); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_16); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_16, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_16)) { - PyObject *__pyx_temp[7] = {__pyx_t_15, __pyx_v_air_pressure, __pyx_v_dx, __pyx_v_nlon, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_17); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) { - PyObject *__pyx_temp[7] = {__pyx_t_15, __pyx_v_air_pressure, __pyx_v_dx, __pyx_v_nlon, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_17); - } else - #endif - { - __pyx_t_19 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - if (__pyx_t_15) { - __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_15); __pyx_t_15 = NULL; - } - __Pyx_INCREF(__pyx_v_air_pressure); - __Pyx_GIVEREF(__pyx_v_air_pressure); - PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_7, __pyx_v_air_pressure); - __Pyx_INCREF(__pyx_v_dx); - __Pyx_GIVEREF(__pyx_v_dx); - PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_7, __pyx_v_dx); - __Pyx_INCREF(__pyx_v_nlon); - __Pyx_GIVEREF(__pyx_v_nlon); - PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_7, __pyx_v_nlon); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_19, 3+__pyx_t_7, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_19, 4+__pyx_t_7, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_19, 5+__pyx_t_7, __pyx_v_k); - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_19, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - } - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_v_k); - __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_v_air_density, __pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = __Pyx_PyNumber_Divide(__pyx_t_17, __pyx_t_19); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = PyNumber_Subtract(__pyx_t_14, __pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyNumber_Multiply(__pyx_v_dt, __pyx_t_19); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_u_temp, __pyx_t_3, __pyx_t_19) < 0)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_17 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_u_temp), __pyx_t_1, __pyx_t_17) < 0)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":99 - * for k in range(nlevels): - * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)/air_density[i,j,k] ) - * v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)/air_density[i,j,k] ) # <<<<<<<<<<<<<< - * w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])/(dt*air_density[i,j,k]*gravity) + /* "claude_top_level_library.pyx":128 + * inv_density = 1/air_density[i,j,k] + * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)*inv_density ) + * v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)*inv_density ) # <<<<<<<<<<<<<< + * w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])*inv_density*inv_dt_grav * */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_20 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_k); - __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_v_v_temp, __pyx_t_3); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_20); + __pyx_t_1 = 0; + __pyx_t_17 = 0; + __pyx_t_20 = 0; + __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v_temp), __pyx_t_3); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_17 = PyFloat_FromDouble(__pyx_v_dt); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_25 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_25); + __pyx_t_1 = 0; + __pyx_t_8 = 0; + __pyx_t_25 = 0; + __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_u), __pyx_t_22); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_22 = PyNumber_Negative(__pyx_t_25); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_low_level); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_npy_long(__pyx_v_nlon); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_23 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_21 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_21)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_21); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[7] = {__pyx_t_21, ((PyObject *)__pyx_v_v), ((PyObject *)__pyx_v_dx), __pyx_t_8, __pyx_t_6, __pyx_t_2, __pyx_t_23}; + __pyx_t_25 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[7] = {__pyx_t_21, ((PyObject *)__pyx_v_v), ((PyObject *)__pyx_v_dx), __pyx_t_8, __pyx_t_6, __pyx_t_2, __pyx_t_23}; + __pyx_t_25 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + } else + #endif + { + __pyx_t_19 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + if (__pyx_t_21) { + __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_21); __pyx_t_21 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_v)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_v)); + PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_7, ((PyObject *)__pyx_v_v)); + __Pyx_INCREF(((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dx)); + PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_7, ((PyObject *)__pyx_v_dx)); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_7, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_19, 3+__pyx_t_7, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_19, 4+__pyx_t_7, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_19, 5+__pyx_t_7, __pyx_t_23); + __pyx_t_8 = 0; + __pyx_t_6 = 0; + __pyx_t_2 = 0; + __pyx_t_23 = 0; + __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_19, NULL); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_t_22, __pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_22 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_19 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); - __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_v_k); - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_u, __pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_low_level); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_scalar_gradient_x); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = NULL; + __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __Pyx_GIVEREF(__pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_25); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_22); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_19); + __pyx_t_25 = 0; + __pyx_t_22 = 0; + __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_23); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_low_level); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_22, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_22 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_nlat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_21 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_18 = NULL; __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_17); - if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17); - __Pyx_INCREF(__pyx_t_14); + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_25))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_25); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25); + __Pyx_INCREF(__pyx_t_18); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_17, function); + __Pyx_DECREF_SET(__pyx_t_25, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[7] = {__pyx_t_14, __pyx_v_v, __pyx_v_dx, __pyx_v_nlon, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_GOTREF(__pyx_t_1); + if (PyFunction_Check(__pyx_t_25)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_v), __pyx_t_22, __pyx_t_2, __pyx_t_6, __pyx_t_8, __pyx_t_21}; + __pyx_t_23 = __Pyx_PyFunction_FastCall(__pyx_t_25, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) { - PyObject *__pyx_temp[7] = {__pyx_t_14, __pyx_v_v, __pyx_v_dx, __pyx_v_nlon, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyFastCFunction_Check(__pyx_t_25)) { + PyObject *__pyx_temp[7] = {__pyx_t_18, ((PyObject *)__pyx_v_v), __pyx_t_22, __pyx_t_2, __pyx_t_6, __pyx_t_8, __pyx_t_21}; + __pyx_t_23 = __Pyx_PyCFunction_FastCall(__pyx_t_25, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; } else #endif { - __pyx_t_15 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - if (__pyx_t_14) { - __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); __pyx_t_14 = NULL; + __pyx_t_24 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + if (__pyx_t_18) { + __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_18); __pyx_t_18 = NULL; } - __Pyx_INCREF(__pyx_v_v); - __Pyx_GIVEREF(__pyx_v_v); - PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_7, __pyx_v_v); - __Pyx_INCREF(__pyx_v_dx); - __Pyx_GIVEREF(__pyx_v_dx); - PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_7, __pyx_v_dx); - __Pyx_INCREF(__pyx_v_nlon); - __Pyx_GIVEREF(__pyx_v_nlon); - PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_7, __pyx_v_nlon); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_7, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_15, 4+__pyx_t_7, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_15, 5+__pyx_t_7, __pyx_v_k); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_v)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_v)); + PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_7, ((PyObject *)__pyx_v_v)); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_7, __pyx_t_22); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_24, 2+__pyx_t_7, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_24, 3+__pyx_t_7, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_24, 4+__pyx_t_7, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_24, 5+__pyx_t_7, __pyx_t_21); + __pyx_t_22 = 0; + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_8 = 0; + __pyx_t_21 = 0; + __pyx_t_23 = __Pyx_PyObject_Call(__pyx_t_25, __pyx_t_24, NULL); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; } - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = PyNumber_Multiply(__pyx_t_16, __pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_k); - __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_v, __pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_low_level); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_14)) { - PyObject *__pyx_temp[7] = {__pyx_t_15, __pyx_v_v, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) { - PyObject *__pyx_temp[7] = {__pyx_t_15, __pyx_v_v, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_18 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - if (__pyx_t_15) { - __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_15); __pyx_t_15 = NULL; - } - __Pyx_INCREF(__pyx_v_v); - __Pyx_GIVEREF(__pyx_v_v); - PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_7, __pyx_v_v); - __Pyx_INCREF(__pyx_v_dy); - __Pyx_GIVEREF(__pyx_v_dy); - PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_7, __pyx_v_dy); - __Pyx_INCREF(__pyx_v_nlat); - __Pyx_GIVEREF(__pyx_v_nlat); - PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_7, __pyx_v_nlat); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_7, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_18, 4+__pyx_t_7, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_18, 5+__pyx_t_7, __pyx_v_k); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyNumber_Multiply(__pyx_t_16, __pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_17, __pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_coriolis, __pyx_v_i); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_v_k); - __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_u, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = PyNumber_Multiply(__pyx_t_14, __pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyNumber_Subtract(__pyx_t_1, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_low_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_14)) { - PyObject *__pyx_temp[7] = {__pyx_t_1, __pyx_v_air_pressure, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_17); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) { - PyObject *__pyx_temp[7] = {__pyx_t_1, __pyx_v_air_pressure, __pyx_v_dy, __pyx_v_nlat, __pyx_v_i, __pyx_v_j, __pyx_v_k}; - __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_17); - } else - #endif - { - __pyx_t_18 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1); __pyx_t_1 = NULL; - } - __Pyx_INCREF(__pyx_v_air_pressure); - __Pyx_GIVEREF(__pyx_v_air_pressure); - PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_7, __pyx_v_air_pressure); - __Pyx_INCREF(__pyx_v_dy); - __Pyx_GIVEREF(__pyx_v_dy); - PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_7, __pyx_v_dy); - __Pyx_INCREF(__pyx_v_nlat); - __Pyx_GIVEREF(__pyx_v_nlat); - PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_7, __pyx_v_nlat); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_7, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_18, 4+__pyx_t_7, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_18, 5+__pyx_t_7, __pyx_v_k); - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_18, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_v_k); - __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_v_air_density, __pyx_t_14); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_t_17, __pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyNumber_Subtract(__pyx_t_16, __pyx_t_14); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyNumber_Multiply(__pyx_v_dt, __pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_19, __pyx_t_14); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = PyNumber_Multiply(__pyx_t_19, __pyx_t_23); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_v_temp, __pyx_t_3, __pyx_t_18) < 0)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_23 = PyNumber_Subtract(__pyx_t_1, __pyx_t_25); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = __Pyx_GetItemInt(((PyObject *)__pyx_v_coriolis), __pyx_v_i, __pyx_t_5numpy_int_t, 1, __Pyx_PyInt_From_npy_long, 0, 1, 1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_19 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_24 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_19); + __Pyx_GIVEREF(__pyx_t_24); + PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_24); + __pyx_t_1 = 0; + __pyx_t_19 = 0; + __pyx_t_24 = 0; + __pyx_t_24 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_u), __pyx_t_21); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = PyNumber_Multiply(__pyx_t_25, __pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __pyx_t_24 = PyNumber_Subtract(__pyx_t_23, __pyx_t_21); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_low_level); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_23, __pyx_n_s_scalar_gradient_y); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_23 = PyFloat_FromDouble(__pyx_v_dy); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_19 = __Pyx_PyInt_From_npy_long(__pyx_v_nlat); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_25))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_25); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_25, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_25)) { + PyObject *__pyx_temp[7] = {__pyx_t_2, ((PyObject *)__pyx_v_air_pressure), __pyx_t_23, __pyx_t_19, __pyx_t_1, __pyx_t_8, __pyx_t_6}; + __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_25, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_25)) { + PyObject *__pyx_temp[7] = {__pyx_t_2, ((PyObject *)__pyx_v_air_pressure), __pyx_t_23, __pyx_t_19, __pyx_t_1, __pyx_t_8, __pyx_t_6}; + __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_25, __pyx_temp+1-__pyx_t_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_22 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + if (__pyx_t_2) { + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_2); __pyx_t_2 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_air_pressure)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_air_pressure)); + PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_7, ((PyObject *)__pyx_v_air_pressure)); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_7, __pyx_t_23); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_22, 2+__pyx_t_7, __pyx_t_19); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_22, 3+__pyx_t_7, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_22, 4+__pyx_t_7, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_22, 5+__pyx_t_7, __pyx_t_6); + __pyx_t_23 = 0; + __pyx_t_19 = 0; + __pyx_t_1 = 0; + __pyx_t_8 = 0; + __pyx_t_6 = 0; + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_25, __pyx_t_22, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + } + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = PyFloat_FromDouble(__pyx_v_inv_density); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_22 = PyNumber_Multiply(__pyx_t_21, __pyx_t_25); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = PyNumber_Subtract(__pyx_t_24, __pyx_t_22); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __pyx_t_22 = PyNumber_Multiply(__pyx_t_17, __pyx_t_25); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = PyNumber_InPlaceAdd(__pyx_t_20, __pyx_t_22); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v_temp), __pyx_t_3, __pyx_t_25) < 0)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "claude_top_level_library.pyx":100 - * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)/air_density[i,j,k] ) - * v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)/air_density[i,j,k] ) - * w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])/(dt*air_density[i,j,k]*gravity) # <<<<<<<<<<<<<< + /* "claude_top_level_library.pyx":129 + * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)*inv_density ) + * v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)*inv_density ) + * w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])*inv_density*inv_dt_grav # <<<<<<<<<<<<<< * * u += u_temp */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_k); - __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_v_w_temp, __pyx_t_3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_v_k); - __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_v_air_pressure, __pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_v_k); - __pyx_t_16 = __Pyx_PyObject_GetItem(__pyx_v_old_pressure, __pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyNumber_Subtract(__pyx_t_19, __pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyNumber_Negative(__pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_INCREF(__pyx_v_i); - __Pyx_GIVEREF(__pyx_v_i); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_i); - __Pyx_INCREF(__pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_j); - __Pyx_INCREF(__pyx_v_k); - __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_v_k); - __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_v_air_density, __pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyNumber_Multiply(__pyx_v_dt, __pyx_t_19); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = PyNumber_Multiply(__pyx_t_14, __pyx_v_gravity); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_t_16, __pyx_t_19); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = PyNumber_InPlaceAdd(__pyx_t_18, __pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_w_temp, __pyx_t_3, __pyx_t_19) < 0)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "claude_top_level_library.pyx":97 - * for i in np.arange(1,nlat-1): - * for j in range(nlon): - * for k in range(nlevels): # <<<<<<<<<<<<<< - * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)/air_density[i,j,k] ) - * v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)/air_density[i,j,k] ) - */ + __pyx_t_25 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_22 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_20 = PyTuple_New(3); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_25); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_t_22); + __pyx_t_3 = 0; + __pyx_t_25 = 0; + __pyx_t_22 = 0; + __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_w_temp), __pyx_t_20); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_25 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_17 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __Pyx_GIVEREF(__pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_25); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_t_17); + __pyx_t_25 = 0; + __pyx_t_3 = 0; + __pyx_t_17 = 0; + __pyx_t_17 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_air_pressure), __pyx_t_24); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __pyx_t_24 = __Pyx_PyInt_From_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_24); + __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_25 = __Pyx_PyInt_From_npy_long(__pyx_v_k); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_GIVEREF(__pyx_t_24); + PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_24); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_25); + __pyx_t_24 = 0; + __pyx_t_3 = 0; + __pyx_t_25 = 0; + __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_old_pressure), __pyx_t_21); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = PyNumber_Subtract(__pyx_t_17, __pyx_t_25); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = PyNumber_Negative(__pyx_t_21); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = PyFloat_FromDouble(__pyx_v_inv_density); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_17 = PyNumber_Multiply(__pyx_t_25, __pyx_t_21); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = PyFloat_FromDouble(__pyx_v_inv_dt_grav); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_25 = PyNumber_Multiply(__pyx_t_17, __pyx_t_21); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_21 = PyNumber_InPlaceAdd(__pyx_t_22, __pyx_t_25); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_w_temp), __pyx_t_20, __pyx_t_21) < 0)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "claude_top_level_library.pyx":96 - * # calculate acceleration of atmosphere using primitive equations on beta-plane - * for i in np.arange(1,nlat-1): - * for j in range(nlon): # <<<<<<<<<<<<<< - * for k in range(nlevels): - * u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)/air_density[i,j,k] ) - */ } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "claude_top_level_library.pyx":95 + /* "claude_top_level_library.pyx":123 * * # calculate acceleration of atmosphere using primitive equations on beta-plane - * for i in np.arange(1,nlat-1): # <<<<<<<<<<<<<< + * for i in np.arange(3,nlat-3).tolist(): # <<<<<<<<<<<<<< * for j in range(nlon): * for k in range(nlevels): */ } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "claude_top_level_library.pyx":102 - * w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])/(dt*air_density[i,j,k]*gravity) + /* "claude_top_level_library.pyx":131 + * w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])*inv_density*inv_dt_grav * * u += u_temp # <<<<<<<<<<<<<< * v += v_temp * w = w_temp */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_u, __pyx_v_u_temp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_u, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_5 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_u), ((PyObject *)__pyx_v_u_temp)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_u, ((PyArrayObject *)__pyx_t_5)); + __pyx_t_5 = 0; - /* "claude_top_level_library.pyx":103 + /* "claude_top_level_library.pyx":132 * * u += u_temp * v += v_temp # <<<<<<<<<<<<<< * w = w_temp * */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_v, __pyx_v_v_temp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_5 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_v), ((PyObject *)__pyx_v_v_temp)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_v, ((PyArrayObject *)__pyx_t_5)); + __pyx_t_5 = 0; - /* "claude_top_level_library.pyx":104 + /* "claude_top_level_library.pyx":133 * u += u_temp * v += v_temp * w = w_temp # <<<<<<<<<<<<<< * * # approximate friction */ - __Pyx_INCREF(__pyx_v_w_temp); + __Pyx_INCREF(((PyObject *)__pyx_v_w_temp)); __pyx_v_w = __pyx_v_w_temp; - /* "claude_top_level_library.pyx":107 + /* "claude_top_level_library.pyx":136 * * # approximate friction * u *= 0.95 # <<<<<<<<<<<<<< * v *= 0.95 * */ - __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_u, __pyx_float_0_95); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_u, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_5 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_u), __pyx_float_0_95); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_u, ((PyArrayObject *)__pyx_t_5)); + __pyx_t_5 = 0; - /* "claude_top_level_library.pyx":108 + /* "claude_top_level_library.pyx":137 * # approximate friction * u *= 0.95 * v *= 0.95 # <<<<<<<<<<<<<< * - * return u,v,w + * u[:,:,0] *= 0.8 */ - __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_v, __pyx_float_0_95); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_5 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_v), __pyx_float_0_95); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_v, ((PyArrayObject *)__pyx_t_5)); + __pyx_t_5 = 0; - /* "claude_top_level_library.pyx":110 + /* "claude_top_level_library.pyx":139 * v *= 0.95 * + * u[:,:,0] *= 0.8 # <<<<<<<<<<<<<< + * v[:,:,0] *= 0.8 + * + */ + __Pyx_INCREF(__pyx_tuple__3); + __pyx_t_26 = __pyx_tuple__3; + __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_u), __pyx_t_26); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_5, __pyx_float_0_8); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_u), __pyx_t_26, __pyx_t_20) < 0)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + + /* "claude_top_level_library.pyx":140 + * + * u[:,:,0] *= 0.8 + * v[:,:,0] *= 0.8 # <<<<<<<<<<<<<< + * + * return u,v,w + */ + __Pyx_INCREF(__pyx_tuple__3); + __pyx_t_26 = __pyx_tuple__3; + __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_26); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_20); + __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_t_20, __pyx_float_0_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_26, __pyx_t_5) < 0)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + + /* "claude_top_level_library.pyx":142 + * v[:,:,0] *= 0.8 + * * return u,v,w # <<<<<<<<<<<<<< + * + * def smoothing_3D(np.ndarray a,DTYPE_f smooth_parameter): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_u); - __Pyx_GIVEREF(__pyx_v_u); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_u); - __Pyx_INCREF(__pyx_v_v); - __Pyx_GIVEREF(__pyx_v_v); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_v); - __Pyx_INCREF(__pyx_v_w); - __Pyx_GIVEREF(__pyx_v_w); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_w); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_u)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_u)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_u)); + __Pyx_INCREF(((PyObject *)__pyx_v_v)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_v)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_v)); + __Pyx_INCREF(((PyObject *)__pyx_v_w)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); + PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_w)); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; - /* "claude_top_level_library.pyx":86 + /* "claude_top_level_library.pyx":108 * return temperature_world, temperature_atmos * - * def velocity_calculation(u,v,air_pressure,old_pressure,air_density,coriolis,gravity,dx,dy,dt): # <<<<<<<<<<<<<< + * def velocity_calculation(np.ndarray u,np.ndarray v,np.ndarray air_pressure,np.ndarray old_pressure,np.ndarray air_density,np.ndarray coriolis,DTYPE_f gravity,np.ndarray dx,DTYPE_f dy,DTYPE_f dt): # <<<<<<<<<<<<<< * # introduce temporary arrays to update velocity in the atmosphere - * u_temp = np.zeros_like(u) + * cdef np.ndarray u_temp = np.zeros_like(u) */ /* function exit code */ @@ -5620,29 +7443,338 @@ static PyObject *__pyx_pf_24claude_top_level_library_4velocity_calculation(CYTHO __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_17); __Pyx_XDECREF(__pyx_t_18); __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_20); + __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_23); + __Pyx_XDECREF(__pyx_t_24); + __Pyx_XDECREF(__pyx_t_25); + __Pyx_XDECREF(__pyx_t_26); __Pyx_AddTraceback("claude_top_level_library.velocity_calculation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_u_temp); - __Pyx_XDECREF(__pyx_v_v_temp); - __Pyx_XDECREF(__pyx_v_w_temp); + __Pyx_XDECREF((PyObject *)__pyx_v_u_temp); + __Pyx_XDECREF((PyObject *)__pyx_v_v_temp); + __Pyx_XDECREF((PyObject *)__pyx_v_w_temp); + __Pyx_XDECREF((PyObject *)__pyx_v_w); + __Pyx_XDECREF((PyObject *)__pyx_v_u); + __Pyx_XDECREF((PyObject *)__pyx_v_v); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "claude_top_level_library.pyx":144 + * return u,v,w + * + * def smoothing_3D(np.ndarray a,DTYPE_f smooth_parameter): # <<<<<<<<<<<<<< + * nlat = a.shape[0] + * nlon = a.shape[1] + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_24claude_top_level_library_11smoothing_3D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_24claude_top_level_library_11smoothing_3D = {"smoothing_3D", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_24claude_top_level_library_11smoothing_3D, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_24claude_top_level_library_11smoothing_3D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_a = 0; + __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_smooth_parameter; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("smoothing_3D (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_smooth_parameter,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smooth_parameter)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("smoothing_3D", 1, 2, 2, 1); __PYX_ERR(0, 144, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "smoothing_3D") < 0)) __PYX_ERR(0, 144, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_a = ((PyArrayObject *)values[0]); + __pyx_v_smooth_parameter = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_smooth_parameter == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L3_error) + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("smoothing_3D", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 144, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("claude_top_level_library.smoothing_3D", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_r = __pyx_pf_24claude_top_level_library_10smoothing_3D(__pyx_self, __pyx_v_a, __pyx_v_smooth_parameter); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_24claude_top_level_library_10smoothing_3D(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, __pyx_t_24claude_top_level_library_DTYPE_f __pyx_v_smooth_parameter) { + PyObject *__pyx_v_nlat = NULL; + PyObject *__pyx_v_nlon = NULL; + CYTHON_UNUSED npy_intp __pyx_v_nlevels; + PyObject *__pyx_v_test = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("smoothing_3D", 0); + + /* "claude_top_level_library.pyx":145 + * + * def smoothing_3D(np.ndarray a,DTYPE_f smooth_parameter): + * nlat = a.shape[0] # <<<<<<<<<<<<<< + * nlon = a.shape[1] + * nlevels = a.shape[2] + */ + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_a->dimensions[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_nlat = __pyx_t_1; + __pyx_t_1 = 0; + + /* "claude_top_level_library.pyx":146 + * def smoothing_3D(np.ndarray a,DTYPE_f smooth_parameter): + * nlat = a.shape[0] + * nlon = a.shape[1] # <<<<<<<<<<<<<< + * nlevels = a.shape[2] + * smooth_parameter *= 0.5 + */ + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_a->dimensions[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_nlon = __pyx_t_1; + __pyx_t_1 = 0; + + /* "claude_top_level_library.pyx":147 + * nlat = a.shape[0] + * nlon = a.shape[1] + * nlevels = a.shape[2] # <<<<<<<<<<<<<< + * smooth_parameter *= 0.5 + * test = np.fft.fftn(a) + */ + __pyx_v_nlevels = (__pyx_v_a->dimensions[2]); + + /* "claude_top_level_library.pyx":148 + * nlon = a.shape[1] + * nlevels = a.shape[2] + * smooth_parameter *= 0.5 # <<<<<<<<<<<<<< + * test = np.fft.fftn(a) + * test[int(nlat*smooth_parameter):int(nlat*(1-smooth_parameter)),:,:] = 0 + */ + __pyx_v_smooth_parameter = (__pyx_v_smooth_parameter * 0.5); + + /* "claude_top_level_library.pyx":149 + * nlevels = a.shape[2] + * smooth_parameter *= 0.5 + * test = np.fft.fftn(a) # <<<<<<<<<<<<<< + * test[int(nlat*smooth_parameter):int(nlat*(1-smooth_parameter)),:,:] = 0 + * test[:,int(nlon*smooth_parameter):int(nlon*(1-smooth_parameter)),:] = 0 + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fft); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fftn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_a)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_a)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_test = __pyx_t_1; + __pyx_t_1 = 0; + + /* "claude_top_level_library.pyx":150 + * smooth_parameter *= 0.5 + * test = np.fft.fftn(a) + * test[int(nlat*smooth_parameter):int(nlat*(1-smooth_parameter)),:,:] = 0 # <<<<<<<<<<<<<< + * test[:,int(nlon*smooth_parameter):int(nlon*(1-smooth_parameter)),:] = 0 + * # test[:,:int(nlevels*smooth_parameter):int(nlevels*(1-smooth_parameter))] = 0 + */ + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_smooth_parameter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Multiply(__pyx_v_nlat, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyFloat_FromDouble((1.0 - __pyx_v_smooth_parameter)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_v_nlat, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PySlice_New(__pyx_t_1, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_INCREF(__pyx_slice_); + __Pyx_GIVEREF(__pyx_slice_); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice_); + __Pyx_INCREF(__pyx_slice_); + __Pyx_GIVEREF(__pyx_slice_); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_slice_); + __pyx_t_3 = 0; + if (unlikely(PyObject_SetItem(__pyx_v_test, __pyx_t_2, __pyx_int_0) < 0)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "claude_top_level_library.pyx":151 + * test = np.fft.fftn(a) + * test[int(nlat*smooth_parameter):int(nlat*(1-smooth_parameter)),:,:] = 0 + * test[:,int(nlon*smooth_parameter):int(nlon*(1-smooth_parameter)),:] = 0 # <<<<<<<<<<<<<< + * # test[:,:int(nlevels*smooth_parameter):int(nlevels*(1-smooth_parameter))] = 0 + * return np.fft.ifftn(test).real + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_smooth_parameter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_v_nlon, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyFloat_FromDouble((1.0 - __pyx_v_smooth_parameter)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_Multiply(__pyx_v_nlon, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PySlice_New(__pyx_t_2, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_slice_); + __Pyx_GIVEREF(__pyx_slice_); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice_); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_INCREF(__pyx_slice_); + __Pyx_GIVEREF(__pyx_slice_); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_slice_); + __pyx_t_1 = 0; + if (unlikely(PyObject_SetItem(__pyx_v_test, __pyx_t_3, __pyx_int_0) < 0)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "claude_top_level_library.pyx":153 + * test[:,int(nlon*smooth_parameter):int(nlon*(1-smooth_parameter)),:] = 0 + * # test[:,:int(nlevels*smooth_parameter):int(nlevels*(1-smooth_parameter))] = 0 + * return np.fft.ifftn(test).real # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ifftn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __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 && likely(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_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_test) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_test); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "claude_top_level_library.pyx":144 + * return u,v,w + * + * def smoothing_3D(np.ndarray a,DTYPE_f smooth_parameter): # <<<<<<<<<<<<<< + * nlat = a.shape[0] + * nlon = a.shape[1] + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("claude_top_level_library.smoothing_3D", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XDECREF(__pyx_v_nlat); __Pyx_XDECREF(__pyx_v_nlon); - __Pyx_XDECREF(__pyx_v_nlevels); - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_j); - __Pyx_XDECREF(__pyx_v_k); - __Pyx_XDECREF(__pyx_v_w); - __Pyx_XDECREF(__pyx_v_u); - __Pyx_XDECREF(__pyx_v_v); + __Pyx_XDECREF(__pyx_v_test); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -5768,7 +7900,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5824,7 +7956,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * info.buf = PyArray_DATA(self) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6082,7 +8214,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6980,7 +9112,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -7048,7 +9180,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 859, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -7157,7 +9289,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 879, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -7788,7 +9920,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { * * cdef inline int import_umath() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1037, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1037, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -7920,7 +10052,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { * * cdef inline int import_ufunc() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1043, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1043, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -8049,7 +10181,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1049, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1049, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -8156,6 +10288,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 0, 0, 1, 1}, {&__pyx_n_s_au, __pyx_k_au, sizeof(__pyx_k_au), 0, 0, 1, 1}, {&__pyx_n_s_av, __pyx_k_av, sizeof(__pyx_k_av), 0, 0, 1, 1}, + {&__pyx_n_s_aw, __pyx_k_aw, sizeof(__pyx_k_aw), 0, 0, 1, 1}, {&__pyx_n_s_axial_tilt, __pyx_k_axial_tilt, sizeof(__pyx_k_axial_tilt), 0, 0, 1, 1}, {&__pyx_n_s_claude_low_level_library, __pyx_k_claude_low_level_library, sizeof(__pyx_k_claude_low_level_library), 0, 0, 1, 1}, {&__pyx_n_s_claude_top_level_library, __pyx_k_claude_top_level_library, sizeof(__pyx_k_claude_top_level_library), 0, 0, 1, 1}, @@ -8170,15 +10303,24 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1}, {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1}, {&__pyx_n_s_dz, __pyx_k_dz, sizeof(__pyx_k_dz), 0, 0, 1, 1}, + {&__pyx_n_s_fft, __pyx_k_fft, sizeof(__pyx_k_fft), 0, 0, 1, 1}, + {&__pyx_n_s_fftn, __pyx_k_fftn, sizeof(__pyx_k_fftn), 0, 0, 1, 1}, {&__pyx_n_s_fl, __pyx_k_fl, sizeof(__pyx_k_fl), 0, 0, 1, 1}, {&__pyx_n_s_gravity, __pyx_k_gravity, sizeof(__pyx_k_gravity), 0, 0, 1, 1}, {&__pyx_n_s_heat_capacity_earth, __pyx_k_heat_capacity_earth, sizeof(__pyx_k_heat_capacity_earth), 0, 0, 1, 1}, {&__pyx_n_s_heights, __pyx_k_heights, sizeof(__pyx_k_heights), 0, 0, 1, 1}, {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_ifftn, __pyx_k_ifftn, sizeof(__pyx_k_ifftn), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_insolation, __pyx_k_insolation, sizeof(__pyx_k_insolation), 0, 0, 1, 1}, + {&__pyx_n_s_inv_density, __pyx_k_inv_density, sizeof(__pyx_k_inv_density), 0, 0, 1, 1}, + {&__pyx_n_s_inv_dt_grav, __pyx_k_inv_dt_grav, sizeof(__pyx_k_inv_dt_grav), 0, 0, 1, 1}, + {&__pyx_n_s_inv_dx, __pyx_k_inv_dx, sizeof(__pyx_k_inv_dx), 0, 0, 1, 1}, + {&__pyx_n_s_inv_dy, __pyx_k_inv_dy, sizeof(__pyx_k_inv_dy), 0, 0, 1, 1}, {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, + {&__pyx_n_s_laplacian_2D, __pyx_k_laplacian_2D, sizeof(__pyx_k_laplacian_2D), 0, 0, 1, 1}, + {&__pyx_n_s_laplacian_3D, __pyx_k_laplacian_3D, sizeof(__pyx_k_laplacian_3D), 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}, {&__pyx_n_s_low_level, __pyx_k_low_level, sizeof(__pyx_k_low_level), 0, 0, 1, 1}, @@ -8199,17 +10341,25 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_pressure_profile, __pyx_k_pressure_profile, sizeof(__pyx_k_pressure_profile), 0, 0, 1, 1}, {&__pyx_n_s_radiation_calculation, __pyx_k_radiation_calculation, sizeof(__pyx_k_radiation_calculation), 0, 0, 1, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 0, 1, 1}, {&__pyx_n_s_scalar_gradient_x, __pyx_k_scalar_gradient_x, sizeof(__pyx_k_scalar_gradient_x), 0, 0, 1, 1}, + {&__pyx_n_s_scalar_gradient_x_2D, __pyx_k_scalar_gradient_x_2D, sizeof(__pyx_k_scalar_gradient_x_2D), 0, 0, 1, 1}, {&__pyx_n_s_scalar_gradient_y, __pyx_k_scalar_gradient_y, sizeof(__pyx_k_scalar_gradient_y), 0, 0, 1, 1}, + {&__pyx_n_s_scalar_gradient_y_2D, __pyx_k_scalar_gradient_y_2D, sizeof(__pyx_k_scalar_gradient_y_2D), 0, 0, 1, 1}, + {&__pyx_n_s_scalar_gradient_z, __pyx_k_scalar_gradient_z, sizeof(__pyx_k_scalar_gradient_z), 0, 0, 1, 1}, {&__pyx_n_s_scalar_gradient_z_1D, __pyx_k_scalar_gradient_z_1D, sizeof(__pyx_k_scalar_gradient_z_1D), 0, 0, 1, 1}, - {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_smooth_parameter, __pyx_k_smooth_parameter, sizeof(__pyx_k_smooth_parameter), 0, 0, 1, 1}, + {&__pyx_n_s_smoothing_3D, __pyx_k_smoothing_3D, sizeof(__pyx_k_smoothing_3D), 0, 0, 1, 1}, {&__pyx_n_s_solar, __pyx_k_solar, sizeof(__pyx_k_solar), 0, 0, 1, 1}, + {&__pyx_n_s_sun_lat, __pyx_k_sun_lat, sizeof(__pyx_k_sun_lat), 0, 0, 1, 1}, {&__pyx_n_s_surface_optical_depth, __pyx_k_surface_optical_depth, sizeof(__pyx_k_surface_optical_depth), 0, 0, 1, 1}, {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, {&__pyx_n_s_temperature_atmos, __pyx_k_temperature_atmos, sizeof(__pyx_k_temperature_atmos), 0, 0, 1, 1}, {&__pyx_n_s_temperature_world, __pyx_k_temperature_world, sizeof(__pyx_k_temperature_world), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_test_2, __pyx_k_test_2, sizeof(__pyx_k_test_2), 0, 0, 1, 1}, {&__pyx_n_s_thermal_radiation, __pyx_k_thermal_radiation, sizeof(__pyx_k_thermal_radiation), 0, 0, 1, 1}, + {&__pyx_n_s_tolist, __pyx_k_tolist, sizeof(__pyx_k_tolist), 0, 0, 1, 1}, {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1}, {&__pyx_n_s_u_temp, __pyx_k_u_temp, sizeof(__pyx_k_u_temp), 0, 0, 1, 1}, {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, @@ -8225,7 +10375,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error) __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 855, __pyx_L1_error) __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1037, __pyx_L1_error) @@ -8238,28 +10388,39 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "claude_top_level_library.pyx":28 - * def divergence_with_scalar(a,u,v,dx,dy): - * output = np.zeros_like(a) - * nlat, nlon, nlevels = output.shape[:] # <<<<<<<<<<<<<< - * - * au = a*u + /* "claude_top_level_library.pyx":79 + * for j in range(nlon): + * # calculate optical depth + * pressure_profile = air_pressure[i,j,:] # <<<<<<<<<<<<<< + * density_profile = air_density[i,j,:] + * optical_depth = sun_lat*(fl*(pressure_profile/pressure_profile[0]) + (1-fl)*(pressure_profile/pressure_profile[0])**4) */ - __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice_); __Pyx_GIVEREF(__pyx_slice_); - /* "claude_top_level_library.pyx":68 + /* "claude_top_level_library.pyx":90 * # calculate downward longwave flux, bc is zero at TOA (in model) * downward_radiation[-1] = 0 * for k in np.arange(0,nlevels-1)[::-1]: # <<<<<<<<<<<<<< * downward_radiation[k] = (downward_radiation[k+1] - low_level.thermal_radiation(temperature_atmos[i,j,k])*(optical_depth[k+1]-optical_depth[k]))/(1 + optical_depth[k] - optical_depth[k+1]) * */ - __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__2); __Pyx_GIVEREF(__pyx_slice__2); + /* "claude_top_level_library.pyx":139 + * v *= 0.95 + * + * u[:,:,0] *= 0.8 # <<<<<<<<<<<<<< + * v[:,:,0] *= 0.8 + * + */ + __pyx_tuple__3 = PyTuple_Pack(3, __pyx_slice_, __pyx_slice_, __pyx_int_0); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); + /* "../../../AppData/Local/Programs/Python/Python38/lib/site-packages/Cython/Includes/numpy/__init__.pxd":272 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): @@ -8267,9 +10428,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 272, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); /* "../../../AppData/Local/Programs/Python/Python38/lib/site-packages/Cython/Includes/numpy/__init__.pxd":276 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) @@ -8278,9 +10439,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * info.buf = PyArray_DATA(self) */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); /* "../../../AppData/Local/Programs/Python/Python38/lib/site-packages/Cython/Includes/numpy/__init__.pxd":306 * if ((descr.byteorder == c'>' and little_endian) or @@ -8289,9 +10450,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); /* "../../../AppData/Local/Programs/Python/Python38/lib/site-packages/Cython/Includes/numpy/__init__.pxd":855 * @@ -8300,9 +10461,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 855, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 855, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); /* "../../../AppData/Local/Programs/Python/Python38/lib/site-packages/Cython/Includes/numpy/__init__.pxd":879 * t = child.type_num @@ -8311,9 +10472,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 879, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 879, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); /* "../../../AppData/Local/Programs/Python/Python38/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1037 * _import_array() @@ -8322,9 +10483,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * cdef inline int import_umath() except -1: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1037, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1037, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); /* "../../../AppData/Local/Programs/Python/Python38/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1043 * _import_umath() @@ -8333,45 +10494,81 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1043, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - - /* "claude_top_level_library.pyx":26 - * - * # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field - * def divergence_with_scalar(a,u,v,dx,dy): # <<<<<<<<<<<<<< - * output = np.zeros_like(a) - * nlat, nlon, nlevels = output.shape[:] - */ - __pyx_tuple__10 = PyTuple_Pack(14, __pyx_n_s_a, __pyx_n_s_u, __pyx_n_s_v, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_output, __pyx_n_s_nlat, __pyx_n_s_nlon, __pyx_n_s_nlevels, __pyx_n_s_au, __pyx_n_s_av, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 26, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 1043, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_top_level_library_pyx, __pyx_n_s_divergence_with_scalar, 26, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 26, __pyx_L1_error) - /* "claude_top_level_library.pyx":39 + /* "claude_top_level_library.pyx":11 + * + * # laplacian of scalar field a + * def laplacian_2D(np.ndarray a,np.ndarray dx,DTYPE_f dy): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.int_t nlat,nlon,i,j + */ + __pyx_tuple__11 = PyTuple_Pack(10, __pyx_n_s_a, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_output, __pyx_n_s_nlat, __pyx_n_s_nlon, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_inv_dx, __pyx_n_s_inv_dy); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_top_level_library_pyx, __pyx_n_s_laplacian_2D, 11, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 11, __pyx_L1_error) + + /* "claude_top_level_library.pyx":24 + * return output + * + * def laplacian_3D(np.ndarray a,np.ndarray dx,DTYPE_f dy,np.ndarray dz): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.int_t nlat,nlon,nlevels,i,j,k + */ + __pyx_tuple__13 = PyTuple_Pack(13, __pyx_n_s_a, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_output, __pyx_n_s_nlat, __pyx_n_s_nlon, __pyx_n_s_nlevels, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_inv_dx, __pyx_n_s_inv_dy); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_top_level_library_pyx, __pyx_n_s_laplacian_3D, 24, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 24, __pyx_L1_error) + + /* "claude_top_level_library.pyx":40 + * + * # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field + * def divergence_with_scalar(np.ndarray a,np.ndarray u,np.ndarray v,np.ndarray w,np.ndarray dx,DTYPE_f dy,np.ndarray dz): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.ndarray au, av, aw + */ + __pyx_tuple__15 = PyTuple_Pack(17, __pyx_n_s_a, __pyx_n_s_u, __pyx_n_s_v, __pyx_n_s_w, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_output, __pyx_n_s_au, __pyx_n_s_av, __pyx_n_s_aw, __pyx_n_s_nlat, __pyx_n_s_nlon, __pyx_n_s_nlevels, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(7, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_top_level_library_pyx, __pyx_n_s_divergence_with_scalar, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 40, __pyx_L1_error) + + /* "claude_top_level_library.pyx":59 * return output * * def radiation_calculation(np.ndarray temperature_world, np.ndarray temperature_atmos, np.ndarray air_pressure, np.ndarray air_density, np.ndarray heat_capacity_earth, np.ndarray albedo, DTYPE_f insolation, np.ndarray lat, np.ndarray lon, np.ndarray heights, np.ndarray dz, np.int_t t, np.int_t dt, DTYPE_f day, DTYPE_f year, DTYPE_f axial_tilt): # <<<<<<<<<<<<<< * # calculate change in temperature of ground and atmosphere due to radiative imbalance * cdef np.int_t nlat,nlon,nlevels,i,j */ - __pyx_tuple__12 = PyTuple_Pack(29, __pyx_n_s_temperature_world, __pyx_n_s_temperature_atmos, __pyx_n_s_air_pressure, __pyx_n_s_air_density, __pyx_n_s_heat_capacity_earth, __pyx_n_s_albedo, __pyx_n_s_insolation, __pyx_n_s_lat, __pyx_n_s_lon, __pyx_n_s_heights, __pyx_n_s_dz, __pyx_n_s_t, __pyx_n_s_dt, __pyx_n_s_day, __pyx_n_s_year, __pyx_n_s_axial_tilt, __pyx_n_s_nlat, __pyx_n_s_nlon, __pyx_n_s_nlevels, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_fl, __pyx_n_s_upward_radiation, __pyx_n_s_downward_radiation, __pyx_n_s_optical_depth, __pyx_n_s_Q, __pyx_n_s_pressure_profile, __pyx_n_s_density_profile, __pyx_n_s_k); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(16, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_top_level_library_pyx, __pyx_n_s_radiation_calculation, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(30, __pyx_n_s_temperature_world, __pyx_n_s_temperature_atmos, __pyx_n_s_air_pressure, __pyx_n_s_air_density, __pyx_n_s_heat_capacity_earth, __pyx_n_s_albedo, __pyx_n_s_insolation, __pyx_n_s_lat, __pyx_n_s_lon, __pyx_n_s_heights, __pyx_n_s_dz, __pyx_n_s_t, __pyx_n_s_dt, __pyx_n_s_day, __pyx_n_s_year, __pyx_n_s_axial_tilt, __pyx_n_s_nlat, __pyx_n_s_nlon, __pyx_n_s_nlevels, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_fl, __pyx_n_s_upward_radiation, __pyx_n_s_downward_radiation, __pyx_n_s_optical_depth, __pyx_n_s_Q, __pyx_n_s_pressure_profile, __pyx_n_s_density_profile, __pyx_n_s_sun_lat, __pyx_n_s_k); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(16, 0, 30, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_top_level_library_pyx, __pyx_n_s_radiation_calculation, 59, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 59, __pyx_L1_error) - /* "claude_top_level_library.pyx":86 + /* "claude_top_level_library.pyx":108 * return temperature_world, temperature_atmos * - * def velocity_calculation(u,v,air_pressure,old_pressure,air_density,coriolis,gravity,dx,dy,dt): # <<<<<<<<<<<<<< + * def velocity_calculation(np.ndarray u,np.ndarray v,np.ndarray air_pressure,np.ndarray old_pressure,np.ndarray air_density,np.ndarray coriolis,DTYPE_f gravity,np.ndarray dx,DTYPE_f dy,DTYPE_f dt): # <<<<<<<<<<<<<< * # introduce temporary arrays to update velocity in the atmosphere - * u_temp = np.zeros_like(u) + * cdef np.ndarray u_temp = np.zeros_like(u) */ - __pyx_tuple__14 = PyTuple_Pack(20, __pyx_n_s_u, __pyx_n_s_v, __pyx_n_s_air_pressure, __pyx_n_s_old_pressure, __pyx_n_s_air_density, __pyx_n_s_coriolis, __pyx_n_s_gravity, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dt, __pyx_n_s_u_temp, __pyx_n_s_v_temp, __pyx_n_s_w_temp, __pyx_n_s_nlat, __pyx_n_s_nlon, __pyx_n_s_nlevels, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_w); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(10, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_top_level_library_pyx, __pyx_n_s_velocity_calculation, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(22, __pyx_n_s_u, __pyx_n_s_v, __pyx_n_s_air_pressure, __pyx_n_s_old_pressure, __pyx_n_s_air_density, __pyx_n_s_coriolis, __pyx_n_s_gravity, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dt, __pyx_n_s_u_temp, __pyx_n_s_v_temp, __pyx_n_s_w_temp, __pyx_n_s_nlat, __pyx_n_s_nlon, __pyx_n_s_nlevels, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_inv_density, __pyx_n_s_inv_dt_grav, __pyx_n_s_w); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(10, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_top_level_library_pyx, __pyx_n_s_velocity_calculation, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 108, __pyx_L1_error) + + /* "claude_top_level_library.pyx":144 + * return u,v,w + * + * def smoothing_3D(np.ndarray a,DTYPE_f smooth_parameter): # <<<<<<<<<<<<<< + * nlat = a.shape[0] + * nlon = a.shape[1] + */ + __pyx_tuple__21 = PyTuple_Pack(6, __pyx_n_s_a, __pyx_n_s_smooth_parameter, __pyx_n_s_nlat, __pyx_n_s_nlon, __pyx_n_s_nlevels, __pyx_n_s_test); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_claude_top_level_library_pyx, __pyx_n_s_smoothing_3D, 144, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -8381,12 +10578,15 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_float_0_8 = PyFloat_FromDouble(0.8); if (unlikely(!__pyx_float_0_8)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_float_1E3 = PyFloat_FromDouble(1E3); if (unlikely(!__pyx_float_1E3)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_float_0_05 = PyFloat_FromDouble(0.05); if (unlikely(!__pyx_float_0_05)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_float_0_95 = PyFloat_FromDouble(0.95); if (unlikely(!__pyx_float_0_95)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_float_20E3 = PyFloat_FromDouble(20E3); if (unlikely(!__pyx_float_20E3)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_900 = PyInt_FromLong(900); if (unlikely(!__pyx_int_900)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -8719,40 +10919,76 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":26 + /* "claude_top_level_library.pyx":11 * - * # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field - * def divergence_with_scalar(a,u,v,dx,dy): # <<<<<<<<<<<<<< - * output = np.zeros_like(a) - * nlat, nlon, nlevels = output.shape[:] + * # laplacian of scalar field a + * def laplacian_2D(np.ndarray a,np.ndarray dx,DTYPE_f dy): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.int_t nlat,nlon,i,j */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_top_level_library_1divergence_with_scalar, NULL, __pyx_n_s_claude_top_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_top_level_library_1laplacian_2D, NULL, __pyx_n_s_claude_top_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_divergence_with_scalar, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_laplacian_2D, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":39 + /* "claude_top_level_library.pyx":24 + * return output + * + * def laplacian_3D(np.ndarray a,np.ndarray dx,DTYPE_f dy,np.ndarray dz): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.int_t nlat,nlon,nlevels,i,j,k + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_top_level_library_3laplacian_3D, NULL, __pyx_n_s_claude_top_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_laplacian_3D, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "claude_top_level_library.pyx":40 + * + * # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field + * def divergence_with_scalar(np.ndarray a,np.ndarray u,np.ndarray v,np.ndarray w,np.ndarray dx,DTYPE_f dy,np.ndarray dz): # <<<<<<<<<<<<<< + * cdef np.ndarray output = np.zeros_like(a) + * cdef np.ndarray au, av, aw + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_top_level_library_5divergence_with_scalar, NULL, __pyx_n_s_claude_top_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_divergence_with_scalar, __pyx_t_1) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "claude_top_level_library.pyx":59 * return output * * def radiation_calculation(np.ndarray temperature_world, np.ndarray temperature_atmos, np.ndarray air_pressure, np.ndarray air_density, np.ndarray heat_capacity_earth, np.ndarray albedo, DTYPE_f insolation, np.ndarray lat, np.ndarray lon, np.ndarray heights, np.ndarray dz, np.int_t t, np.int_t dt, DTYPE_f day, DTYPE_f year, DTYPE_f axial_tilt): # <<<<<<<<<<<<<< * # calculate change in temperature of ground and atmosphere due to radiative imbalance * cdef np.int_t nlat,nlon,nlevels,i,j */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_top_level_library_3radiation_calculation, NULL, __pyx_n_s_claude_top_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_top_level_library_7radiation_calculation, NULL, __pyx_n_s_claude_top_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_radiation_calculation, __pyx_t_1) < 0) __PYX_ERR(0, 39, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_radiation_calculation, __pyx_t_1) < 0) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "claude_top_level_library.pyx":86 + /* "claude_top_level_library.pyx":108 * return temperature_world, temperature_atmos * - * def velocity_calculation(u,v,air_pressure,old_pressure,air_density,coriolis,gravity,dx,dy,dt): # <<<<<<<<<<<<<< + * def velocity_calculation(np.ndarray u,np.ndarray v,np.ndarray air_pressure,np.ndarray old_pressure,np.ndarray air_density,np.ndarray coriolis,DTYPE_f gravity,np.ndarray dx,DTYPE_f dy,DTYPE_f dt): # <<<<<<<<<<<<<< * # introduce temporary arrays to update velocity in the atmosphere - * u_temp = np.zeros_like(u) + * cdef np.ndarray u_temp = np.zeros_like(u) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_top_level_library_5velocity_calculation, NULL, __pyx_n_s_claude_top_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_top_level_library_9velocity_calculation, NULL, __pyx_n_s_claude_top_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_velocity_calculation, __pyx_t_1) < 0) __PYX_ERR(0, 86, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_velocity_calculation, __pyx_t_1) < 0) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "claude_top_level_library.pyx":144 + * return u,v,w + * + * def smoothing_3D(np.ndarray a,DTYPE_f smooth_parameter): # <<<<<<<<<<<<<< + * nlat = a.shape[0] + * nlon = a.shape[1] + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_24claude_top_level_library_11smoothing_3D, NULL, __pyx_n_s_claude_top_level_library); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_smoothing_3D, __pyx_t_1) < 0) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "claude_top_level_library.pyx":1 @@ -8762,7 +10998,7 @@ if (!__Pyx_RefNanny) { */ __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "../../../AppData/Local/Programs/Python/Python38/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1045 @@ -8985,6 +11221,27 @@ bad: return -1; } +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { @@ -9297,184 +11554,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec } #endif -/* SliceObject */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_USE_TYPE_SLOTS - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - goto bad; - PyErr_Clear(); - } - } - return ms->sq_slice(obj, cstart, cstop); - } -#endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) -#endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_USE_TYPE_SLOTS - result = mp->mp_subscript(obj, py_slice); -#else - result = PyObject_GetItem(obj, py_slice); -#endif - if (!_py_slice) { - Py_DECREF(py_slice); - } - return result; - } - PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); -bad: - return NULL; -} - -/* RaiseTooManyValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* IterFinish */ -static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } - } - return 0; -#endif -} - -/* UnpackItemEndCheck */ -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; -} - -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - /* ExtTypeTest */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { @@ -10303,6 +12382,28 @@ static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, CYTHON_U } #endif +/* PyObjectCallNoArg */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); + } +#endif +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) +#else + if (likely(PyCFunction_Check(func))) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + /* PyErrFetchRestore */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { @@ -10510,6 +12611,19 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { } #endif +/* RaiseTooManyValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + /* RaiseNoneIterError */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); @@ -11087,6 +13201,37 @@ bad: } } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) { + const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(Py_intptr_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(Py_intptr_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), + little, !is_unsigned); + } +} + /* Declarations */ #if CYTHON_CCOMPLEX #ifdef __cplusplus diff --git a/claude_top_level_library.cp38-win_amd64.pyd b/claude_top_level_library.cp38-win_amd64.pyd index 51ed77a..e985b46 100644 Binary files a/claude_top_level_library.cp38-win_amd64.pyd and b/claude_top_level_library.cp38-win_amd64.pyd differ diff --git a/claude_top_level_library.pyx b/claude_top_level_library.pyx index 69b3c21..e886cfc 100644 --- a/claude_top_level_library.pyx +++ b/claude_top_level_library.pyx @@ -8,32 +8,52 @@ cimport cython ctypedef np.float64_t DTYPE_f # laplacian of scalar field a -# def laplacian(a): -# output = np.zeros_like(a) -# if output.ndim == 2: -# for i in np.arange(1,nlat-1): -# for j in range(nlon): -# output[i,j] = (scalar_gradient_x_2D(a,i,(j+1)%nlon) - scalar_gradient_x_2D(a,i,(j-1)%nlon))/dx[i] + (scalar_gradient_y_2D(a,i+1,j) - scalar_gradient_y_2D(a,i-1,j))/dy -# return output -# if output.ndim == 3: -# for i in np.arange(1,nlat-1): -# for j in range(nlon): -# for k in range(nlevels-1): -# output[i,j,k] = (scalar_gradient_x(a,i,(j+1)%nlon,k) - scalar_gradient_x(a,i,(j-1)%nlon,k))/dx[i] + (scalar_gradient_y(a,i+1,j,k) - scalar_gradient_y(a,i-1,j,k))/dy + (scalar_gradient_z(a,i,j,k+1)-scalar_gradient_z(a,i,j,k-1))/(2*dz[k]) -# return output +def laplacian_2D(np.ndarray a,np.ndarray dx,DTYPE_f dy): + cdef np.ndarray output = np.zeros_like(a) + cdef np.int_t nlat,nlon,i,j + cdef DTYPE_f inv_dx, inv_dy + nlat = a.shape[0] + nlon = a.shape[1] + inv_dy = 1/dy + for i in np.arange(1,nlat-1): + inv_dx = dx[i] + for j in range(nlon): + output[i,j] = (low_level.scalar_gradient_x_2D(a,dx,nlon,i,j) - low_level.scalar_gradient_x_2D(a,dx,nlon,i,j))*inv_dx + (low_level.scalar_gradient_y_2D(a,dy,nlat,i+1,j) - low_level.scalar_gradient_y_2D(a,dy,nlat,i-1,j))*inv_dy + return output + +def laplacian_3D(np.ndarray a,np.ndarray dx,DTYPE_f dy,np.ndarray dz): + cdef np.ndarray output = np.zeros_like(a) + cdef np.int_t nlat,nlon,nlevels,i,j,k + cdef DTYPE_f inv_dx, inv_dy + nlat = a.shape[0] + nlon = a.shape[1] + nlevels = a.shape[2] + inv_dy = 1/dy + for i in np.arange(1,nlat-1): + inv_dx = 1/dx[i] + for j in range(nlon): + for k in range(nlevels-1): + output[i,j,k] = (low_level.scalar_gradient_x(a,dx,nlon,i,j,k) - low_level.scalar_gradient_x(a,dx,nlon,i,j,k))*inv_dx + (low_level.scalar_gradient_y(a,dy,nlat,i+1,j,k) - low_level.scalar_gradient_y(a,dy,nlat,i-1,j,k))*inv_dy + (low_level.scalar_gradient_z(a,dz,i,j,k+1)-low_level.scalar_gradient_z(a,dz,i,j,k-1))/(2*dz[k]) + return output # divergence of (a*u) where a is a scalar field and u is the atmospheric velocity field -def divergence_with_scalar(a,u,v,dx,dy): - output = np.zeros_like(a) - nlat, nlon, nlevels = output.shape[:] +def divergence_with_scalar(np.ndarray a,np.ndarray u,np.ndarray v,np.ndarray w,np.ndarray dx,DTYPE_f dy,np.ndarray dz): + cdef np.ndarray output = np.zeros_like(a) + cdef np.ndarray au, av, aw + cdef np.int_t nlat, nlon, nlevels, i, j, k + + nlat = output.shape[0] + nlon = output.shape[1] + nlevels = output.shape[2] au = a*u av = a*v + aw = a*w for i in range(nlat): for j in range(nlon): for k in range(nlevels): - output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) #+ 0.1*scalar_gradient_z(a*w,i,j,k) + output[i,j,k] = low_level.scalar_gradient_x(au,dx,nlon,i,j,k) + low_level.scalar_gradient_y(av,dy,nlat,i,j,k) + 0.05*low_level.scalar_gradient_z(aw,dz,i,j,k) return output def radiation_calculation(np.ndarray temperature_world, np.ndarray temperature_atmos, np.ndarray air_pressure, np.ndarray air_density, np.ndarray heat_capacity_earth, np.ndarray albedo, DTYPE_f insolation, np.ndarray lat, np.ndarray lon, np.ndarray heights, np.ndarray dz, np.int_t t, np.int_t dt, DTYPE_f day, DTYPE_f year, DTYPE_f axial_tilt): @@ -41,6 +61,7 @@ def radiation_calculation(np.ndarray temperature_world, np.ndarray temperature_a cdef np.int_t nlat,nlon,nlevels,i,j cdef DTYPE_f fl = 0.1 cdef np.ndarray upward_radiation,downward_radiation,optical_depth,Q, pressure_profile, density_profile + cdef DTYPE_f sun_lat nlat = temperature_atmos.shape[0] nlon = temperature_atmos.shape[1] @@ -52,11 +73,12 @@ def radiation_calculation(np.ndarray temperature_world, np.ndarray temperature_a Q = np.zeros(nlevels) for i in range(nlat): + sun_lat = low_level.surface_optical_depth(lat[i]) for j in range(nlon): # calculate optical depth pressure_profile = air_pressure[i,j,:] density_profile = air_density[i,j,:] - optical_depth = low_level.surface_optical_depth(lat[i])*(fl*(pressure_profile/pressure_profile[0]) + (1-fl)*(pressure_profile/pressure_profile[0])**4) + optical_depth = sun_lat*(fl*(pressure_profile/pressure_profile[0]) + (1-fl)*(pressure_profile/pressure_profile[0])**4) # calculate upward longwave flux, bc is thermal radiation at surface upward_radiation[0] = low_level.thermal_radiation(temperature_world[i,j]) @@ -83,21 +105,28 @@ def radiation_calculation(np.ndarray temperature_world, np.ndarray temperature_a return temperature_world, temperature_atmos -def velocity_calculation(u,v,air_pressure,old_pressure,air_density,coriolis,gravity,dx,dy,dt): +def velocity_calculation(np.ndarray u,np.ndarray v,np.ndarray air_pressure,np.ndarray old_pressure,np.ndarray air_density,np.ndarray coriolis,DTYPE_f gravity,np.ndarray dx,DTYPE_f dy,DTYPE_f dt): # introduce temporary arrays to update velocity in the atmosphere - u_temp = np.zeros_like(u) - v_temp = np.zeros_like(v) - w_temp = np.zeros_like(u) + cdef np.ndarray u_temp = np.zeros_like(u) + cdef np.ndarray v_temp = np.zeros_like(v) + cdef np.ndarray w_temp = np.zeros_like(u) - nlat,nlon,nlevels = air_pressure.shape[:] + cdef np.int_t nlat,nlon,nlevels,i,j,k + cdef DTYPE_f inv_density,inv_dt_grav + + nlat = air_pressure.shape[0] + nlon = air_pressure.shape[1] + nlevels = air_pressure.shape[2] + inv_dt_grav = 1/(dt*gravity) # calculate acceleration of atmosphere using primitive equations on beta-plane - for i in np.arange(1,nlat-1): + for i in np.arange(3,nlat-3).tolist(): for j in range(nlon): for k in range(nlevels): - u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)/air_density[i,j,k] ) - v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)/air_density[i,j,k] ) - w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])/(dt*air_density[i,j,k]*gravity) + inv_density = 1/air_density[i,j,k] + u_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(u,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(u,dy,nlat,i,j,k) + coriolis[i]*v[i,j,k] - low_level.scalar_gradient_x(air_pressure,dx,nlon,i,j,k)*inv_density ) + v_temp[i,j,k] += dt*( -u[i,j,k]*low_level.scalar_gradient_x(v,dx,nlon,i,j,k) - v[i,j,k]*low_level.scalar_gradient_y(v,dy,nlat,i,j,k) - coriolis[i]*u[i,j,k] - low_level.scalar_gradient_y(air_pressure,dy,nlat,i,j,k)*inv_density ) + w_temp[i,j,k] += -(air_pressure[i,j,k]-old_pressure[i,j,k])*inv_density*inv_dt_grav u += u_temp v += v_temp @@ -107,4 +136,18 @@ def velocity_calculation(u,v,air_pressure,old_pressure,air_density,coriolis,grav u *= 0.95 v *= 0.95 - return u,v,w \ No newline at end of file + u[:,:,0] *= 0.8 + v[:,:,0] *= 0.8 + + return u,v,w + +def smoothing_3D(np.ndarray a,DTYPE_f smooth_parameter): + nlat = a.shape[0] + nlon = a.shape[1] + nlevels = a.shape[2] + smooth_parameter *= 0.5 + test = np.fft.fftn(a) + test[int(nlat*smooth_parameter):int(nlat*(1-smooth_parameter)),:,:] = 0 + test[:,int(nlon*smooth_parameter):int(nlon*(1-smooth_parameter)),:] = 0 + # test[:,:int(nlevels*smooth_parameter):int(nlevels*(1-smooth_parameter))] = 0 + return np.fft.ifftn(test).real diff --git a/save_file.p b/save_file.p index 154276e..14766cb 100644 Binary files a/save_file.p and b/save_file.p differ diff --git a/toy_model.py b/toy_model.py index c3f4e32..5eb11ac 100644 --- a/toy_model.py +++ b/toy_model.py @@ -12,30 +12,34 @@ import claude_top_level_library as top_level ######## CONTROL ######## day = 60*60*24 # define length of day (used for calculating Coriolis as well) (s) -resolution = 3 # how many degrees between latitude and longitude gridpoints -nlevels = 10 # how many vertical layers in the atmosphere -top = 50E3 # top of atmosphere (m) +resolution = 5 # how many degrees between latitude and longitude gridpoints +nlevels = 20 # how many vertical layers in the atmosphere +top = 40E3 # top of atmosphere (m) planet_radius = 6.4E6 # define the planet's radius (m) insolation = 1370 # TOA radiation from star (W m^-2) gravity = 9.81 # define surface gravity for planet (m s^-2) -axial_tilt = -23.5 # tilt of rotational axis w.r.t. solar plane +axial_tilt = -23.5/2 # tilt of rotational axis w.r.t. solar plane year = 365*day # length of year (s) dt_spinup = 60*137 -dt_main = 60*9 -spinup_length = 5*day +dt_main = 60*7 +spinup_length = 3*day ### advection = True # if you want to include advection set this to be True -advection_boundary = 8 # how many gridpoints away from poles to apply advection +advection_boundary = 3 # how many gridpoints away from poles to apply advection +smoothing_parameter_t = 0.9 +smoothing_parameter_u = 0.8 +smoothing_parameter_v = 0.8 +smoothing_parameter_w = 0.3 save = True # save current state to file? load = True # load initial state from file? plot = False # display plots of output? -level_plots = True # display plots of output on vertical levels? -nplots = 5 # how many levels you want to see plots of (evenly distributed through column) +level_plots = False # display plots of output on vertical levels? +nplots = 3 # how many levels you want to see plots of (evenly distributed through column) ########################### @@ -98,7 +102,6 @@ for i in range(nlat): specific_gas = 287 thermal_diffusivity_roc = 1.5E-6 -sigma = 5.67E-8 air_pressure = air_density*specific_gas*temperature_atmos @@ -121,17 +124,34 @@ dz[-1] = dz[-2] #################### SHOW TIME #################### +# INITIATE TIME +t = 0 + +if load: + # load in previous save file + temperature_atmos,temperature_world,u,v,w,t,air_pressure,air_density,albedo = pickle.load(open("save_file.p","rb")) + if plot: # set up plot f, ax = plt.subplots(2,figsize=(9,9)) f.canvas.set_window_title('CLAuDE') - ax[0].contourf(lon_plot, lat_plot, temperature_world, cmap='seismic') - ax[1].contourf(lon_plot, lat_plot, temperature_atmos[:,:,0], cmap='seismic') + test = ax[0].contourf(lon_plot, lat_plot, temperature_world, cmap='seismic') + ax[0].streamplot(lon_plot, lat_plot, u[:,:,0], v[:,:,0], color='white',density=1) + ax[1].contourf(heights_plot, lat_z_plot, np.transpose(np.mean(temperature_atmos,axis=1)), cmap='seismic',levels=15) + ax[1].contour(heights_plot,lat_z_plot, np.transpose(np.mean(u,axis=1)), colors='white',levels=20,linewidths=1,alpha=0.8) + ax[1].streamplot(heights_plot, lat_z_plot, np.transpose(np.mean(v,axis=1)),np.transpose(np.mean(10*w,axis=1)),color='black',density=0.75) plt.subplots_adjust(left=0.1, right=0.75) ax[0].set_title('Ground temperature') + ax[0].set_xlim(lon.min(),lon.max()) ax[1].set_title('Atmosphere temperature') + ax[1].set_xlim(lat.min(),lat.max()) + ax[1].set_ylim(heights.min(),heights.max()) cbar_ax = f.add_axes([0.85, 0.15, 0.05, 0.7]) + f.colorbar(test, cax=cbar_ax) + cbar_ax.set_title('Temperature (K)') + f.suptitle( 'Time ' + str(round(t/day,2)) + ' days' ) + # allow for live updating as calculations take place if level_plots: @@ -150,13 +170,7 @@ if plot: plt.ion() plt.show() - -# INITIATE TIME -t = 0 - -if load: - # load in previous save file - temperature_atmos,temperature_world,u,v,w,t,air_density,albedo = pickle.load(open("save_file.p","rb")) + plt.pause(2) while True: @@ -170,15 +184,14 @@ while True: velocity = True # print current time in simulation to command line - print("+++ t = " + str(round(t/day,2)) + " days +++", end='\r') + print("+++ t = " + str(round(t/day,2)) + " days +++") print('T: ',round(temperature_world.max()-273.15,1),' - ',round(temperature_world.min()-273.15,1),' C') print('U: ',round(u.max(),2),' - ',round(u.min(),2),' V: ',round(v.max(),2),' - ',round(v.min(),2),' W: ',round(w.max(),2),' - ',round(w.min(),2)) - # print(profile(air_density)) - # print(profile(air_pressure)/100) - before_radiation = time.time() + # before_radiation = time.time() temperature_world, temperature_atmos = top_level.radiation_calculation(temperature_world, temperature_atmos, air_pressure, air_density, heat_capacity_earth, albedo, insolation, lat, lon, heights, dz, t, dt, day, year, axial_tilt) - time_taken = float(round(time.time() - before_radiation,3)) + temperature_atmos = top_level.smoothing_3D(temperature_atmos,smoothing_parameter_t) + # time_taken = float(round(time.time() - before_radiation,3)) # print('Radiation: ',str(time_taken),'s') # update air pressure @@ -189,31 +202,49 @@ while True: before_velocity = time.time() u,v,w = top_level.velocity_calculation(u,v,air_pressure,old_pressure,air_density,coriolis,gravity,dx,dy,dt) - time_taken = float(round(time.time() - before_velocity,3)) + u = top_level.smoothing_3D(u,smoothing_parameter_u) + # v = top_level.smoothing_3D(v,smoothing_parameter_v) + # w = top_level.smoothing_3D(w,smoothing_parameter_w) + + u[(advection_boundary,-advection_boundary-1),:,:] *= 0.5 + v[(advection_boundary,-advection_boundary-1),:,:] *= 0.5 + w[(advection_boundary,-advection_boundary-1),:,:] *= 0.5 + + u[:advection_boundary,:,:] = 0 + v[:advection_boundary,:,:] = 0 + w[:advection_boundary,:,:] = 0 + + u[-advection_boundary:,:,:] = 0 + v[-advection_boundary:,:,:] = 0 + w[-advection_boundary:,:,:] = 0 + + # time_taken = float(round(time.time() - before_velocity,3)) # print('Velocity: ',str(time_taken),'s') - before_advection = time.time() + # before_advection = time.time() if advection: # allow for thermal advection in the atmosphere, and heat diffusion in the atmosphere and the ground # atmosp_addition = dt*(thermal_diffusivity_air*laplacian(temperature_atmos)) - atmosp_addition = dt*top_level.divergence_with_scalar(temperature_atmos,u,v,dx,dy) + atmosp_addition = dt*top_level.divergence_with_scalar(temperature_atmos,u,v,w,dx,dy,dz) temperature_atmos[advection_boundary:-advection_boundary,:,:] -= atmosp_addition[advection_boundary:-advection_boundary,:,:] temperature_atmos[advection_boundary-1,:,:] -= 0.5*atmosp_addition[advection_boundary-1,:,:] temperature_atmos[-advection_boundary,:,:] -= 0.5*atmosp_addition[-advection_boundary,:,:] # as density is now variable, allow for mass advection - # density_addition = dt*divergence_with_scalar(air_density) - # air_density[advection_boundary:-advection_boundary,:,:] -= density_addition[advection_boundary:-advection_boundary,:,:] - # air_density[(advection_boundary-1),:,:] -= 0.5*density_addition[advection_boundary-1,:,:] - # air_density[-advection_boundary,:,:] -= 0.5*density_addition[-advection_boundary,:,:] + density_addition = dt*top_level.divergence_with_scalar(air_density,u,v,w,dx,dy,dz) + air_density[advection_boundary:-advection_boundary,:,:] -= density_addition[advection_boundary:-advection_boundary,:,:] + air_density[(advection_boundary-1),:,:] -= 0.5*density_addition[advection_boundary-1,:,:] + air_density[-advection_boundary,:,:] -= 0.5*density_addition[-advection_boundary,:,:] + + # temperature_world -= dt*(thermal_diffusivity_roc*top_level.laplacian_2D(temperature_world,dx,dy)) - # temperature_world += dt*(thermal_diffusivity_roc*laplacian(temperature_world)) - time_taken = float(round(time.time() - before_advection,3)) + # time_taken = float(round(time.time() - before_advection,3)) # print('Advection: ',str(time_taken),'s') + - before_plot = time.time() + # before_plot = time.time() if plot: tropopause_height = np.zeros(nlat) @@ -226,10 +257,11 @@ while True: else: while low_level.scalar_gradient_z_1D(np.mean(temperature_atmos[i,:,:],axis=0),dz,k) < 0: k += 1 + tropopause_height[i] = heights[k] # update plot - test = ax[0].contourf(lon_plot, lat_plot, temperature_world, cmap='seismic') - ax[0].streamplot(lon_plot, lat_plot, u[:,:,0], v[:,:,0], color='white',density=1) + test = ax[0].contourf(lon_plot, lat_plot, temperature_world, cmap='seismic',levels=15) + if velocity: ax[0].streamplot(lon_plot, lat_plot, u[:,:,0], v[:,:,0], color='white',density=1) ax[0].set_title('$\it{Ground} \quad \it{temperature}$') ax[0].set_xlim((lon.min(),lon.max())) ax[0].set_ylim((lat.min(),lat.max())) @@ -237,10 +269,11 @@ while True: ax[0].axhline(y=0,color='black',alpha=0.3) ax[0].set_xlabel('Longitude') - ax[1].contourf(heights_plot, lat_z_plot, np.transpose(np.mean(temperature_atmos,axis=1)), cmap='seismic') + ax[1].contourf(heights_plot, lat_z_plot, np.transpose(np.mean(temperature_atmos,axis=1)), cmap='seismic',levels=15) ax[1].plot(lat_plot,tropopause_height,color='black',linestyle='--',linewidth=3,alpha=0.5) - ax[1].contour(heights_plot,lat_z_plot, np.transpose(np.mean(u,axis=1)), colors='white',levels=20,linewidths=1,alpha=0.8) - ax[1].streamplot(heights_plot, lat_z_plot, np.transpose(np.mean(v,axis=1)),np.transpose(np.mean(10*w,axis=1)),color='black',density=0.75) + if velocity: + ax[1].contour(heights_plot,lat_z_plot, np.transpose(np.mean(u,axis=1)), colors='white',levels=20,linewidths=1,alpha=0.8) + ax[1].streamplot(heights_plot, lat_z_plot, np.transpose(np.mean(v,axis=1)),np.transpose(np.mean(10*w,axis=1)),color='black',density=0.75) ax[1].set_title('$\it{Atmospheric} \quad \it{temperature}$') ax[1].set_xlim((-90,90)) ax[1].set_ylim((0,heights.max())) @@ -252,10 +285,12 @@ while True: f.suptitle( 'Time ' + str(round(24*t/day,2)) + ' hours' ) if level_plots: + quiver_padding = int(50/resolution) + skip=(slice(None,None,2),slice(None,None,2)) for k, z in zip(range(nplots), level_plots_levels): z += 1 - bx[k].contourf(lon_plot, lat_plot, temperature_atmos[:,:,z], cmap='seismic') - bx[k].streamplot(lon_plot, lat_plot, u[:,:,z], v[:,:,z], color='white',density=1) + bx[k].contourf(lon_plot, lat_plot, temperature_atmos[:,:,z], cmap='seismic',levels=15) + bx[k].streamplot(lon_plot, lat_plot, u[:,:,z], v[:,:,z], color='white',density=1.5) bx[k].set_title(str(round(heights[z]/1E3))+' km') bx[k].set_ylabel('Latitude') bx[k].set_xlim((lon.min(),lon.max())) @@ -270,7 +305,7 @@ while True: if level_plots: for k in range(nplots): bx[k].cla() - time_taken = float(round(time.time() - before_plot,3)) + # time_taken = float(round(time.time() - before_plot,3)) # print('Plotting: ',str(time_taken),'s') # advance time by one timestep @@ -281,7 +316,7 @@ while True: print('Time: ',str(time_taken),'s') if save: - pickle.dump((temperature_atmos,temperature_world,u,v,w,t,air_density,albedo), open("save_file.p","wb")) + pickle.dump((temperature_atmos,temperature_world,u,v,w,t,air_pressure,air_density,albedo), open("save_file.p","wb")) if np.isnan(u.max()): sys.exit() \ No newline at end of file