/* Generated by Cython 0.9.6.14 on Fri May 23 15:52:15 2008 */
#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
#if PY_VERSION_HEX < 0x02040000
#define METH_COEXIST 0
#endif
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#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"
#include "numpy/arrayobject.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 int __pyx_skip_dispatch = 0;
/* Type Conversion Predeclarations */
#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);
static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x);
static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x);
static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b);
#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x))
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x);
static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x);
static INLINE char __pyx_PyInt_char(PyObject* x);
static INLINE short __pyx_PyInt_short(PyObject* x);
static INLINE int __pyx_PyInt_int(PyObject* x);
static INLINE long __pyx_PyInt_long(PyObject* x);
static INLINE signed char __pyx_PyInt_signed_char(PyObject* x);
static INLINE signed short __pyx_PyInt_signed_short(PyObject* x);
static INLINE signed int __pyx_PyInt_signed_int(PyObject* x);
static INLINE signed long __pyx_PyInt_signed_long(PyObject* x);
static INLINE long double __pyx_PyInt_long_double(PyObject* x);
#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 PyObject *__pyx_empty_tuple;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static char * __pyx_cfilenm= __FILE__;
static char *__pyx_filename;
static char **__pyx_f;
static INLINE void __Pyx_RaiseArgtupleTooLong(Py_ssize_t num_expected, Py_ssize_t num_found); /*proto*/
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*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 PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
static PyObject *__Pyx_ImportModule(char *name); /*proto*/
static void __Pyx_AddTraceback(char *funcname); /*proto*/
/* Declarations */
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":12
* pj_set_searchpath(1, &searchpath)
*
* cdef class Proj: # <<<<<<<<<<<<<<
* cdef projPJ projpj
* cdef public object proj_version
*/
struct __pyx_obj_5_proj_Proj {
PyObject_HEAD
projPJ projpj;
PyObject *proj_version;
char *pjinitstring;
PyObject *srs;
};
static PyTypeObject *__pyx_ptype_7c_numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_7c_numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_7c_numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_7c_numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5_proj_Proj = 0;
/* Implementation of _proj */
static char __pyx_k_2[] = "1.8.5";
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__fwdn;
static PyObject *__pyx_n__invn;
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_k_2p;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":7
* c_numpy.import_array()
*
* def set_datapath(datapath): # <<<<<<<<<<<<<<
* cdef char *searchpath
* searchpath = PyString_AsString(datapath)
*/
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;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":9
* def set_datapath(datapath):
* cdef char *searchpath
* searchpath = PyString_AsString(datapath) # <<<<<<<<<<<<<<
* pj_set_searchpath(1, &searchpath)
*
*/
__pyx_v_searchpath = PyString_AsString(__pyx_v_datapath);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":10
* 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);
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":18
* cdef public object srs
*
* def __new__(self, projstring): # <<<<<<<<<<<<<<
* # setup proj initialization string.
* self.srs = projstring
*/
static PyObject *__pyx_n_RuntimeError;
static PyObject *__pyx_builtin_RuntimeError;
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_projstring = 0;
int __pyx_r;
int __pyx_1;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
static char *__pyx_argnames[] = {"projstring",0};
if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 1)) {
__pyx_v_projstring = PyTuple_GET_ITEM(__pyx_args, 0);
}
else {
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_projstring))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
__Pyx_AddTraceback("_proj.Proj.__cinit__");
return -1;
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":20
* def __new__(self, projstring):
* # setup proj initialization string.
* self.srs = projstring # <<<<<<<<<<<<<<
* self.pjinitstring = PyString_AsString(self.srs)
* # initialize projection
*/
Py_INCREF(__pyx_v_projstring);
Py_DECREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs);
((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs = __pyx_v_projstring;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":21
* # setup proj initialization string.
* self.srs = projstring
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":23
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":24
* # 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_1 = (pj_errno != 0);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":25
* self.projpj = pj_init_plus(self.pjinitstring)
* if pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<<
* self.proj_version = PJ_VERSION/100.
*
*/
__pyx_2 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
__pyx_2 = 0;
__pyx_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
__Pyx_Raise(__pyx_2, 0, 0);
Py_DECREF(__pyx_2); __pyx_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":26
* if pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno))
* self.proj_version = PJ_VERSION/100. # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
__pyx_3 = PyFloat_FromDouble((PJ_VERSION / 100.)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; 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_3;
__pyx_3 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("_proj.Proj.__cinit__");
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":28
* self.proj_version = PJ_VERSION/100.
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* """destroy projection definition"""
* pj_free(self.projpj)
*/
static void __pyx_pf_5_proj_4Proj___dealloc__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_5_proj_4Proj___dealloc__[] = "destroy projection definition";
static void __pyx_pf_5_proj_4Proj___dealloc__(PyObject *__pyx_v_self) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":30
* def __dealloc__(self):
* """destroy projection definition"""
* pj_free(self.projpj) # <<<<<<<<<<<<<<
*
* def __reduce__(self):
*/
pj_free(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projpj);
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":32
* pj_free(self.projpj)
*
* def __reduce__(self): # <<<<<<<<<<<<<<
* """special method that allows pyproj.Proj instance to be pickled"""
* return (self.__class__,(self.srs,))
*/
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;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":34
* def __reduce__(self):
* """special method that allows pyproj.Proj instance to be pickled"""
* return (self.__class__,(self.srs,)) # <<<<<<<<<<<<<<
*
* def _fwd(self, object lons, object lats, radians=False, errcheck=False):
*/
__pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs);
PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs);
__pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
PyTuple_SET_ITEM(__pyx_3, 1, ((PyObject *)__pyx_2));
__pyx_1 = 0;
__pyx_2 = 0;
__pyx_r = ((PyObject *)__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:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":36
* return (self.__class__,(self.srs,))
*
* def _fwd(self, object lons, object lats, radians=False, errcheck=False): # <<<<<<<<<<<<<<
* """
* forward transformation - lons,lats to x,y (done in place).
*/
static PyObject *__pyx_k_3p;
static char __pyx_k_3[] = "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 = 0;
double __pyx_6;
static char *__pyx_argnames[] = {"lons","lats","radians","errcheck",0};
__pyx_v_radians = Py_False;
__pyx_v_errcheck = Py_False;
if (likely(!__pyx_kwds) && likely(2 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 4)) {
__pyx_v_lons = PyTuple_GET_ITEM(__pyx_args, 0);
__pyx_v_lats = PyTuple_GET_ITEM(__pyx_args, 1);
if (PyTuple_GET_SIZE(__pyx_args) > 2) {
__pyx_v_radians = PyTuple_GET_ITEM(__pyx_args, 2);
if (PyTuple_GET_SIZE(__pyx_args) > 3) {
__pyx_v_errcheck = PyTuple_GET_ITEM(__pyx_args, 3);
}
}
}
else {
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|OO", __pyx_argnames, &__pyx_v_lons, &__pyx_v_lats, &__pyx_v_radians, &__pyx_v_errcheck))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
__Pyx_AddTraceback("_proj.Proj._fwd");
return NULL;
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":50
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":51
* # 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:
* raise RuntimeError
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":52
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":53
* raise RuntimeError
* if PyObject_AsWriteBuffer(lats, &latdata, &bufleny) <> 0:
* raise RuntimeError # <<<<<<<<<<<<<<
* # process data in buffer
* if buflenx != bufleny:
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L5;
}
__pyx_L5:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":55
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":56
* # process data in buffer
* if buflenx != bufleny:
* raise RuntimeError("Buffer lengths not the same") # <<<<<<<<<<<<<<
* ndim = buflenx/_doublesize
* lonsdata = <double *>londata
*/
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_k_3p);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k_3p);
__pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__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 = 56; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L6;
}
__pyx_L6:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":57
* 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 = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__doublesize); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Divide(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; 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 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_ndim = __pyx_5;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":58
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":59
* ndim = buflenx/_doublesize
* lonsdata = <double *>londata
* latsdata = <double *>latdata # <<<<<<<<<<<<<<
* for i from 0 <= i < ndim:
* if radians:
*/
__pyx_v_latsdata = ((double *)__pyx_v_latdata);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":60
* 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++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":61
* 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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":62
* 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]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":63
* 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_L9;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":65
* 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 = 65; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyFloat_FromDouble((__pyx_v_lonsdata[__pyx_v_i])); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_projlonlatin.u = __pyx_6;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":66
* 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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyFloat_FromDouble((__pyx_v_latsdata[__pyx_v_i])); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_projlonlatin.v = __pyx_6;
}
__pyx_L9:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":67
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":68
* 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 = 68; __pyx_clineno = __LINE__; 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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1;}
}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":69
* projxyout = pj_fwd(projlonlatin,self.projpj)
* if errcheck and pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<<
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
*/
__pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
__pyx_3 = 0;
__pyx_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L10;
}
__pyx_L10:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":72
* # 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":73
* # change it to a real (but very large) number.
* if projxyout.u == HUGE_VAL:
* lonsdata[i] = 1.e30 # <<<<<<<<<<<<<<
* else:
* lonsdata[i] = projxyout.u
*/
(__pyx_v_lonsdata[__pyx_v_i]) = 1.e30;
goto __pyx_L11;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":75
* lonsdata[i] = 1.e30
* else:
* lonsdata[i] = projxyout.u # <<<<<<<<<<<<<<
* if projxyout.v == HUGE_VAL:
* latsdata[i] = 1.e30
*/
(__pyx_v_lonsdata[__pyx_v_i]) = __pyx_v_projxyout.u;
}
__pyx_L11:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":76
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":77
* lonsdata[i] = projxyout.u
* if projxyout.v == HUGE_VAL:
* latsdata[i] = 1.e30 # <<<<<<<<<<<<<<
* else:
* latsdata[i] = projxyout.v
*/
(__pyx_v_latsdata[__pyx_v_i]) = 1.e30;
goto __pyx_L12;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":79
* latsdata[i] = 1.e30
* else:
* latsdata[i] = projxyout.v # <<<<<<<<<<<<<<
*
* def _inv(self, object x, object y, radians=False, errcheck=False):
*/
(__pyx_v_latsdata[__pyx_v_i]) = __pyx_v_projxyout.v;
}
__pyx_L12:;
}
__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:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":81
* 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).
*/
static PyObject *__pyx_k_4p;
static char __pyx_k_4[] = "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 = 0;
double __pyx_6;
static char *__pyx_argnames[] = {"x","y","radians","errcheck",0};
__pyx_v_radians = Py_False;
__pyx_v_errcheck = Py_False;
if (likely(!__pyx_kwds) && likely(2 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 4)) {
__pyx_v_x = PyTuple_GET_ITEM(__pyx_args, 0);
__pyx_v_y = PyTuple_GET_ITEM(__pyx_args, 1);
if (PyTuple_GET_SIZE(__pyx_args) > 2) {
__pyx_v_radians = PyTuple_GET_ITEM(__pyx_args, 2);
if (PyTuple_GET_SIZE(__pyx_args) > 3) {
__pyx_v_errcheck = PyTuple_GET_ITEM(__pyx_args, 3);
}
}
}
else {
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|OO", __pyx_argnames, &__pyx_v_x, &__pyx_v_y, &__pyx_v_radians, &__pyx_v_errcheck))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
__Pyx_AddTraceback("_proj.Proj._inv");
return NULL;
__pyx_L3:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":95
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":96
* # 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:
* raise RuntimeError
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":97
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":98
* raise RuntimeError
* if PyObject_AsWriteBuffer(y, &ydata, &bufleny) <> 0:
* raise RuntimeError # <<<<<<<<<<<<<<
* # process data in buffer
* # (for numpy/regular python arrays).
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L5;
}
__pyx_L5:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":101
* # 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":102
* # (for numpy/regular python arrays).
* if buflenx != bufleny:
* raise RuntimeError("Buffer lengths not the same") # <<<<<<<<<<<<<<
* ndim = buflenx/_doublesize
* xdatab = <double *>xdata
*/
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_k_4p);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k_4p);
__pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L6;
}
__pyx_L6:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":103
* 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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__doublesize); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Divide(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; 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 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_ndim = __pyx_5;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":104
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":105
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":106
* 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++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":107
* 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]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":108
* 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]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":109
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":110
* 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 = 110; __pyx_clineno = __LINE__; 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 = 110; __pyx_clineno = __LINE__; goto __pyx_L1;}
}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":111
* projlonlatout = pj_inv(projxyin,self.projpj)
* if errcheck and pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<<
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
*/
__pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
__pyx_3 = 0;
__pyx_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__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 = 111; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L9;
}
__pyx_L9:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":114
* # 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":115
* # change it to a real (but very large) number.
* if projlonlatout.u == HUGE_VAL:
* xdatab[i] = 1.e30 # <<<<<<<<<<<<<<
* elif radians:
* xdatab[i] = projlonlatout.u
*/
(__pyx_v_xdatab[__pyx_v_i]) = 1.e30;
goto __pyx_L10;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":116
* if projlonlatout.u == HUGE_VAL:
* xdatab[i] = 1.e30
* elif radians: # <<<<<<<<<<<<<<
* xdatab[i] = projlonlatout.u
* else:
*/
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":117
* xdatab[i] = 1.e30
* elif radians:
* xdatab[i] = projlonlatout.u # <<<<<<<<<<<<<<
* else:
* xdatab[i] = _rad2dg*projlonlatout.u
*/
(__pyx_v_xdatab[__pyx_v_i]) = __pyx_v_projlonlatout.u;
goto __pyx_L10;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":119
* xdatab[i] = projlonlatout.u
* else:
* xdatab[i] = _rad2dg*projlonlatout.u # <<<<<<<<<<<<<<
* if projlonlatout.v == HUGE_VAL:
* ydatab[i] = 1.e30
*/
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyFloat_FromDouble(__pyx_v_projlonlatout.u); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_6 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_xdatab[__pyx_v_i]) = __pyx_6;
}
__pyx_L10:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":120
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":121
* xdatab[i] = _rad2dg*projlonlatout.u
* if projlonlatout.v == HUGE_VAL:
* ydatab[i] = 1.e30 # <<<<<<<<<<<<<<
* elif radians:
* ydatab[i] = projlonlatout.v
*/
(__pyx_v_ydatab[__pyx_v_i]) = 1.e30;
goto __pyx_L11;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":122
* if projlonlatout.v == HUGE_VAL:
* ydatab[i] = 1.e30
* elif radians: # <<<<<<<<<<<<<<
* ydatab[i] = projlonlatout.v
* else:
*/
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":123
* ydatab[i] = 1.e30
* elif radians:
* ydatab[i] = projlonlatout.v # <<<<<<<<<<<<<<
* else:
* ydatab[i] = _rad2dg*projlonlatout.v
*/
(__pyx_v_ydatab[__pyx_v_i]) = __pyx_v_projlonlatout.v;
goto __pyx_L11;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":125
* ydatab[i] = projlonlatout.v
* else:
* ydatab[i] = _rad2dg*projlonlatout.v # <<<<<<<<<<<<<<
*
* def _fwdn(self, c_numpy.ndarray lonlat, radians=False, errcheck=False):
*/
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyFloat_FromDouble(__pyx_v_projlonlatout.v); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_6 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
(__pyx_v_ydatab[__pyx_v_i]) = __pyx_6;
}
__pyx_L11:;
}
__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:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":127
* ydatab[i] = _rad2dg*projlonlatout.v
*
* def _fwdn(self, c_numpy.ndarray lonlat, radians=False, errcheck=False): # <<<<<<<<<<<<<<
* """
* forward transformation - lons,lats to x,y (done in place).
*/
static PyObject *__pyx_pf_5_proj_4Proj__fwdn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_proj_4Proj__fwdn[] = "\n forward transformation - lons,lats to x,y (done in place).\n Uses ndarray of shape ...,2.\n if radians=True, lons/lats are radians instead of degrees.\n if errcheck=True, an exception is raised if the forward\n transformation is invalid.\n if errcheck=False and the forward transformation is\n invalid, no exception is\n raised and 1.e30 is returned.\n ";
static PyObject *__pyx_pf_5_proj_4Proj__fwdn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyArrayObject *__pyx_v_lonlat = 0;
PyObject *__pyx_v_radians = 0;
PyObject *__pyx_v_errcheck = 0;
projUV __pyx_v_projxyout;
projUV __pyx_v_projlonlatin;
projUV *__pyx_v_llptr;
Py_ssize_t __pyx_v_npts;
Py_ssize_t __pyx_v_i;
PyObject *__pyx_r;
int __pyx_1;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
double __pyx_5;
static char *__pyx_argnames[] = {"lonlat","radians","errcheck",0};
__pyx_v_radians = Py_False;
__pyx_v_errcheck = Py_False;
if (likely(!__pyx_kwds) && likely(1 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 3)) {
__pyx_v_lonlat = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
if (PyTuple_GET_SIZE(__pyx_args) > 1) {
__pyx_v_radians = PyTuple_GET_ITEM(__pyx_args, 1);
if (PyTuple_GET_SIZE(__pyx_args) > 2) {
__pyx_v_errcheck = PyTuple_GET_ITEM(__pyx_args, 2);
}
}
}
else {
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|OO", __pyx_argnames, &__pyx_v_lonlat, &__pyx_v_radians, &__pyx_v_errcheck))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
__Pyx_AddTraceback("_proj.Proj._fwdn");
return NULL;
__pyx_L3:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lonlat), __pyx_ptype_7c_numpy_ndarray, 1, "lonlat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":141
* cdef projUV *llptr
* cdef Py_ssize_t npts, i
* npts = c_numpy.PyArray_SIZE(lonlat)//2 # <<<<<<<<<<<<<<
* llptr = <projUV *>lonlat.data
* for i from 0 <= i < npts:
*/
__pyx_v_npts = (PyArray_SIZE(__pyx_v_lonlat) / 2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":142
* cdef Py_ssize_t npts, i
* npts = c_numpy.PyArray_SIZE(lonlat)//2
* llptr = <projUV *>lonlat.data # <<<<<<<<<<<<<<
* for i from 0 <= i < npts:
* if radians:
*/
__pyx_v_llptr = ((projUV *)__pyx_v_lonlat->data);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":143
* npts = c_numpy.PyArray_SIZE(lonlat)//2
* llptr = <projUV *>lonlat.data
* for i from 0 <= i < npts: # <<<<<<<<<<<<<<
* if radians:
* projlonlatin = llptr[i]
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_npts; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":144
* llptr = <projUV *>lonlat.data
* for i from 0 <= i < npts:
* if radians: # <<<<<<<<<<<<<<
* projlonlatin = llptr[i]
* else:
*/
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":145
* for i from 0 <= i < npts:
* if radians:
* projlonlatin = llptr[i] # <<<<<<<<<<<<<<
* else:
* projlonlatin.u = _dg2rad*llptr[i].u
*/
__pyx_v_projlonlatin = (__pyx_v_llptr[__pyx_v_i]);
goto __pyx_L6;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":147
* projlonlatin = llptr[i]
* else:
* projlonlatin.u = _dg2rad*llptr[i].u # <<<<<<<<<<<<<<
* projlonlatin.v = _dg2rad*llptr[i].v
* 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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyFloat_FromDouble((__pyx_v_llptr[__pyx_v_i]).u); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_5 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_projlonlatin.u = __pyx_5;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":148
* else:
* projlonlatin.u = _dg2rad*llptr[i].u
* projlonlatin.v = _dg2rad*llptr[i].v # <<<<<<<<<<<<<<
* 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 = 148; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyFloat_FromDouble((__pyx_v_llptr[__pyx_v_i]).v); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_5 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
__pyx_v_projlonlatin.v = __pyx_5;
}
__pyx_L6:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":149
* projlonlatin.u = _dg2rad*llptr[i].u
* projlonlatin.v = _dg2rad*llptr[i].v
* projxyout = pj_fwd(projlonlatin,self.projpj) # <<<<<<<<<<<<<<
*
* if errcheck and pj_errno != 0:
*/
__pyx_v_projxyout = pj_fwd(__pyx_v_projlonlatin, ((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projpj);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":151
* 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 = 151; __pyx_clineno = __LINE__; 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 = 151; __pyx_clineno = __LINE__; goto __pyx_L1;}
}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":152
*
* if errcheck and pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<<
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
*/
__pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
__pyx_3 = 0;
__pyx_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__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 = 152; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L7;
}
__pyx_L7:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":155
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
* if projxyout.u == HUGE_VAL: # <<<<<<<<<<<<<<
* llptr[i].u = 1.e30
* else:
*/
__pyx_1 = (__pyx_v_projxyout.u == HUGE_VAL);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":156
* # change it to a real (but very large) number.
* if projxyout.u == HUGE_VAL:
* llptr[i].u = 1.e30 # <<<<<<<<<<<<<<
* else:
* llptr[i].u = projxyout.u
*/
(__pyx_v_llptr[__pyx_v_i]).u = 1.e30;
goto __pyx_L8;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":158
* llptr[i].u = 1.e30
* else:
* llptr[i].u = projxyout.u # <<<<<<<<<<<<<<
* if projxyout.v == HUGE_VAL:
* llptr[i].u = 1.e30
*/
(__pyx_v_llptr[__pyx_v_i]).u = __pyx_v_projxyout.u;
}
__pyx_L8:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":159
* else:
* llptr[i].u = projxyout.u
* if projxyout.v == HUGE_VAL: # <<<<<<<<<<<<<<
* llptr[i].u = 1.e30
* else:
*/
__pyx_1 = (__pyx_v_projxyout.v == HUGE_VAL);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":160
* llptr[i].u = projxyout.u
* if projxyout.v == HUGE_VAL:
* llptr[i].u = 1.e30 # <<<<<<<<<<<<<<
* else:
* llptr[i].v = projxyout.v
*/
(__pyx_v_llptr[__pyx_v_i]).u = 1.e30;
goto __pyx_L9;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":162
* llptr[i].u = 1.e30
* else:
* llptr[i].v = projxyout.v # <<<<<<<<<<<<<<
*
* def _invn(self, c_numpy.ndarray xy, radians=False, errcheck=False):
*/
(__pyx_v_llptr[__pyx_v_i]).v = __pyx_v_projxyout.v;
}
__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._fwdn");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":164
* llptr[i].v = projxyout.v
*
* def _invn(self, c_numpy.ndarray xy, radians=False, errcheck=False): # <<<<<<<<<<<<<<
* """
* inverse transformation - x,y to lons,lats (done in place).
*/
static PyObject *__pyx_pf_5_proj_4Proj__invn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_proj_4Proj__invn[] = "\n inverse transformation - x,y to lons,lats (done in place).\n Uses ndarray of shape ...,2.\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__invn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyArrayObject *__pyx_v_xy = 0;
PyObject *__pyx_v_radians = 0;
PyObject *__pyx_v_errcheck = 0;
projUV __pyx_v_projxyin;
projUV __pyx_v_projlonlatout;
projUV *__pyx_v_llptr;
Py_ssize_t __pyx_v_npts;
Py_ssize_t __pyx_v_i;
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
int __pyx_2;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
double __pyx_5;
static char *__pyx_argnames[] = {"xy","radians","errcheck",0};
__pyx_v_radians = Py_False;
__pyx_v_errcheck = Py_False;
if (likely(!__pyx_kwds) && likely(1 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 3)) {
__pyx_v_xy = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
if (PyTuple_GET_SIZE(__pyx_args) > 1) {
__pyx_v_radians = PyTuple_GET_ITEM(__pyx_args, 1);
if (PyTuple_GET_SIZE(__pyx_args) > 2) {
__pyx_v_errcheck = PyTuple_GET_ITEM(__pyx_args, 2);
}
}
}
else {
if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|OO", __pyx_argnames, &__pyx_v_xy, &__pyx_v_radians, &__pyx_v_errcheck))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
__Pyx_AddTraceback("_proj.Proj._invn");
return NULL;
__pyx_L3:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xy), __pyx_ptype_7c_numpy_ndarray, 1, "xy", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":176
* cdef projUV *llptr
* cdef Py_ssize_t npts, i
* npts = c_numpy.PyArray_SIZE(xy)//2 # <<<<<<<<<<<<<<
* llptr = <projUV *>xy.data
*
*/
__pyx_v_npts = (PyArray_SIZE(__pyx_v_xy) / 2);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":177
* cdef Py_ssize_t npts, i
* npts = c_numpy.PyArray_SIZE(xy)//2
* llptr = <projUV *>xy.data # <<<<<<<<<<<<<<
*
* for i from 0 <= i < npts:
*/
__pyx_v_llptr = ((projUV *)__pyx_v_xy->data);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":179
* llptr = <projUV *>xy.data
*
* for i from 0 <= i < npts: # <<<<<<<<<<<<<<
* projxyin = llptr[i]
* projlonlatout = pj_inv(projxyin, self.projpj)
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_npts; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":180
*
* for i from 0 <= i < npts:
* projxyin = llptr[i] # <<<<<<<<<<<<<<
* projlonlatout = pj_inv(projxyin, self.projpj)
* if errcheck and pj_errno != 0:
*/
__pyx_v_projxyin = (__pyx_v_llptr[__pyx_v_i]);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":181
* for i from 0 <= i < npts:
* projxyin = llptr[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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":182
* projxyin = llptr[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_1 = __pyx_v_errcheck;
Py_INCREF(__pyx_1);
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_2) {
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_1 = __Pyx_PyBool_FromLong((pj_errno != 0)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
}
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
if (__pyx_2) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":183
* projlonlatout = pj_inv(projxyin, self.projpj)
* if errcheck and pj_errno != 0:
* raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<<
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
*/
__pyx_1 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
__pyx_1 = 0;
__pyx_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
__Pyx_Raise(__pyx_1, 0, 0);
Py_DECREF(__pyx_1); __pyx_1 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L6;
}
__pyx_L6:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":186
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
* if projlonlatout.u == HUGE_VAL: # <<<<<<<<<<<<<<
* llptr[i].u = 1.e30
* elif radians:
*/
__pyx_2 = (__pyx_v_projlonlatout.u == HUGE_VAL);
if (__pyx_2) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":187
* # change it to a real (but very large) number.
* if projlonlatout.u == HUGE_VAL:
* llptr[i].u = 1.e30 # <<<<<<<<<<<<<<
* elif radians:
* llptr[i].u = projlonlatout.u
*/
(__pyx_v_llptr[__pyx_v_i]).u = 1.e30;
goto __pyx_L7;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":188
* if projlonlatout.u == HUGE_VAL:
* llptr[i].u = 1.e30
* elif radians: # <<<<<<<<<<<<<<
* llptr[i].u = projlonlatout.u
* else:
*/
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_2) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":189
* llptr[i].u = 1.e30
* elif radians:
* llptr[i].u = projlonlatout.u # <<<<<<<<<<<<<<
* else:
* llptr[i].u = _rad2dg*projlonlatout.u
*/
(__pyx_v_llptr[__pyx_v_i]).u = __pyx_v_projlonlatout.u;
goto __pyx_L7;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":191
* llptr[i].u = projlonlatout.u
* else:
* llptr[i].u = _rad2dg*projlonlatout.u # <<<<<<<<<<<<<<
* if projlonlatout.v == HUGE_VAL:
* llptr[i].v = 1.e30
*/
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_1 = PyFloat_FromDouble(__pyx_v_projlonlatout.u); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_3, __pyx_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_5 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
(__pyx_v_llptr[__pyx_v_i]).u = __pyx_5;
}
__pyx_L7:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":192
* else:
* llptr[i].u = _rad2dg*projlonlatout.u
* if projlonlatout.v == HUGE_VAL: # <<<<<<<<<<<<<<
* llptr[i].v = 1.e30
* elif radians:
*/
__pyx_2 = (__pyx_v_projlonlatout.v == HUGE_VAL);
if (__pyx_2) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":193
* llptr[i].u = _rad2dg*projlonlatout.u
* if projlonlatout.v == HUGE_VAL:
* llptr[i].v = 1.e30 # <<<<<<<<<<<<<<
* elif radians:
* llptr[i].v = projlonlatout.v
*/
(__pyx_v_llptr[__pyx_v_i]).v = 1.e30;
goto __pyx_L8;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":194
* if projlonlatout.v == HUGE_VAL:
* llptr[i].v = 1.e30
* elif radians: # <<<<<<<<<<<<<<
* llptr[i].v = projlonlatout.v
* else:
*/
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_2) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":195
* llptr[i].v = 1.e30
* elif radians:
* llptr[i].v = projlonlatout.v # <<<<<<<<<<<<<<
* else:
* llptr[i].v = _rad2dg*projlonlatout.v
*/
(__pyx_v_llptr[__pyx_v_i]).v = __pyx_v_projlonlatout.v;
goto __pyx_L8;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":197
* llptr[i].v = projlonlatout.v
* else:
* llptr[i].v = _rad2dg*projlonlatout.v # <<<<<<<<<<<<<<
*
* def is_latlong(self):
*/
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_1 = PyFloat_FromDouble(__pyx_v_projlonlatout.v); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_3, __pyx_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_5 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
(__pyx_v_llptr[__pyx_v_i]).v = __pyx_5;
}
__pyx_L8:;
}
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_3);
Py_XDECREF(__pyx_4);
__Pyx_AddTraceback("_proj.Proj._invn");
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":199
* llptr[i].v = _rad2dg*projlonlatout.v
*
* def is_latlong(self): # <<<<<<<<<<<<<<
* # returns True if projection in geographic (lon/lat) coordinates
* cdef int i
*/
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;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":202
* # 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":203
* cdef int i
* i = pj_is_latlong(self.projpj)
* if i: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_i;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":204
* i = pj_is_latlong(self.projpj)
* if i:
* return True # <<<<<<<<<<<<<<
* else:
* return False
*/
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L4;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":206
* return True
* else:
* return False # <<<<<<<<<<<<<<
*
* def is_geocent(self):
*/
Py_INCREF(Py_False);
__pyx_r = Py_False;
goto __pyx_L0;
}
__pyx_L4:;
__pyx_r = Py_None; Py_INCREF(Py_None);
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":208
* return False
*
* def is_geocent(self): # <<<<<<<<<<<<<<
* # returns True if projection in geocentric (x/y) coordinates
* cdef int i
*/
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;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":211
* # 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":212
* cdef int i
* i = pj_is_geocent(self.projpj)
* if i: # <<<<<<<<<<<<<<
* return True
* else:
*/
__pyx_1 = __pyx_v_i;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":213
* i = pj_is_geocent(self.projpj)
* if i:
* return True # <<<<<<<<<<<<<<
* else:
* return False
*/
Py_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
goto __pyx_L4;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":215
* return True
* else:
* return False # <<<<<<<<<<<<<<
*
* def _transform(Proj p1, Proj p2, inx, iny, inz, radians):
*/
Py_INCREF(Py_False);
__pyx_r = Py_False;
goto __pyx_L0;
}
__pyx_L4:;
__pyx_r = Py_None; Py_INCREF(Py_None);
__pyx_L0:;
return __pyx_r;
}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":217
* return False
*
* def _transform(Proj p1, Proj p2, inx, iny, inz, radians): # <<<<<<<<<<<<<<
* # private function to call pj_transform
* cdef void *xdata, *ydata, *zdata
*/
static PyObject *__pyx_int_0;
static PyObject *__pyx_k_5p;
static char __pyx_k_5[] = "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 (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 6)) {
__pyx_v_p1 = ((struct __pyx_obj_5_proj_Proj *)PyTuple_GET_ITEM(__pyx_args, 0));
__pyx_v_p2 = ((struct __pyx_obj_5_proj_Proj *)PyTuple_GET_ITEM(__pyx_args, 1));
__pyx_v_inx = PyTuple_GET_ITEM(__pyx_args, 2);
__pyx_v_iny = PyTuple_GET_ITEM(__pyx_args, 3);
__pyx_v_inz = PyTuple_GET_ITEM(__pyx_args, 4);
__pyx_v_radians = PyTuple_GET_ITEM(__pyx_args, 5);
}
else {
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))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
__Pyx_AddTraceback("_proj._transform");
return NULL;
__pyx_L3:;
__pyx_v_ierr = Py_None; Py_INCREF(Py_None);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p1), __pyx_ptype_5_proj_Proj, 1, "p1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p2), __pyx_ptype_5_proj_Proj, 1, "p2", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":222
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":223
* 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:
* raise RuntimeError
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":224
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":225
* raise RuntimeError
* if PyObject_AsWriteBuffer(iny, &ydata, &bufleny) <> 0:
* raise RuntimeError # <<<<<<<<<<<<<<
* if inz is not None:
* if PyObject_AsWriteBuffer(inz, &zdata, &buflenz) <> 0:
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L5;
}
__pyx_L5:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":226
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":227
* raise RuntimeError
* if inz is not None:
* if PyObject_AsWriteBuffer(inz, &zdata, &buflenz) <> 0: # <<<<<<<<<<<<<<
* raise RuntimeError
* else:
*/
__pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_inz, (&__pyx_v_zdata), (&__pyx_v_buflenz)) != 0);
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":228
* if inz is not None:
* if PyObject_AsWriteBuffer(inz, &zdata, &buflenz) <> 0:
* raise RuntimeError # <<<<<<<<<<<<<<
* else:
* buflenz = bufleny
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L7;
}
__pyx_L7:;
goto __pyx_L6;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":230
* raise RuntimeError
* else:
* buflenz = bufleny # <<<<<<<<<<<<<<
* if not (buflenx == bufleny == buflenz):
* raise RuntimeError('x,y and z must be same size')
*/
__pyx_v_buflenz = __pyx_v_bufleny;
}
__pyx_L6:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":231
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":232
* buflenz = bufleny
* if not (buflenx == bufleny == buflenz):
* raise RuntimeError('x,y and z must be same size') # <<<<<<<<<<<<<<
* xx = <double *>xdata
* yy = <double *>ydata
*/
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_k_5p);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k_5p);
__pyx_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L8;
}
__pyx_L8:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":233
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":234
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":235
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":236
* yy = <double *>ydata
* if inz is not None:
* zz = <double *>zdata # <<<<<<<<<<<<<<
* npts = buflenx/8
* if not radians and p1.is_latlong():
*/
__pyx_v_zz = ((double *)__pyx_v_zdata);
goto __pyx_L9;
}
__pyx_L9:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":237
* 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);
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":238
* 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 = 238; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = __Pyx_PyBool_FromLong((!__pyx_2)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_3); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; 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 = 238; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; 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 = 238; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
if (__pyx_2) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":239
* npts = buflenx/8
* if not radians and p1.is_latlong():
* for i from 0 <= i < npts: # <<<<<<<<<<<<<<
* xx[i] = xx[i]*_dg2rad
* yy[i] = yy[i]*_dg2rad
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_npts; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":240
* 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 = 240; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_5 = PyNumber_Multiply(__pyx_4, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_xx[__pyx_v_i]) = __pyx_6;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":241
* 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 = 241; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_5 = PyNumber_Multiply(__pyx_4, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
(__pyx_v_yy[__pyx_v_i]) = __pyx_6;
}
goto __pyx_L10;
}
__pyx_L10:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":242
* 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) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":243
* yy[i] = yy[i]*_dg2rad
* if inz is not None:
* ierr = pj_transform(p1.projpj, p2.projpj, npts, 0, xx, yy, zz) # <<<<<<<<<<<<<<
* else:
* ierr = pj_transform(p1.projpj, p2.projpj, npts, 0, xx, yy, NULL)
*/
__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 = 243; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_ierr);
__pyx_v_ierr = __pyx_4;
__pyx_4 = 0;
goto __pyx_L13;
}
/*else*/ {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":245
* ierr = pj_transform(p1.projpj, p2.projpj, npts, 0, xx, yy, zz)
* else:
* ierr = pj_transform(p1.projpj, p2.projpj, npts, 0, xx, yy, NULL) # <<<<<<<<<<<<<<
* if ierr != 0:
* raise RuntimeError(pj_strerrno(ierr))
*/
__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 = 245; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_ierr);
__pyx_v_ierr = __pyx_3;
__pyx_3 = 0;
}
__pyx_L13:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":246
* 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_int_0, Py_NE); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_5); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
if (__pyx_2) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":247
* 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():
* for i from 0 <= i < npts:
*/
__pyx_7 = __pyx_PyInt_int(__pyx_v_ierr); if (unlikely((__pyx_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyString_FromString(pj_strerrno(__pyx_7)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
__pyx_4 = 0;
__pyx_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__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 = 247; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L14;
}
__pyx_L14:;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":248
* 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 = 248; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = __Pyx_PyBool_FromLong((!__pyx_1)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = __Pyx_PyObject_IsTrue(__pyx_4); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; 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 = 248; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; 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 = 248; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
if (__pyx_1) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":249
* raise RuntimeError(pj_strerrno(ierr))
* if not radians and p2.is_latlong():
* for i from 0 <= i < npts: # <<<<<<<<<<<<<<
* xx[i] = xx[i]*_rad2dg
* yy[i] = yy[i]*_rad2dg
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_npts; __pyx_v_i++) {
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":250
* 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 = 250; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_5, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
(__pyx_v_xx[__pyx_v_i]) = __pyx_6;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":251
* 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 = 251; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_4 = PyNumber_Multiply(__pyx_5, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_5); __pyx_5 = 0;
Py_DECREF(__pyx_3); __pyx_3 = 0;
__pyx_6 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_4); __pyx_4 = 0;
(__pyx_v_yy[__pyx_v_i]) = __pyx_6;
}
goto __pyx_L15;
}
__pyx_L15:;
__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);
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__fwdn, "_fwdn"},
{&__pyx_n__inv, "_inv"},
{&__pyx_n__invn, "_invn"},
{&__pyx_n__rad2dg, "_rad2dg"},
{&__pyx_n_degrees, "degrees"},
{&__pyx_n_is_geocent, "is_geocent"},
{&__pyx_n_is_latlong, "is_latlong"},
{&__pyx_n_math, "math"},
{&__pyx_n_radians, "radians"},
{0, 0}
};
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_k_2p, __pyx_k_2, sizeof(__pyx_k_2), 0},
{&__pyx_k_3p, __pyx_k_3, sizeof(__pyx_k_3), 0},
{&__pyx_k_4p, __pyx_k_4, sizeof(__pyx_k_4), 0},
{&__pyx_k_5p, __pyx_k_5, sizeof(__pyx_k_5), 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->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->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->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;
PyObject* tmp;
tmp = ((PyObject*)p->proj_version);
p->proj_version = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->srs);
p->srs = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
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},
{"_fwdn", (PyCFunction)__pyx_pf_5_proj_4Proj__fwdn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_proj_4Proj__fwdn},
{"_invn", (PyCFunction)__pyx_pf_5_proj_4Proj__invn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_proj_4Proj__invn},
{"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[] = {
{"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, 0, 0, PYTHON_API_VERSION);
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;};
__pyx_b = PyImport_AddModule("__builtin__");
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;};
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;};
/*--- Intern code ---*/
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;};
if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;};
/*--- String init code ---*/
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; 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 = 25; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_skip_dispatch = 0;
/*--- Global init code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
if (PyType_Ready(&__pyx_type_5_proj_Proj) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttrString(__pyx_m, "Proj", (PyObject *)&__pyx_type_5_proj_Proj) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_ptype_5_proj_Proj = &__pyx_type_5_proj_Proj;
/*--- Type import code ---*/
__pyx_ptype_7c_numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_7c_numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_ptype_7c_numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_7c_numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_ptype_7c_numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (unlikely(!__pyx_ptype_7c_numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_ptype_7c_numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (unlikely(!__pyx_ptype_7c_numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1;}
/*--- Function import code ---*/
/*--- Execution code ---*/
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_pyproj.pxi":1
* import math # <<<<<<<<<<<<<<
*
* _dg2rad = math.radians(1.)
*/
__pyx_1 = __Pyx_Import(__pyx_n_math, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n_math, __pyx_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_pyproj.pxi":3
* 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[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_radians); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_1 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
__pyx_1 = 0;
__pyx_1 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n__dg2rad, __pyx_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_pyproj.pxi":4
*
* _dg2rad = math.radians(1.)
* _rad2dg = math.degrees(1.) # <<<<<<<<<<<<<<
* _doublesize = sizeof(double)
* __version__ = "1.8.5"
*/
__pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_math); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_degrees); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
__pyx_1 = PyFloat_FromDouble(1.); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
__pyx_1 = 0;
__pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n__rad2dg, __pyx_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_pyproj.pxi":5
* _dg2rad = math.radians(1.)
* _rad2dg = math.degrees(1.)
* _doublesize = sizeof(double) # <<<<<<<<<<<<<<
* __version__ = "1.8.5"
*
*/
__pyx_3 = PyInt_FromLong((sizeof(double))); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_n__doublesize, __pyx_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_pyproj.pxi":6
* _rad2dg = math.degrees(1.)
* _doublesize = sizeof(double)
* __version__ = "1.8.5" # <<<<<<<<<<<<<<
*
* cdef extern from "stdlib.h":
*/
if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k_2p) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1;}
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":5
* include "_pyproj.pxi"
* cimport c_numpy
* c_numpy.import_array() # <<<<<<<<<<<<<<
*
* def set_datapath(datapath):
*/
import_array();
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":217
* return False
*
* def _transform(Proj p1, Proj p2, inx, iny, inz, radians): # <<<<<<<<<<<<<<
* # private function to call pj_transform
* cdef void *xdata, *ydata, *zdata
*/
return;
__pyx_L1:;
Py_XDECREF(__pyx_1);
Py_XDECREF(__pyx_2);
Py_XDECREF(__pyx_3);
__Pyx_AddTraceback("_proj");
}
static char *__pyx_filenames[] = {
"_proj.pyx",
"c_numpy.pxd",
"_pyproj.pxi",
};
/* Runtime support code */
static void __pyx_init_filenames(void) {
__pyx_f = __pyx_filenames;
}
static INLINE void __Pyx_RaiseArgtupleTooLong(
Py_ssize_t num_expected,
Py_ssize_t num_found)
{
const char* error_message =
#if PY_VERSION_HEX < 0x02050000
"function takes at most %d positional arguments (%d given)";
#else
"function takes at most %zd positional arguments (%zd given)";
#endif
PyErr_Format(PyExc_TypeError, error_message, num_expected, num_found);
}
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name, int exact) {
if (!type) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if (none_allowed && obj == Py_None) return 1;
else if (exact) {
if (obj->ob_type == type) return 1;
}
else {
if (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_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 {
type = 0;
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;
}
#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name,
long size)
{
PyObject *py_module = 0;
PyObject *result = 0;
PyObject *py_name = 0;
py_name = PyString_FromString(module_name);
if (!py_name)
goto bad;
py_module = __Pyx_ImportModule(module_name);
if (!py_module)
goto bad;
result = PyObject_GetAttrString(py_module, class_name);
if (!result)
goto bad;
if (!PyType_Check(result)) {
PyErr_Format(PyExc_TypeError,
"%s.%s is not a type object",
module_name, class_name);
goto bad;
}
if (((PyTypeObject *)result)->tp_basicsize != size) {
PyErr_Format(PyExc_ValueError,
"%s.%s does not appear to be the correct type object",
module_name, class_name);
goto bad;
}
return (PyTypeObject *)result;
bad:
Py_XDECREF(py_name);
Py_XDECREF(result);
return 0;
}
#endif
#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
#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_string = 0;
PyCodeObject *py_code = 0;
PyFrameObject *py_frame = 0;
py_srcfile = PyString_FromString(__pyx_filename);
if (!py_srcfile) goto bad;
if (__pyx_clineno) {
py_funcname = PyString_FromFormat( "%s (%s:%u)", funcname, __pyx_cfilenm, __pyx_clineno);
}
else {
py_funcname = PyString_FromString(funcname);
}
if (!py_funcname) goto bad;
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) 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,*/
__pyx_empty_tuple, /*PyObject *consts,*/
__pyx_empty_tuple, /*PyObject *names,*/
__pyx_empty_tuple, /*PyObject *varnames,*/
__pyx_empty_tuple, /*PyObject *freevars,*/
__pyx_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_string);
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
/* Type Conversion Functions */
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;
}
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 INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) {
if (PyInt_CheckExact(x)) {
return PyInt_AS_LONG(x);
}
else if (PyLong_CheckExact(x)) {
return PyLong_AsLongLong(x);
}
else {
PY_LONG_LONG val;
PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
val = __pyx_PyInt_AsLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
if (PyInt_CheckExact(x)) {
long val = PyInt_AS_LONG(x);
if (unlikely(val < 0)) {
PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type.");
return (unsigned PY_LONG_LONG)-1;
}
return val;
}
else if (PyLong_CheckExact(x)) {
return PyLong_AsUnsignedLongLong(x);
}
else {
PY_LONG_LONG val;
PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
val = __pyx_PyInt_AsUnsignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) {
if (sizeof(unsigned char) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
unsigned char val = (unsigned char)long_val;
if (unlikely((val != long_val) || (long_val < 0))) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char");
return (unsigned char)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) {
if (sizeof(unsigned short) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
unsigned short val = (unsigned short)long_val;
if (unlikely((val != long_val) || (long_val < 0))) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short");
return (unsigned short)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE char __pyx_PyInt_char(PyObject* x) {
if (sizeof(char) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
char val = (char)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to char");
return (char)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE short __pyx_PyInt_short(PyObject* x) {
if (sizeof(short) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
short val = (short)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to short");
return (short)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE int __pyx_PyInt_int(PyObject* x) {
if (sizeof(int) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
int val = (int)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to int");
return (int)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE long __pyx_PyInt_long(PyObject* x) {
if (sizeof(long) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
long val = (long)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to long");
return (long)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) {
if (sizeof(signed char) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
signed char val = (signed char)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char");
return (signed char)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) {
if (sizeof(signed short) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
signed short val = (signed short)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short");
return (signed short)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) {
if (sizeof(signed int) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
signed int val = (signed int)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int");
return (signed int)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) {
if (sizeof(signed long) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
signed long val = (signed long)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long");
return (signed long)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}
static INLINE long double __pyx_PyInt_long_double(PyObject* x) {
if (sizeof(long double) < sizeof(long)) {
long long_val = __pyx_PyInt_AsLong(x);
long double val = (long double)long_val;
if (unlikely((val != long_val) )) {
PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double");
return (long double)-1;
}
return val;
}
else {
return __pyx_PyInt_AsLong(x);
}
}