/* Generated by Cython 0.9.6.8 on Wed Nov 14 11:06:42 2007 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#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
#ifndef WIN32
#define __stdcall
#define __cdecl
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "stdlib.h"
#include "math.h"
#include "geodesic.h"
#include "proj_api.h"
#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE
#endif
typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/
static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject* x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
#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;
else if (x == Py_False) return 0;
else return PyObject_IsTrue(x);
}
static int __pyx_skip_dispatch = 0;
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
static char **__pyx_f;
static char __pyx_mdoc[] = "\ncopyright (c) 2007 by Jeffrey Whitaker.\n\nPermission to use, copy, modify, and distribute this software and its\ndocumentation for any purpose and without fee is hereby granted,\nprovided that the above copyright notices appear in all copies and that\nboth the copyright notices and this permission notice appear in\nsupporting documentation.\nTHE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\nINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO\nEVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR\nCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF\nUSE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n";
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static PyObject *__Pyx_UnpackItem(PyObject *); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
static void __Pyx_AddTraceback(char *funcname); /*proto*/
static PyObject *__Pyx_ImportModule(char *name); /*proto*/
static int __Pyx_RegisterCleanup(); /*proto*/
static PyObject* cleanup(PyObject *self, PyObject *unused); /*proto*/
static PyMethodDef cleanup_def = {"__cleanup", (PyCFunction)&cleanup, METH_NOARGS, 0};
/* Declarations from _proj */
struct __pyx_obj_5_proj_Proj {
PyObject_HEAD
projPJ projpj;
PyObject *projparams;
PyObject *proj_version;
char *pjinitstring;
PyObject *srs;
};
static PyTypeObject *__pyx_ptype_5_proj_Proj = 0;
static PyObject *__pyx_k3;
static PyObject *__pyx_k4;
static PyObject *__pyx_k5;
static PyObject *__pyx_k6;
/* Implementation of _proj */
static char __pyx_k2[] = "1.8.3";
static PyObject *__pyx_n___cinit__;
static PyObject *__pyx_n___dealloc__;
static PyObject *__pyx_n___reduce__;
static PyObject *__pyx_n__fwd;
static PyObject *__pyx_n__inv;
static PyObject *__pyx_n_is_latlong;
static PyObject *__pyx_n_is_geocent;
static PyObject *__pyx_n_math;
static PyObject *__pyx_n_radians;
static PyObject *__pyx_n__dg2rad;
static PyObject *__pyx_n_degrees;
static PyObject *__pyx_n__rad2dg;
static PyObject *__pyx_n__doublesize;
static PyObject *__pyx_n___version__;
static PyObject *__pyx_k2p;
static PyObject *__pyx_pf_5_proj_set_datapath(PyObject *__pyx_self, PyObject *__pyx_v_datapath); /*proto*/
static PyObject *__pyx_pf_5_proj_set_datapath(PyObject *__pyx_self, PyObject *__pyx_v_datapath) {
char *__pyx_v_searchpath;
PyObject *__pyx_r;
Py_INCREF(__pyx_v_datapath);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":23
* def set_datapath(datapath):
* cdef char *searchpath
* searchpath = PyString_AsString(datapath) # <<<<<<<<<<<<<<
* pj_set_searchpath(1, &searchpath)
*
*/
__pyx_v_searchpath = PyString_AsString(__pyx_v_datapath);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":24
* cdef char *searchpath
* searchpath = PyString_AsString(datapath)
* pj_set_searchpath(1, &searchpath) # <<<<<<<<<<<<<<
*
* cdef class Proj:
*/
pj_set_searchpath(1,(&__pyx_v_searchpath));
__pyx_r = Py_None; Py_INCREF(Py_None);
Py_DECREF(__pyx_v_datapath);
return __pyx_r;
}
static PyObject *__pyx_n_iteritems;
static PyObject *__pyx_n_append;
static PyObject *__pyx_n_join;
static PyObject *__pyx_n_RuntimeError;
static PyObject *__pyx_k7p;
static PyObject *__pyx_k8p;
static PyObject *__pyx_k9p;
static PyObject *__pyx_k10p;
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k7[] = "+";
static char __pyx_k8[] = "=";
static char __pyx_k9[] = " ";
static char __pyx_k10[] = "";
static int __pyx_pf_5_proj_4Proj___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5_proj_4Proj___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_projparams = 0;
PyObject *__pyx_v_pjargs;
PyObject *__pyx_v_key;
PyObject *__pyx_v_value;
int __pyx_r;
PyObject *__pyx_1 = 0;
Py_ssize_t __pyx_2;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
PyObject *__pyx_5 = 0;
PyObject *__pyx_6 = 0;
int __pyx_7;
static char *__pyx_argnames[] = {"projparams",0};
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_projparams))) return -1;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_projparams);
__pyx_v_pjargs = Py_None; Py_INCREF(Py_None);
__pyx_v_key = Py_None; Py_INCREF(Py_None);
__pyx_v_value = Py_None; Py_INCREF(Py_None);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":34
*
* def __new__(self, projparams):
* self.projparams = projparams # <<<<<<<<<<<<<<
* # setup proj initialization string.
* pjargs = []
*/
Py_INCREF(__pyx_v_projparams);
Py_DECREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams);
((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams = __pyx_v_projparams;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":36
* self.projparams = projparams
* # setup proj initialization string.
* pjargs = [] # <<<<<<<<<<<<<<
* for key,value in projparams.iteritems():
* pjargs.append('+'+key+"="+str(value)+' ')
*/
__pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; goto __pyx_L1;}
Py_DECREF(__pyx_v_pjargs);
__pyx_v_pjargs = __pyx_1;
__pyx_1 = 0;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":37
* # setup proj initialization string.
* pjargs = []
* for key,value in projparams.iteritems(): # <<<<<<<<<<<<<<
* pjargs.append('+'+key+"="+str(value)+' ')
* self.srs = ''.join(pjargs)
*/
__pyx_1 = PyObject_GetAttr(__pyx_v_projparams, __pyx_n_iteritems); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
__pyx_3 = PyObject_CallObject(__pyx_1, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (PyList_CheckExact(__pyx_3)) { __pyx_2 = 0; __pyx_1 = __pyx_3; Py_INCREF(__pyx_1); }
else { __pyx_1 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;} }
Py_DECREF(__pyx_3); __pyx_3 = 0;
for (;;) {
if (PyList_CheckExact(__pyx_1)) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_3 = PyList_GET_ITEM(__pyx_1, __pyx_2++); Py_INCREF(__pyx_3); }
else {
__pyx_3 = PyIter_Next(__pyx_1);
if (!__pyx_3) {
break;
}
}
if (PyTuple_CheckExact(__pyx_3) && PyTuple_GET_SIZE(__pyx_3) == 2) {
__pyx_5 = PyTuple_GET_ITEM(__pyx_3, 0);
Py_INCREF(__pyx_5);
Py_DECREF(__pyx_v_key);
__pyx_v_key = __pyx_5;
__pyx_5 = 0;
__pyx_5 = PyTuple_GET_ITEM(__pyx_3, 1);
Py_INCREF(__pyx_5);
Py_DECREF(__pyx_v_value);
__pyx_v_value = __pyx_5;
__pyx_5 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
else {
__pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_5 = __Pyx_UnpackItem(__pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
Py_DECREF(__pyx_v_key);
__pyx_v_key = __pyx_5;
__pyx_5 = 0;
__pyx_5 = __Pyx_UnpackItem(__pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
Py_DECREF(__pyx_v_value);
__pyx_v_value = __pyx_5;
__pyx_5 = 0;
if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
}
__pyx_5 = PyObject_GetAttr(__pyx_v_pjargs, __pyx_n_append); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
__pyx_3 = PyNumber_Add(__pyx_k7p, __pyx_v_key); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
__pyx_4 = PyNumber_Add(__pyx_3, __pyx_k8p); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_INCREF(__pyx_v_value);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_value);
__pyx_6 = PyObject_CallObject(((PyObject*)&PyString_Type), __pyx_3); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_3 = PyNumber_Add(__pyx_4, __pyx_6); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_6); __pyx_6 = 0;
__pyx_4 = PyNumber_Add(__pyx_3, __pyx_k9p); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = PyTuple_New(1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_6, 0, __pyx_4);
__pyx_4 = 0;
__pyx_3 = PyObject_CallObject(__pyx_5, __pyx_6); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
Py_DECREF(__pyx_6); __pyx_6 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":39
* for key,value in projparams.iteritems():
* pjargs.append('+'+key+"="+str(value)+' ')
* self.srs = ''.join(pjargs) # <<<<<<<<<<<<<<
* self.pjinitstring = PyString_AsString(self.srs)
* # initialize projection
*/
__pyx_4 = PyObject_GetAttr(__pyx_k10p, __pyx_n_join); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
__pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_INCREF(__pyx_v_pjargs);
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_pjargs);
__pyx_6 = PyObject_CallObject(__pyx_4, __pyx_5); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_5); __pyx_5 = 0;
Py_DECREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs);
((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs = __pyx_6;
__pyx_6 = 0;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":40
* pjargs.append('+'+key+"="+str(value)+' ')
* self.srs = ''.join(pjargs)
* self.pjinitstring = PyString_AsString(self.srs) # <<<<<<<<<<<<<<
* # initialize projection
* self.projpj = pj_init_plus(self.pjinitstring)
*/
((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->pjinitstring = PyString_AsString(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":42
* self.pjinitstring = PyString_AsString(self.srs)
* # initialize projection
* self.projpj = pj_init_plus(self.pjinitstring) # <<<<<<<<<<<<<<
* if pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno))
*/
((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projpj = pj_init_plus(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->pjinitstring);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":43
* # initialize projection
* self.projpj = pj_init_plus(self.pjinitstring)
* if pj_errno != 0: # <<<<<<<<<<<<<<
* raise RuntimeError(pj_strerrno(pj_errno))
* self.proj_version = PJ_VERSION/100.
*/
__pyx_7 = (pj_errno != 0);
if (__pyx_7) {
__pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
__pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
__pyx_3 = 0;
__pyx_4 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__Pyx_Raise(__pyx_4, 0, 0);
Py_DECREF(__pyx_4); __pyx_4 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":45
* if pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno))
* self.proj_version = PJ_VERSION/100. # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
__pyx_5 = PyFloat_FromDouble((PJ_VERSION / 100.)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
Py_DECREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->proj_version);
((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->proj_version = __pyx_5;
__pyx_5 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
Py_XDECREF(__pyx_5);
Py_XDECREF(__pyx_6);
__Pyx_AddTraceback("_proj.Proj.__cinit__");
__pyx_r = -1;
__pyx_L0:;
Py_DECREF(__pyx_v_pjargs);
Py_DECREF(__pyx_v_key);
Py_DECREF(__pyx_v_value);
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_projparams);
return __pyx_r;
}
static void __pyx_pf_5_proj_4Proj___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_5_proj_4Proj___dealloc__(PyObject *__pyx_v_self) {
Py_INCREF(__pyx_v_self);
pj_free(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projpj);
Py_DECREF(__pyx_v_self);
}
static PyObject *__pyx_n___class__;
static PyObject *__pyx_pf_5_proj_4Proj___reduce__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static char __pyx_doc_5_proj_4Proj___reduce__[] = "special method that allows pyproj.Proj instance to be pickled";
static PyObject *__pyx_pf_5_proj_4Proj___reduce__(PyObject *__pyx_v_self, PyObject *unused) {
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
Py_INCREF(__pyx_v_self);
__pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
Py_INCREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams);
PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams);
__pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
__pyx_1 = 0;
__pyx_2 = 0;
__pyx_r = __pyx_3;
__pyx_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("_proj.Proj.__reduce__");
__pyx_r = NULL;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_k11p;
static char __pyx_k11[] = "Buffer lengths not the same";
static PyObject *__pyx_pf_5_proj_4Proj__fwd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_proj_4Proj__fwd[] = "\n forward transformation - lons,lats to x,y (done in place).\n if radians=True, lons/lats are radians instead of degrees.\n if errcheck=True, an exception is raised if the forward transformation is invalid.\n if errcheck=False and the forward transformation is invalid, no exception is\n raised and 1.e30 is returned.\n ";
static PyObject *__pyx_pf_5_proj_4Proj__fwd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_lons = 0;
PyObject *__pyx_v_lats = 0;
PyObject *__pyx_v_radians = 0;
PyObject *__pyx_v_errcheck = 0;
projUV __pyx_v_projxyout;
projUV __pyx_v_projlonlatin;
Py_ssize_t __pyx_v_buflenx;
Py_ssize_t __pyx_v_bufleny;
Py_ssize_t __pyx_v_ndim;
Py_ssize_t __pyx_v_i;
double *__pyx_v_lonsdata;
double *__pyx_v_latsdata;
void *__pyx_v_londata;
void *__pyx_v_latdata;
PyObject *__pyx_r;
int __pyx_1;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
Py_ssize_t __pyx_5;
double __pyx_6;
static char *__pyx_argnames[] = {"lons","lats","radians","errcheck",0};
__pyx_v_radians = __pyx_k3;
__pyx_v_errcheck = __pyx_k4;
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|OO", __pyx_argnames, &__pyx_v_lons, &__pyx_v_lats, &__pyx_v_radians, &__pyx_v_errcheck))) return NULL;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_lons);
Py_INCREF(__pyx_v_lats);
Py_INCREF(__pyx_v_radians);
Py_INCREF(__pyx_v_errcheck);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":69
* cdef void *londata, *latdata
* # if buffer api is supported, get pointer to data buffers.
* if PyObject_AsWriteBuffer(lons, &londata, &buflenx) <> 0: # <<<<<<<<<<<<<<
* raise RuntimeError
* if PyObject_AsWriteBuffer(lats, &latdata, &bufleny) <> 0:
*/
__pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lons,(&__pyx_v_londata),(&__pyx_v_buflenx)) != 0);
if (__pyx_1) {
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":71
* if PyObject_AsWriteBuffer(lons, &londata, &buflenx) <> 0:
* raise RuntimeError
* if PyObject_AsWriteBuffer(lats, &latdata, &bufleny) <> 0: # <<<<<<<<<<<<<<
* raise RuntimeError
* # process data in buffer
*/
__pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lats,(&__pyx_v_latdata),(&__pyx_v_bufleny)) != 0);
if (__pyx_1) {
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":74
* raise RuntimeError
* # process data in buffer
* if buflenx != bufleny: # <<<<<<<<<<<<<<
* raise RuntimeError("Buffer lengths not the same")
* ndim = buflenx/_doublesize
*/
__pyx_1 = (__pyx_v_buflenx != __pyx_v_bufleny);
if (__pyx_1) {
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_INCREF(__pyx_k11p);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k11p);
__pyx_3 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__Pyx_Raise(__pyx_3, 0, 0);
Py_DECREF(__pyx_3); __pyx_3 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":76
* if buflenx != bufleny:
* raise RuntimeError("Buffer lengths not the same")
* ndim = buflenx/_doublesize # <<<<<<<<<<<<<<
* lonsdata = <double *>londata
* latsdata = <double *>latdata
*/
__pyx_2 = PyInt_FromSsize_t(__pyx_v_buflenx); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__doublesize); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
__pyx_4 = PyNumber_Divide(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_5 = __pyx_PyIndex_AsSsize_t(__pyx_4); if (unlikely((__pyx_5 == -1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_ndim = __pyx_5;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":77
* raise RuntimeError("Buffer lengths not the same")
* ndim = buflenx/_doublesize
* lonsdata = <double *>londata # <<<<<<<<<<<<<<
* latsdata = <double *>latdata
* for i from 0 <= i < ndim:
*/
__pyx_v_lonsdata = ((double *)__pyx_v_londata);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":78
* ndim = buflenx/_doublesize
* lonsdata = <double *>londata
* latsdata = <double *>latdata # <<<<<<<<<<<<<<
* for i from 0 <= i < ndim:
* if radians:
*/
__pyx_v_latsdata = ((double *)__pyx_v_latdata);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":79
* lonsdata = <double *>londata
* latsdata = <double *>latdata
* for i from 0 <= i < ndim: # <<<<<<<<<<<<<<
* if radians:
* projlonlatin.u = lonsdata[i]
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) {
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":80
* latsdata = <double *>latdata
* for i from 0 <= i < ndim:
* if radians: # <<<<<<<<<<<<<<
* projlonlatin.u = lonsdata[i]
* projlonlatin.v = latsdata[i]
*/
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
if (__pyx_1) {
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":81
* for i from 0 <= i < ndim:
* if radians:
* projlonlatin.u = lonsdata[i] # <<<<<<<<<<<<<<
* projlonlatin.v = latsdata[i]
* else:
*/
__pyx_v_projlonlatin.u = (__pyx_v_lonsdata[__pyx_v_i]);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":82
* if radians:
* projlonlatin.u = lonsdata[i]
* projlonlatin.v = latsdata[i] # <<<<<<<<<<<<<<
* else:
* projlonlatin.u = _dg2rad*lonsdata[i]
*/
__pyx_v_projlonlatin.v = (__pyx_v_latsdata[__pyx_v_i]);
goto __pyx_L7;
}
/*else*/ {
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":84
* projlonlatin.v = latsdata[i]
* else:
* projlonlatin.u = _dg2rad*lonsdata[i] # <<<<<<<<<<<<<<
* projlonlatin.v = _dg2rad*latsdata[i]
* projxyout = pj_fwd(projlonlatin,self.projpj)
*/
__pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
__pyx_3 = PyFloat_FromDouble((__pyx_v_lonsdata[__pyx_v_i])); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_projlonlatin.u = __pyx_6;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":85
* else:
* projlonlatin.u = _dg2rad*lonsdata[i]
* projlonlatin.v = _dg2rad*latsdata[i] # <<<<<<<<<<<<<<
* projxyout = pj_fwd(projlonlatin,self.projpj)
* if errcheck and pj_errno != 0:
*/
__pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
__pyx_3 = PyFloat_FromDouble((__pyx_v_latsdata[__pyx_v_i])); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_projlonlatin.v = __pyx_6;
}
__pyx_L7:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":86
* projlonlatin.u = _dg2rad*lonsdata[i]
* projlonlatin.v = _dg2rad*latsdata[i]
* projxyout = pj_fwd(projlonlatin,self.projpj) # <<<<<<<<<<<<<<
* if errcheck and pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno))
*/
__pyx_v_projxyout = pj_fwd(__pyx_v_projlonlatin,((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projpj);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":87
* projlonlatin.v = _dg2rad*latsdata[i]
* projxyout = pj_fwd(projlonlatin,self.projpj)
* if errcheck and pj_errno != 0: # <<<<<<<<<<<<<<
* raise RuntimeError(pj_strerrno(pj_errno))
* # since HUGE_VAL can be 'inf',
*/
__pyx_2 = __pyx_v_errcheck;
Py_INCREF(__pyx_2);
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
if (__pyx_1) {
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_2 = __Pyx_PyBool_FromLong((pj_errno != 0)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
__pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
__pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
__pyx_3 = 0;
__pyx_2 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__Pyx_Raise(__pyx_2, 0, 0);
Py_DECREF(__pyx_2); __pyx_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
goto __pyx_L8;
}
__pyx_L8:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":91
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
* if projxyout.u == HUGE_VAL: # <<<<<<<<<<<<<<
* lonsdata[i] = 1.e30
* else:
*/
__pyx_1 = (__pyx_v_projxyout.u == HUGE_VAL);
if (__pyx_1) {
(__pyx_v_lonsdata[__pyx_v_i]) = 1.e30;
goto __pyx_L9;
}
/*else*/ {
(__pyx_v_lonsdata[__pyx_v_i]) = __pyx_v_projxyout.u;
}
__pyx_L9:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":95
* else:
* lonsdata[i] = projxyout.u
* if projxyout.v == HUGE_VAL: # <<<<<<<<<<<<<<
* latsdata[i] = 1.e30
* else:
*/
__pyx_1 = (__pyx_v_projxyout.v == HUGE_VAL);
if (__pyx_1) {
(__pyx_v_latsdata[__pyx_v_i]) = 1.e30;
goto __pyx_L10;
}
/*else*/ {
(__pyx_v_latsdata[__pyx_v_i]) = __pyx_v_projxyout.v;
}
__pyx_L10:;
}
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("_proj.Proj._fwd");
__pyx_r = NULL;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_lons);
Py_DECREF(__pyx_v_lats);
Py_DECREF(__pyx_v_radians);
Py_DECREF(__pyx_v_errcheck);
return __pyx_r;
}
static PyObject *__pyx_k12p;
static char __pyx_k12[] = "Buffer lengths not the same";
static PyObject *__pyx_pf_5_proj_4Proj__inv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_proj_4Proj__inv[] = "\n inverse transformation - x,y to lons,lats (done in place).\n if radians=True, lons/lats are radians instead of degrees.\n if errcheck=True, an exception is raised if the inverse transformation is invalid.\n if errcheck=False and the inverse transformation is invalid, no exception is\n raised and 1.e30 is returned.\n ";
static PyObject *__pyx_pf_5_proj_4Proj__inv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_y = 0;
PyObject *__pyx_v_radians = 0;
PyObject *__pyx_v_errcheck = 0;
projUV __pyx_v_projxyin;
projUV __pyx_v_projlonlatout;
Py_ssize_t __pyx_v_buflenx;
Py_ssize_t __pyx_v_bufleny;
Py_ssize_t __pyx_v_ndim;
Py_ssize_t __pyx_v_i;
void *__pyx_v_xdata;
void *__pyx_v_ydata;
double *__pyx_v_xdatab;
double *__pyx_v_ydatab;
PyObject *__pyx_r;
int __pyx_1;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
Py_ssize_t __pyx_5;
double __pyx_6;
static char *__pyx_argnames[] = {"x","y","radians","errcheck",0};
__pyx_v_radians = __pyx_k5;
__pyx_v_errcheck = __pyx_k6;
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|OO", __pyx_argnames, &__pyx_v_x, &__pyx_v_y, &__pyx_v_radians, &__pyx_v_errcheck))) return NULL;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_x);
Py_INCREF(__pyx_v_y);
Py_INCREF(__pyx_v_radians);
Py_INCREF(__pyx_v_errcheck);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":114
* cdef double *xdatab, *ydatab
* # if buffer api is supported, get pointer to data buffers.
* if PyObject_AsWriteBuffer(x, &xdata, &buflenx) <> 0: # <<<<<<<<<<<<<<
* raise RuntimeError
* if PyObject_AsWriteBuffer(y, &ydata, &bufleny) <> 0:
*/
__pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_x,(&__pyx_v_xdata),(&__pyx_v_buflenx)) != 0);
if (__pyx_1) {
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":116
* if PyObject_AsWriteBuffer(x, &xdata, &buflenx) <> 0:
* raise RuntimeError
* if PyObject_AsWriteBuffer(y, &ydata, &bufleny) <> 0: # <<<<<<<<<<<<<<
* raise RuntimeError
* # process data in buffer
*/
__pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_y,(&__pyx_v_ydata),(&__pyx_v_bufleny)) != 0);
if (__pyx_1) {
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":120
* # process data in buffer
* # (for numpy/regular python arrays).
* if buflenx != bufleny: # <<<<<<<<<<<<<<
* raise RuntimeError("Buffer lengths not the same")
* ndim = buflenx/_doublesize
*/
__pyx_1 = (__pyx_v_buflenx != __pyx_v_bufleny);
if (__pyx_1) {
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
Py_INCREF(__pyx_k12p);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k12p);
__pyx_3 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__Pyx_Raise(__pyx_3, 0, 0);
Py_DECREF(__pyx_3); __pyx_3 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":122
* if buflenx != bufleny:
* raise RuntimeError("Buffer lengths not the same")
* ndim = buflenx/_doublesize # <<<<<<<<<<<<<<
* xdatab = <double *>xdata
* ydatab = <double *>ydata
*/
__pyx_2 = PyInt_FromSsize_t(__pyx_v_buflenx); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__doublesize); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
__pyx_4 = PyNumber_Divide(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_5 = __pyx_PyIndex_AsSsize_t(__pyx_4); if (unlikely((__pyx_5 == -1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_ndim = __pyx_5;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":123
* raise RuntimeError("Buffer lengths not the same")
* ndim = buflenx/_doublesize
* xdatab = <double *>xdata # <<<<<<<<<<<<<<
* ydatab = <double *>ydata
* for i from 0 <= i < ndim:
*/
__pyx_v_xdatab = ((double *)__pyx_v_xdata);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":124
* ndim = buflenx/_doublesize
* xdatab = <double *>xdata
* ydatab = <double *>ydata # <<<<<<<<<<<<<<
* for i from 0 <= i < ndim:
* projxyin.u = xdatab[i]
*/
__pyx_v_ydatab = ((double *)__pyx_v_ydata);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":125
* xdatab = <double *>xdata
* ydatab = <double *>ydata
* for i from 0 <= i < ndim: # <<<<<<<<<<<<<<
* projxyin.u = xdatab[i]
* projxyin.v = ydatab[i]
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) {
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":126
* ydatab = <double *>ydata
* for i from 0 <= i < ndim:
* projxyin.u = xdatab[i] # <<<<<<<<<<<<<<
* projxyin.v = ydatab[i]
* projlonlatout = pj_inv(projxyin,self.projpj)
*/
__pyx_v_projxyin.u = (__pyx_v_xdatab[__pyx_v_i]);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":127
* for i from 0 <= i < ndim:
* projxyin.u = xdatab[i]
* projxyin.v = ydatab[i] # <<<<<<<<<<<<<<
* projlonlatout = pj_inv(projxyin,self.projpj)
* if errcheck and pj_errno != 0:
*/
__pyx_v_projxyin.v = (__pyx_v_ydatab[__pyx_v_i]);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":128
* projxyin.u = xdatab[i]
* projxyin.v = ydatab[i]
* projlonlatout = pj_inv(projxyin,self.projpj) # <<<<<<<<<<<<<<
* if errcheck and pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno))
*/
__pyx_v_projlonlatout = pj_inv(__pyx_v_projxyin,((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projpj);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":129
* projxyin.v = ydatab[i]
* projlonlatout = pj_inv(projxyin,self.projpj)
* if errcheck and pj_errno != 0: # <<<<<<<<<<<<<<
* raise RuntimeError(pj_strerrno(pj_errno))
* # since HUGE_VAL can be 'inf',
*/
__pyx_2 = __pyx_v_errcheck;
Py_INCREF(__pyx_2);
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
if (__pyx_1) {
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_2 = __Pyx_PyBool_FromLong((pj_errno != 0)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
__pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
__pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
__pyx_3 = 0;
__pyx_2 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__Pyx_Raise(__pyx_2, 0, 0);
Py_DECREF(__pyx_2); __pyx_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
goto __pyx_L7;
}
__pyx_L7:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":133
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
* if projlonlatout.u == HUGE_VAL: # <<<<<<<<<<<<<<
* xdatab[i] = 1.e30
* elif radians:
*/
__pyx_1 = (__pyx_v_projlonlatout.u == HUGE_VAL);
if (__pyx_1) {
(__pyx_v_xdatab[__pyx_v_i]) = 1.e30;
goto __pyx_L8;
}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L1;}
if (__pyx_1) {
(__pyx_v_xdatab[__pyx_v_i]) = __pyx_v_projlonlatout.u;
goto __pyx_L8;
}
/*else*/ {
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;}
__pyx_4 = PyFloat_FromDouble(__pyx_v_projlonlatout.u); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;}
__pyx_2 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_6 = PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_xdatab[__pyx_v_i]) = __pyx_6;
}
__pyx_L8:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":139
* else:
* xdatab[i] = _rad2dg*projlonlatout.u
* if projlonlatout.v == HUGE_VAL: # <<<<<<<<<<<<<<
* ydatab[i] = 1.e30
* elif radians:
*/
__pyx_1 = (__pyx_v_projlonlatout.v == HUGE_VAL);
if (__pyx_1) {
(__pyx_v_ydatab[__pyx_v_i]) = 1.e30;
goto __pyx_L9;
}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;}
if (__pyx_1) {
(__pyx_v_ydatab[__pyx_v_i]) = __pyx_v_projlonlatout.v;
goto __pyx_L9;
}
/*else*/ {
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; goto __pyx_L1;}
__pyx_4 = PyFloat_FromDouble(__pyx_v_projlonlatout.v); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; goto __pyx_L1;}
__pyx_2 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_6 = PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_ydatab[__pyx_v_i]) = __pyx_6;
}
__pyx_L9:;
}
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("_proj.Proj._inv");
__pyx_r = NULL;
__pyx_L0:;
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_x);
Py_DECREF(__pyx_v_y);
Py_DECREF(__pyx_v_radians);
Py_DECREF(__pyx_v_errcheck);
return __pyx_r;
}
static PyObject *__pyx_pf_5_proj_4Proj_is_latlong(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5_proj_4Proj_is_latlong(PyObject *__pyx_v_self, PyObject *unused) {
int __pyx_v_i;
PyObject *__pyx_r;
int __pyx_1;
Py_INCREF(__pyx_v_self);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":149
* # returns True if projection in geographic (lon/lat) coordinates
* cdef int i
* i = pj_is_latlong(self.projpj) # <<<<<<<<<<<<<<
* if i:
* return True
*/
__pyx_v_i = pj_is_latlong(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projpj);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":150
* cdef int i
* i = pj_is_latlong(self.projpj)
* if i: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_i;
if (__pyx_1) {
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L2;
}
/*else*/ {
Py_INCREF(Py_False);
__pyx_r = Py_False;
goto __pyx_L0;
}
__pyx_L2:;
__pyx_r = Py_None; Py_INCREF(Py_None);
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_pf_5_proj_4Proj_is_geocent(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5_proj_4Proj_is_geocent(PyObject *__pyx_v_self, PyObject *unused) {
int __pyx_v_i;
PyObject *__pyx_r;
int __pyx_1;
Py_INCREF(__pyx_v_self);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":158
* # returns True if projection in geocentric (x/y) coordinates
* cdef int i
* i = pj_is_geocent(self.projpj) # <<<<<<<<<<<<<<
* if i:
* return True
*/
__pyx_v_i = pj_is_geocent(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projpj);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":159
* cdef int i
* i = pj_is_geocent(self.projpj)
* if i: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_i;
if (__pyx_1) {
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L2;
}
/*else*/ {
Py_INCREF(Py_False);
__pyx_r = Py_False;
goto __pyx_L0;
}
__pyx_L2:;
__pyx_r = Py_None; Py_INCREF(Py_None);
__pyx_L0:;
Py_DECREF(__pyx_v_self);
return __pyx_r;
}
static PyObject *__pyx_num_0;
static PyObject *__pyx_k13p;
static char __pyx_k13[] = "x,y and z must be same size";
static PyObject *__pyx_pf_5_proj__transform(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5_proj__transform(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
struct __pyx_obj_5_proj_Proj *__pyx_v_p1 = 0;
struct __pyx_obj_5_proj_Proj *__pyx_v_p2 = 0;
PyObject *__pyx_v_inx = 0;
PyObject *__pyx_v_iny = 0;
PyObject *__pyx_v_inz = 0;
PyObject *__pyx_v_radians = 0;
void *__pyx_v_xdata;
void *__pyx_v_ydata;
void *__pyx_v_zdata;
double *__pyx_v_xx;
double *__pyx_v_yy;
double *__pyx_v_zz;
Py_ssize_t __pyx_v_buflenx;
Py_ssize_t __pyx_v_bufleny;
Py_ssize_t __pyx_v_buflenz;
Py_ssize_t __pyx_v_npts;
Py_ssize_t __pyx_v_i;
PyObject *__pyx_v_ierr;
PyObject *__pyx_r;
int __pyx_1;
int __pyx_2;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
PyObject *__pyx_5 = 0;
double __pyx_6;
int __pyx_7;
static char *__pyx_argnames[] = {"p1","p2","inx","iny","inz","radians",0};
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOOO", __pyx_argnames, &__pyx_v_p1, &__pyx_v_p2, &__pyx_v_inx, &__pyx_v_iny, &__pyx_v_inz, &__pyx_v_radians))) return NULL;
Py_INCREF(__pyx_v_p1);
Py_INCREF(__pyx_v_p2);
Py_INCREF(__pyx_v_inx);
Py_INCREF(__pyx_v_iny);
Py_INCREF(__pyx_v_inz);
Py_INCREF(__pyx_v_radians);
__pyx_v_ierr = Py_None; Py_INCREF(Py_None);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p1), __pyx_ptype_5_proj_Proj, 1, "p1"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p2), __pyx_ptype_5_proj_Proj, 1, "p2"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":169
* cdef double *xx, *yy, *zz
* cdef Py_ssize_t buflenx, bufleny, buflenz, npts, i
* if PyObject_AsWriteBuffer(inx, &xdata, &buflenx) <> 0: # <<<<<<<<<<<<<<
* raise RuntimeError
* if PyObject_AsWriteBuffer(iny, &ydata, &bufleny) <> 0:
*/
__pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_inx,(&__pyx_v_xdata),(&__pyx_v_buflenx)) != 0);
if (__pyx_1) {
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
goto __pyx_L2;
}
__pyx_L2:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":171
* if PyObject_AsWriteBuffer(inx, &xdata, &buflenx) <> 0:
* raise RuntimeError
* if PyObject_AsWriteBuffer(iny, &ydata, &bufleny) <> 0: # <<<<<<<<<<<<<<
* raise RuntimeError
* if inz is not None:
*/
__pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_iny,(&__pyx_v_ydata),(&__pyx_v_bufleny)) != 0);
if (__pyx_1) {
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":173
* if PyObject_AsWriteBuffer(iny, &ydata, &bufleny) <> 0:
* raise RuntimeError
* if inz is not None: # <<<<<<<<<<<<<<
* if PyObject_AsWriteBuffer(inz, &zdata, &buflenz) <> 0:
* raise RuntimeError
*/
__pyx_1 = (__pyx_v_inz != Py_None);
if (__pyx_1) {
__pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_inz,(&__pyx_v_zdata),(&__pyx_v_buflenz)) != 0);
if (__pyx_1) {
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
goto __pyx_L5;
}
__pyx_L5:;
goto __pyx_L4;
}
/*else*/ {
__pyx_v_buflenz = __pyx_v_bufleny;
}
__pyx_L4:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":178
* else:
* buflenz = bufleny
* if not (buflenx == bufleny == buflenz): # <<<<<<<<<<<<<<
* raise RuntimeError('x,y and z must be same size')
* xx = <double *>xdata
*/
__pyx_1 = (__pyx_v_buflenx == __pyx_v_bufleny);
if (__pyx_1) {
__pyx_1 = (__pyx_v_bufleny == __pyx_v_buflenz);
}
__pyx_2 = (!__pyx_1);
if (__pyx_2) {
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
Py_INCREF(__pyx_k13p);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k13p);
__pyx_4 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__Pyx_Raise(__pyx_4, 0, 0);
Py_DECREF(__pyx_4); __pyx_4 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
goto __pyx_L6;
}
__pyx_L6:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":180
* if not (buflenx == bufleny == buflenz):
* raise RuntimeError('x,y and z must be same size')
* xx = <double *>xdata # <<<<<<<<<<<<<<
* yy = <double *>ydata
* if inz is not None:
*/
__pyx_v_xx = ((double *)__pyx_v_xdata);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":181
* raise RuntimeError('x,y and z must be same size')
* xx = <double *>xdata
* yy = <double *>ydata # <<<<<<<<<<<<<<
* if inz is not None:
* zz = <double *>zdata
*/
__pyx_v_yy = ((double *)__pyx_v_ydata);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":182
* xx = <double *>xdata
* yy = <double *>ydata
* if inz is not None: # <<<<<<<<<<<<<<
* zz = <double *>zdata
* npts = buflenx/8
*/
__pyx_1 = (__pyx_v_inz != Py_None);
if (__pyx_1) {
__pyx_v_zz = ((double *)__pyx_v_zdata);
goto __pyx_L7;
}
__pyx_L7:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":184
* if inz is not None:
* zz = <double *>zdata
* npts = buflenx/8 # <<<<<<<<<<<<<<
* if not radians and p1.is_latlong():
* for i from 0 <= i < npts:
*/
__pyx_v_npts = (__pyx_v_buflenx / 8);
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":185
* zz = <double *>zdata
* npts = buflenx/8
* if not radians and p1.is_latlong(): # <<<<<<<<<<<<<<
* for i from 0 <= i < npts:
* xx[i] = xx[i]*_dg2rad
*/
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;}
__pyx_3 = __Pyx_PyBool_FromLong((!__pyx_2)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;}
if (__pyx_1) {
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_4 = PyObject_GetAttr(((PyObject *)__pyx_v_p1), __pyx_n_is_latlong); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;}
__pyx_3 = PyObject_CallObject(__pyx_4, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
}
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
if (__pyx_2) {
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_npts; __pyx_v_i++) {
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":187
* if not radians and p1.is_latlong():
* for i from 0 <= i < npts:
* xx[i] = xx[i]*_dg2rad # <<<<<<<<<<<<<<
* yy[i] = yy[i]*_dg2rad
* if inz is not None:
*/
__pyx_4 = PyFloat_FromDouble((__pyx_v_xx[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
__pyx_5 = PyNumber_Multiply(__pyx_4, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_xx[__pyx_v_i]) = __pyx_6;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":188
* for i from 0 <= i < npts:
* xx[i] = xx[i]*_dg2rad
* yy[i] = yy[i]*_dg2rad # <<<<<<<<<<<<<<
* if inz is not None:
* ierr = pj_transform(p1.projpj, p2.projpj, npts, 0, xx, yy, zz)
*/
__pyx_4 = PyFloat_FromDouble((__pyx_v_yy[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;}
__pyx_5 = PyNumber_Multiply(__pyx_4, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_yy[__pyx_v_i]) = __pyx_6;
}
goto __pyx_L8;
}
__pyx_L8:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":189
* xx[i] = xx[i]*_dg2rad
* yy[i] = yy[i]*_dg2rad
* if inz is not None: # <<<<<<<<<<<<<<
* ierr = pj_transform(p1.projpj, p2.projpj, npts, 0, xx, yy, zz)
* else:
*/
__pyx_1 = (__pyx_v_inz != Py_None);
if (__pyx_1) {
__pyx_4 = PyInt_FromLong(pj_transform(__pyx_v_p1->projpj,__pyx_v_p2->projpj,__pyx_v_npts,0,__pyx_v_xx,__pyx_v_yy,__pyx_v_zz)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
Py_DECREF(__pyx_v_ierr);
__pyx_v_ierr = __pyx_4;
__pyx_4 = 0;
goto __pyx_L11;
}
/*else*/ {
__pyx_3 = PyInt_FromLong(pj_transform(__pyx_v_p1->projpj,__pyx_v_p2->projpj,__pyx_v_npts,0,__pyx_v_xx,__pyx_v_yy,NULL)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}
Py_DECREF(__pyx_v_ierr);
__pyx_v_ierr = __pyx_3;
__pyx_3 = 0;
}
__pyx_L11:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":193
* else:
* ierr = pj_transform(p1.projpj, p2.projpj, npts, 0, xx, yy, NULL)
* if ierr != 0: # <<<<<<<<<<<<<<
* raise RuntimeError(pj_strerrno(ierr))
* if not radians and p2.is_latlong():
*/
__pyx_5 = PyObject_RichCompare(__pyx_v_ierr, __pyx_num_0, Py_NE); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_5); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
if (__pyx_2) {
__pyx_7 = PyInt_AsLong(__pyx_v_ierr); if (unlikely((__pyx_7 == -1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
__pyx_4 = PyString_FromString(pj_strerrno(__pyx_7)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
__pyx_4 = 0;
__pyx_5 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
__Pyx_Raise(__pyx_5, 0, 0);
Py_DECREF(__pyx_5); __pyx_5 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
goto __pyx_L12;
}
__pyx_L12:;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":195
* if ierr != 0:
* raise RuntimeError(pj_strerrno(ierr))
* if not radians and p2.is_latlong(): # <<<<<<<<<<<<<<
* for i from 0 <= i < npts:
* xx[i] = xx[i]*_rad2dg
*/
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
__pyx_4 = __Pyx_PyBool_FromLong((!__pyx_1)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_4); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
if (__pyx_2) {
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_3 = PyObject_GetAttr(((PyObject *)__pyx_v_p2), __pyx_n_is_latlong); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
__pyx_4 = PyObject_CallObject(__pyx_3, 0); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_4); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
if (__pyx_1) {
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_npts; __pyx_v_i++) {
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":197
* if not radians and p2.is_latlong():
* for i from 0 <= i < npts:
* xx[i] = xx[i]*_rad2dg # <<<<<<<<<<<<<<
* yy[i] = yy[i]*_rad2dg
*/
__pyx_5 = PyFloat_FromDouble((__pyx_v_xx[__pyx_v_i])); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_5, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
(__pyx_v_xx[__pyx_v_i]) = __pyx_6;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":198
* for i from 0 <= i < npts:
* xx[i] = xx[i]*_rad2dg
* yy[i] = yy[i]*_rad2dg # <<<<<<<<<<<<<<
*/
__pyx_5 = PyFloat_FromDouble((__pyx_v_yy[__pyx_v_i])); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_5, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
(__pyx_v_yy[__pyx_v_i]) = __pyx_6;
}
goto __pyx_L13;
}
__pyx_L13:;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
Py_XDECREF(__pyx_5);
__Pyx_AddTraceback("_proj._transform");
__pyx_r = NULL;
__pyx_L0:;
Py_DECREF(__pyx_v_ierr);
Py_DECREF(__pyx_v_p1);
Py_DECREF(__pyx_v_p2);
Py_DECREF(__pyx_v_inx);
Py_DECREF(__pyx_v_iny);
Py_DECREF(__pyx_v_inz);
Py_DECREF(__pyx_v_radians);
return __pyx_r;
}
static __Pyx_InternTabEntry __pyx_intern_tab[] = {
{&__pyx_n_RuntimeError, "RuntimeError"},
{&__pyx_n___cinit__, "__cinit__"},
{&__pyx_n___class__, "__class__"},
{&__pyx_n___dealloc__, "__dealloc__"},
{&__pyx_n___reduce__, "__reduce__"},
{&__pyx_n___version__, "__version__"},
{&__pyx_n__dg2rad, "_dg2rad"},
{&__pyx_n__doublesize, "_doublesize"},
{&__pyx_n__fwd, "_fwd"},
{&__pyx_n__inv, "_inv"},
{&__pyx_n__rad2dg, "_rad2dg"},
{&__pyx_n_append, "append"},
{&__pyx_n_degrees, "degrees"},
{&__pyx_n_is_geocent, "is_geocent"},
{&__pyx_n_is_latlong, "is_latlong"},
{&__pyx_n_iteritems, "iteritems"},
{&__pyx_n_join, "join"},
{&__pyx_n_math, "math"},
{&__pyx_n_radians, "radians"},
{0, 0}
};
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2), 0},
{&__pyx_k7p, __pyx_k7, sizeof(__pyx_k7), 0},
{&__pyx_k8p, __pyx_k8, sizeof(__pyx_k8), 0},
{&__pyx_k9p, __pyx_k9, sizeof(__pyx_k9), 0},
{&__pyx_k10p, __pyx_k10, sizeof(__pyx_k10), 0},
{&__pyx_k11p, __pyx_k11, sizeof(__pyx_k11), 0},
{&__pyx_k12p, __pyx_k12, sizeof(__pyx_k12), 0},
{&__pyx_k13p, __pyx_k13, sizeof(__pyx_k13), 0},
{0, 0, 0, 0}
};
static PyObject *__pyx_tp_new_5_proj_Proj(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_obj_5_proj_Proj *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
p = ((struct __pyx_obj_5_proj_Proj *)o);
p->projparams = Py_None; Py_INCREF(Py_None);
p->proj_version = Py_None; Py_INCREF(Py_None);
p->srs = Py_None; Py_INCREF(Py_None);
if (__pyx_pf_5_proj_4Proj___new__(o, a, k) < 0) {
Py_DECREF(o); o = 0;
}
return o;
}
static void __pyx_tp_dealloc_5_proj_Proj(PyObject *o) {
struct __pyx_obj_5_proj_Proj *p = (struct __pyx_obj_5_proj_Proj *)o;
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++o->ob_refcnt;
__pyx_pf_5_proj_4Proj___dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--o->ob_refcnt;
PyErr_Restore(etype, eval, etb);
}
Py_XDECREF(p->projparams);
Py_XDECREF(p->proj_version);
Py_XDECREF(p->srs);
(*o->ob_type->tp_free)(o);
}
static int __pyx_tp_traverse_5_proj_Proj(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_obj_5_proj_Proj *p = (struct __pyx_obj_5_proj_Proj *)o;
if (p->projparams) {
e = (*v)(p->projparams, a); if (e) return e;
}
if (p->proj_version) {
e = (*v)(p->proj_version, a); if (e) return e;
}
if (p->srs) {
e = (*v)(p->srs, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_5_proj_Proj(PyObject *o) {
struct __pyx_obj_5_proj_Proj *p = (struct __pyx_obj_5_proj_Proj *)o;
Py_XDECREF(p->projparams);
p->projparams = Py_None; Py_INCREF(Py_None);
Py_XDECREF(p->proj_version);
p->proj_version = Py_None; Py_INCREF(Py_None);
Py_XDECREF(p->srs);
p->srs = Py_None; Py_INCREF(Py_None);
return 0;
}
static struct PyMethodDef __pyx_methods_5_proj_Proj[] = {
{"__reduce__", (PyCFunction)__pyx_pf_5_proj_4Proj___reduce__, METH_NOARGS, __pyx_doc_5_proj_4Proj___reduce__},
{"_fwd", (PyCFunction)__pyx_pf_5_proj_4Proj__fwd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_proj_4Proj__fwd},
{"_inv", (PyCFunction)__pyx_pf_5_proj_4Proj__inv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_proj_4Proj__inv},
{"is_latlong", (PyCFunction)__pyx_pf_5_proj_4Proj_is_latlong, METH_NOARGS, 0},
{"is_geocent", (PyCFunction)__pyx_pf_5_proj_4Proj_is_geocent, METH_NOARGS, 0},
{0, 0, 0, 0}
};
static struct PyMemberDef __pyx_members_5_proj_Proj[] = {
{"projparams", T_OBJECT, offsetof(struct __pyx_obj_5_proj_Proj, projparams), 0, 0},
{"proj_version", T_OBJECT, offsetof(struct __pyx_obj_5_proj_Proj, proj_version), 0, 0},
{"srs", T_OBJECT, offsetof(struct __pyx_obj_5_proj_Proj, srs), 0, 0},
{0, 0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_Proj = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
0, /*nb_divide*/
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
0, /*nb_coerce*/
0, /*nb_int*/
0, /*nb_long*/
0, /*nb_float*/
0, /*nb_oct*/
0, /*nb_hex*/
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
0, /*nb_inplace_divide*/
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_Proj = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_Proj = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_Proj = {
0, /*bf_getreadbuffer*/
0, /*bf_getwritebuffer*/
0, /*bf_getsegcount*/
0, /*bf_getcharbuffer*/
};
PyTypeObject __pyx_type_5_proj_Proj = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
"_proj.Proj", /*tp_name*/
sizeof(struct __pyx_obj_5_proj_Proj), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_5_proj_Proj, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
&__pyx_tp_as_number_Proj, /*tp_as_number*/
&__pyx_tp_as_sequence_Proj, /*tp_as_sequence*/
&__pyx_tp_as_mapping_Proj, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_Proj, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_5_proj_Proj, /*tp_traverse*/
__pyx_tp_clear_5_proj_Proj, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_5_proj_Proj, /*tp_methods*/
__pyx_members_5_proj_Proj, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_5_proj_Proj, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
};
static struct PyMethodDef __pyx_methods[] = {
{"set_datapath", (PyCFunction)__pyx_pf_5_proj_set_datapath, METH_O, 0},
{"_transform", (PyCFunction)__pyx_pf_5_proj__transform, METH_VARARGS|METH_KEYWORDS, 0},
{0, 0, 0, 0}
};
static void __pyx_init_filenames(void); /*proto*/
PyMODINIT_FUNC init_proj(void); /*proto*/
PyMODINIT_FUNC init_proj(void) {
PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
/*--- Libary function declarations ---*/
__pyx_init_filenames();
/*--- Module creation code ---*/
__pyx_m = Py_InitModule4("_proj", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
__pyx_b = PyImport_AddModule("__builtin__");
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
/*--- Intern code ---*/
__pyx_num_0 = PyInt_FromLong(0); if (unlikely(!__pyx_num_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
/*--- String init code ---*/
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
/*--- Builtin init code ---*/
__pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
/*--- Global init code ---*/
/*--- Function export code ---*/
/*--- Function import code ---*/
/*--- Type init code ---*/
__pyx_type_5_proj_Proj.tp_free = _PyObject_GC_Del;
if (PyType_Ready(&__pyx_type_5_proj_Proj) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "Proj", (PyObject *)&__pyx_type_5_proj_Proj) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; goto __pyx_L1;}
__pyx_ptype_5_proj_Proj = &__pyx_type_5_proj_Proj;
/*--- Type import code ---*/
/*--- Execution code ---*/
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_pyproj.pxi":17
* PERFORMANCE OF THIS SOFTWARE.
* """
* import math # <<<<<<<<<<<<<<
*
* _dg2rad = math.radians(1.)
*/
__pyx_1 = __Pyx_Import(__pyx_n_math, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n_math, __pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_pyproj.pxi":19
* import math
*
* _dg2rad = math.radians(1.) # <<<<<<<<<<<<<<
* _rad2dg = math.degrees(1.)
* _doublesize = sizeof(double)
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_math); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; goto __pyx_L1;}
__pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_radians); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_1 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
__pyx_1 = 0;
__pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n__dg2rad, __pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_pyproj.pxi":20
*
* _dg2rad = math.radians(1.)
* _rad2dg = math.degrees(1.) # <<<<<<<<<<<<<<
* _doublesize = sizeof(double)
* __version__ = "1.8.3"
*/
__pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_math); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;}
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_degrees); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_1 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
__pyx_1 = 0;
__pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n__rad2dg, __pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_pyproj.pxi":21
* _dg2rad = math.radians(1.)
* _rad2dg = math.degrees(1.)
* _doublesize = sizeof(double) # <<<<<<<<<<<<<<
* __version__ = "1.8.3"
*
*/
__pyx_3 = PyInt_FromLong((sizeof(double))); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n__doublesize, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_pyproj.pxi":22
* _rad2dg = math.degrees(1.)
* _doublesize = sizeof(double)
* __version__ = "1.8.3" # <<<<<<<<<<<<<<
*
* cdef extern from "stdlib.h":
*/
if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k2p) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; goto __pyx_L1;}
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":55
* return (self.__class__,(self.projparams,))
*
* def _fwd(self, object lons, object lats, radians=False, errcheck=False): # <<<<<<<<<<<<<<
* """
* forward transformation - lons,lats to x,y (done in place).
*/
Py_INCREF(Py_False);
__pyx_k3 = Py_False;
Py_INCREF(Py_False);
__pyx_k4 = Py_False;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":100
* latsdata[i] = projxyout.v
*
* def _inv(self, object x, object y, radians=False, errcheck=False): # <<<<<<<<<<<<<<
* """
* inverse transformation - x,y to lons,lats (done in place).
*/
Py_INCREF(Py_False);
__pyx_k5 = Py_False;
Py_INCREF(Py_False);
__pyx_k6 = Py_False;
/* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_proj.pyx":164
* return False
*
* def _transform(Proj p1, Proj p2, inx, iny, inz, radians): # <<<<<<<<<<<<<<
* # private function to call pj_transform
* cdef void *xdata, *ydata, *zdata
*/
if (__Pyx_RegisterCleanup()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
return;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("_proj");
}
static PyObject* cleanup(PyObject *self, PyObject *unused) {
/*--- Builtin cleanup code ---*/
Py_DECREF(__pyx_builtin_RuntimeError); __pyx_builtin_RuntimeError = 0;
/*--- Intern cleanup code ---*/
Py_DECREF(__pyx_num_0); __pyx_num_0 = 0;
Py_DECREF(__pyx_n__doublesize); __pyx_n__doublesize = 0;
Py_DECREF(__pyx_n_is_latlong); __pyx_n_is_latlong = 0;
Py_DECREF(__pyx_n___version__); __pyx_n___version__ = 0;
Py_DECREF(__pyx_n__inv); __pyx_n__inv = 0;
Py_DECREF(__pyx_n_join); __pyx_n_join = 0;
Py_DECREF(__pyx_n_is_geocent); __pyx_n_is_geocent = 0;
Py_DECREF(__pyx_n___reduce__); __pyx_n___reduce__ = 0;
Py_DECREF(__pyx_n_radians); __pyx_n_radians = 0;
Py_DECREF(__pyx_n___class__); __pyx_n___class__ = 0;
Py_DECREF(__pyx_n__dg2rad); __pyx_n__dg2rad = 0;
Py_DECREF(__pyx_n__fwd); __pyx_n__fwd = 0;
Py_DECREF(__pyx_n___cinit__); __pyx_n___cinit__ = 0;
Py_DECREF(__pyx_n_append); __pyx_n_append = 0;
Py_DECREF(__pyx_n__rad2dg); __pyx_n__rad2dg = 0;
Py_DECREF(__pyx_n_iteritems); __pyx_n_iteritems = 0;
Py_DECREF(__pyx_n_degrees); __pyx_n_degrees = 0;
Py_DECREF(__pyx_n___dealloc__); __pyx_n___dealloc__ = 0;
Py_DECREF(__pyx_n_RuntimeError); __pyx_n_RuntimeError = 0;
Py_DECREF(__pyx_n_math); __pyx_n_math = 0;
Py_INCREF(Py_None); return Py_None;
}
static char *__pyx_filenames[] = {
"_proj.pyx",
"_pyproj.pxi",
};
/* Runtime support code */
static void __pyx_init_filenames(void) {
__pyx_f = __pyx_filenames;
}
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name) {
if (!type) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if ((none_allowed && obj == Py_None) || PyObject_TypeCheck(obj, type))
return 1;
PyErr_Format(PyExc_TypeError,
"Argument '%s' has incorrect type (expected %s, got %s)",
name, type->tp_name, obj->ob_type->tp_name);
return 0;
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
PyObject *__import__ = 0;
PyObject *empty_list = 0;
PyObject *module = 0;
PyObject *global_dict = 0;
PyObject *empty_dict = 0;
PyObject *list;
__import__ = PyObject_GetAttrString(__pyx_b, "__import__");
if (!__import__)
goto bad;
if (from_list)
list = from_list;
else {
empty_list = PyList_New(0);
if (!empty_list)
goto bad;
list = empty_list;
}
global_dict = PyModule_GetDict(__pyx_m);
if (!global_dict)
goto bad;
empty_dict = PyDict_New();
if (!empty_dict)
goto bad;
module = PyObject_CallFunction(__import__, "OOOO",
name, global_dict, empty_dict, list);
bad:
Py_XDECREF(empty_list);
Py_XDECREF(__import__);
Py_XDECREF(empty_dict);
return module;
}
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
PyObject *result;
result = PyObject_GetAttr(dict, name);
if (!result)
PyErr_SetObject(PyExc_NameError, name);
return result;
}
static void __Pyx_UnpackError(void) {
PyErr_SetString(PyExc_ValueError, "unpack sequence of wrong size");
}
static PyObject *__Pyx_UnpackItem(PyObject *iter) {
PyObject *item;
if (!(item = PyIter_Next(iter))) {
if (!PyErr_Occurred())
__Pyx_UnpackError();
}
return item;
}
static int __Pyx_EndUnpack(PyObject *iter) {
PyObject *item;
if ((item = PyIter_Next(iter))) {
Py_DECREF(item);
__Pyx_UnpackError();
return -1;
}
else if (!PyErr_Occurred())
return 0;
else
return -1;
}
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
Py_XINCREF(type);
Py_XINCREF(value);
Py_XINCREF(tb);
/* First, check the traceback argument, replacing None with NULL. */
if (tb == Py_None) {
Py_DECREF(tb);
tb = 0;
}
else if (tb != NULL && !PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto raise_error;
}
/* Next, replace a missing value with None */
if (value == NULL) {
value = Py_None;
Py_INCREF(value);
}
#if PY_VERSION_HEX < 0x02050000
if (!PyClass_Check(type))
#else
if (!PyType_Check(type))
#endif
{
/* Raising an instance. The value should be a dummy. */
if (value != Py_None) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto raise_error;
}
/* Normalize to raise <class>, <instance> */
Py_DECREF(value);
value = type;
#if PY_VERSION_HEX < 0x02050000
if (PyInstance_Check(type)) {
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
Py_INCREF(type);
}
else {
PyErr_SetString(PyExc_TypeError,
"raise: exception must be an old-style class or instance");
goto raise_error;
}
#else
type = (PyObject*) type->ob_type;
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
#endif
}
PyErr_Restore(type, value, tb);
return;
raise_error:
Py_XDECREF(value);
Py_XDECREF(type);
Py_XDECREF(tb);
return;
}
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
while (t->p) {
*t->p = PyString_InternFromString(t->s);
if (!*t->p)
return -1;
++t;
}
return 0;
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
if (!*t->p)
return -1;
++t;
}
return 0;
}
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static void __Pyx_AddTraceback(char *funcname) {
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
PyObject *py_globals = 0;
PyObject *empty_tuple = 0;
PyObject *empty_string = 0;
PyCodeObject *py_code = 0;
PyFrameObject *py_frame = 0;
py_srcfile = PyString_FromString(__pyx_filename);
if (!py_srcfile) goto bad;
py_funcname = PyString_FromString(funcname);
if (!py_funcname) goto bad;
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) goto bad;
empty_tuple = PyTuple_New(0);
if (!empty_tuple) goto bad;
empty_string = PyString_FromString("");
if (!empty_string) goto bad;
py_code = PyCode_New(
0, /*int argcount,*/
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
empty_string, /*PyObject *code,*/
empty_tuple, /*PyObject *consts,*/
empty_tuple, /*PyObject *names,*/
empty_tuple, /*PyObject *varnames,*/
empty_tuple, /*PyObject *freevars,*/
empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
__pyx_lineno, /*int firstlineno,*/
empty_string /*PyObject *lnotab*/
);
if (!py_code) goto bad;
py_frame = PyFrame_New(
PyThreadState_Get(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
py_globals, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = __pyx_lineno;
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
Py_XDECREF(empty_tuple);
Py_XDECREF(empty_string);
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(char *name) {
PyObject *py_name = 0;
PyObject *py_module = 0;
py_name = PyString_FromString(name);
if (!py_name)
goto bad;
py_module = PyImport_Import(py_name);
Py_DECREF(py_name);
return py_module;
bad:
Py_XDECREF(py_name);
return 0;
}
#endif
static int __Pyx_RegisterCleanup() {
/* Don't use Py_AtExit because that has a 32-call limit
* and is called after python finalization.
*/
PyObject *cleanup_func = 0;
PyObject *atexit = 0;
PyObject *reg = 0;
PyObject *args = 0;
PyObject *res = 0;
int ret = -1;
cleanup_func = PyCFunction_New(&cleanup_def, 0);
args = PyTuple_New(1);
if (!cleanup_func || !args)
goto bad;
PyTuple_SET_ITEM(args, 0, cleanup_func);
cleanup_func = 0;
atexit = __Pyx_ImportModule("atexit");
if (!atexit)
goto bad;
reg = PyObject_GetAttrString(atexit, "register");
if (!reg)
goto bad;
res = PyObject_CallObject(reg, args);
if (!res)
goto bad;
ret = 0;
bad:
Py_XDECREF(cleanup_func);
Py_XDECREF(atexit);
Py_XDECREF(reg);
Py_XDECREF(args);
Py_XDECREF(res);
return ret;
}