From: <js...@us...> - 2007-09-12 18:14:42
|
Revision: 3840 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3840&view=rev Author: jswhit Date: 2007-09-12 11:14:38 -0700 (Wed, 12 Sep 2007) Log Message: ----------- fix isnan check Modified Paths: -------------- trunk/toolkits/basemap/src/_geod.c trunk/toolkits/basemap/src/_geod.pyx Modified: trunk/toolkits/basemap/src/_geod.c =================================================================== --- trunk/toolkits/basemap/src/_geod.c 2007-09-12 17:25:19 UTC (rev 3839) +++ trunk/toolkits/basemap/src/_geod.c 2007-09-12 18:14:38 UTC (rev 3840) @@ -1,4 +1,4 @@ -/* Generated by Pyrex 0.9.6.3 on Fri Aug 31 08:42:50 2007 */ +/* Generated by Pyrex 0.9.6.5 on Wed Sep 12 12:12:33 2007 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -12,6 +12,8 @@ #define PY_SSIZE_T_MIN INT_MIN #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) #endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -37,6 +39,8 @@ typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/ +#define __pyx_PyIndex_AsSsize_t(b) PyInt_AsSsize_t(PyNumber_Index(b)) + #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; @@ -337,15 +341,13 @@ static PyObject *__pyx_n___class__; -static PyObject *__pyx_f_5_geod_4Geod___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_5_geod_4Geod___reduce__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static char __pyx_doc_5_geod_4Geod___reduce__[] = "special method that allows pyproj.Geod instance to be pickled"; -static PyObject *__pyx_f_5_geod_4Geod___reduce__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_f_5_geod_4Geod___reduce__(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - static char *__pyx_argnames[] = {0}; - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames))) return 0; Py_INCREF(__pyx_v_self); /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":27 @@ -421,6 +423,7 @@ PyObject *__pyx_5 = 0; Py_ssize_t __pyx_6; double __pyx_7; + int __pyx_8; static char *__pyx_argnames[] = {"lons","lats","az","dist","radians",0}; __pyx_v_radians = __pyx_k3; if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO|O", __pyx_argnames, &__pyx_v_lons, &__pyx_v_lats, &__pyx_v_az, &__pyx_v_dist, &__pyx_v_radians))) return 0; @@ -571,7 +574,7 @@ __pyx_5 = PyNumber_Divide(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_6 = PyInt_AsSsize_t(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;} + __pyx_6 = __pyx_PyIndex_AsSsize_t(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; __pyx_v_ndim = __pyx_6; @@ -781,7 +784,7 @@ * geod_for(&self.geodesic_t) * if pj_errno != 0: # <<<<<<<<<<<<<< * raise RuntimeError(pj_strerrno(pj_errno)) - * if isnan(self.geodesic_t.ALPHA21) == FP_NAN: + * if isnan(self.geodesic_t.ALPHA21): */ __pyx_1 = (pj_errno != 0); if (__pyx_1) { @@ -790,7 +793,7 @@ * geod_for(&self.geodesic_t) * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< - * if isnan(self.geodesic_t.ALPHA21) == FP_NAN: + * if isnan(self.geodesic_t.ALPHA21): * raise ValueError('undefined forward geodesic (may be an equatorial arc)') */ __pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;} @@ -809,16 +812,16 @@ /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":73 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) - * if isnan(self.geodesic_t.ALPHA21) == FP_NAN: # <<<<<<<<<<<<<< + * if isnan(self.geodesic_t.ALPHA21): # <<<<<<<<<<<<<< * raise ValueError('undefined forward geodesic (may be an equatorial arc)') * if radians: */ - __pyx_2 = (isnan(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA21) == FP_NAN); - if (__pyx_2) { + __pyx_8 = isnan(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA21); + if (__pyx_8) { /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":74 * raise RuntimeError(pj_strerrno(pj_errno)) - * if isnan(self.geodesic_t.ALPHA21) == FP_NAN: + * if isnan(self.geodesic_t.ALPHA21): * raise ValueError('undefined forward geodesic (may be an equatorial arc)') # <<<<<<<<<<<<<< * if radians: * lonsdata[i] = self.geodesic_t.p2.v @@ -836,14 +839,14 @@ __pyx_L12:; /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":75 - * if isnan(self.geodesic_t.ALPHA21) == FP_NAN: + * if isnan(self.geodesic_t.ALPHA21): * raise ValueError('undefined forward geodesic (may be an equatorial arc)') * if radians: # <<<<<<<<<<<<<< * lonsdata[i] = self.geodesic_t.p2.v * latsdata[i] = self.geodesic_t.p2.u */ - __pyx_1 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;} - if (__pyx_1) { + __pyx_2 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;} + if (__pyx_2) { /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":76 * raise ValueError('undefined forward geodesic (may be an equatorial arc)') @@ -980,6 +983,7 @@ PyObject *__pyx_5 = 0; Py_ssize_t __pyx_6; double __pyx_7; + int __pyx_8; static char *__pyx_argnames[] = {"lons1","lats1","lons2","lats2","radians",0}; __pyx_v_radians = __pyx_k4; if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO|O", __pyx_argnames, &__pyx_v_lons1, &__pyx_v_lats1, &__pyx_v_lons2, &__pyx_v_lats2, &__pyx_v_radians))) return 0; @@ -1130,7 +1134,7 @@ __pyx_5 = PyNumber_Divide(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_6 = PyInt_AsSsize_t(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} + __pyx_6 = __pyx_PyIndex_AsSsize_t(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; __pyx_v_ndim = __pyx_6; @@ -1281,7 +1285,7 @@ * self.geodesic_t.p2.v = _dg2rad*azdata[i] * self.geodesic_t.p2.u = _dg2rad*distdata[i] # <<<<<<<<<<<<<< * geod_inv(&self.geodesic_t) - * if isnan(self.geodesic_t.DIST) == FP_NAN: + * if isnan(self.geodesic_t.DIST): */ __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;} __pyx_4 = PyFloat_FromDouble((__pyx_v_distdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;} @@ -1298,7 +1302,7 @@ * self.geodesic_t.p2.v = _dg2rad*azdata[i] * self.geodesic_t.p2.u = _dg2rad*distdata[i] * geod_inv(&self.geodesic_t) # <<<<<<<<<<<<<< - * if isnan(self.geodesic_t.DIST) == FP_NAN: + * if isnan(self.geodesic_t.DIST): * raise ValueError('undefined inverse geodesic (may be an antipodal point)') */ geod_inv((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); @@ -1306,16 +1310,16 @@ /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":122 * self.geodesic_t.p2.u = _dg2rad*distdata[i] * geod_inv(&self.geodesic_t) - * if isnan(self.geodesic_t.DIST) == FP_NAN: # <<<<<<<<<<<<<< + * if isnan(self.geodesic_t.DIST): # <<<<<<<<<<<<<< * raise ValueError('undefined inverse geodesic (may be an antipodal point)') * if pj_errno != 0: */ - __pyx_2 = (isnan(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.DIST) == FP_NAN); - if (__pyx_2) { + __pyx_8 = isnan(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.DIST); + if (__pyx_8) { /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":123 * geod_inv(&self.geodesic_t) - * if isnan(self.geodesic_t.DIST) == FP_NAN: + * if isnan(self.geodesic_t.DIST): * raise ValueError('undefined inverse geodesic (may be an antipodal point)') # <<<<<<<<<<<<<< * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) @@ -1333,14 +1337,14 @@ __pyx_L10:; /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":124 - * if isnan(self.geodesic_t.DIST) == FP_NAN: + * if isnan(self.geodesic_t.DIST): * raise ValueError('undefined inverse geodesic (may be an antipodal point)') * if pj_errno != 0: # <<<<<<<<<<<<<< * raise RuntimeError(pj_strerrno(pj_errno)) * if radians: */ - __pyx_1 = (pj_errno != 0); - if (__pyx_1) { + __pyx_2 = (pj_errno != 0); + if (__pyx_2) { /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":125 * raise ValueError('undefined inverse geodesic (may be an antipodal point)') @@ -1369,8 +1373,8 @@ * lonsdata[i] = self.geodesic_t.ALPHA12 * latsdata[i] = self.geodesic_t.ALPHA21 */ - __pyx_2 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;} - if (__pyx_2) { + __pyx_1 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;} + if (__pyx_1) { /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":127 * raise RuntimeError(pj_strerrno(pj_errno)) @@ -1868,7 +1872,7 @@ } static struct PyMethodDef __pyx_methods_5_geod_Geod[] = { - {"__reduce__", (PyCFunction)__pyx_f_5_geod_4Geod___reduce__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod___reduce__}, + {"__reduce__", (PyCFunction)__pyx_f_5_geod_4Geod___reduce__, METH_NOARGS, __pyx_doc_5_geod_4Geod___reduce__}, {"_fwd", (PyCFunction)__pyx_f_5_geod_4Geod__fwd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod__fwd}, {"_inv", (PyCFunction)__pyx_f_5_geod_4Geod__inv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod__inv}, {"_npts", (PyCFunction)__pyx_f_5_geod_4Geod__npts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod__npts}, Modified: trunk/toolkits/basemap/src/_geod.pyx =================================================================== --- trunk/toolkits/basemap/src/_geod.pyx 2007-09-12 17:25:19 UTC (rev 3839) +++ trunk/toolkits/basemap/src/_geod.pyx 2007-09-12 18:14:38 UTC (rev 3840) @@ -70,7 +70,7 @@ geod_for(&self.geodesic_t) if pj_errno != 0: raise RuntimeError(pj_strerrno(pj_errno)) - if isnan(self.geodesic_t.ALPHA21) == FP_NAN: + if isnan(self.geodesic_t.ALPHA21): raise ValueError('undefined forward geodesic (may be an equatorial arc)') if radians: lonsdata[i] = self.geodesic_t.p2.v @@ -119,7 +119,7 @@ self.geodesic_t.p2.v = _dg2rad*azdata[i] self.geodesic_t.p2.u = _dg2rad*distdata[i] geod_inv(&self.geodesic_t) - if isnan(self.geodesic_t.DIST) == FP_NAN: + if isnan(self.geodesic_t.DIST): raise ValueError('undefined inverse geodesic (may be an antipodal point)') if pj_errno != 0: raise RuntimeError(pj_strerrno(pj_errno)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |