From: <js...@us...> - 2008-02-13 17:15:18
|
Revision: 4960 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4960&view=rev Author: jswhit Date: 2008-02-13 09:15:11 -0800 (Wed, 13 Feb 2008) Log Message: ----------- renamed _geos to _geoslib, fixes for omerc Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/examples/test.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py trunk/toolkits/basemap/setup.py Added Paths: ----------- trunk/toolkits/basemap/src/_geoslib.c trunk/toolkits/basemap/src/_geoslib.pyx Removed Paths: ------------- trunk/toolkits/basemap/src/_geos.c trunk/toolkits/basemap/src/_geos.pyx Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-02-13 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/Changelog 2008-02-13 17:15:11 UTC (rev 4960) @@ -6,6 +6,9 @@ namespace package, so basemap can now be installed if matplotlib is installed as an egg. Python 2.3 support re-enabled. + * changed _geos to _geoslib, so as not to conflict with + the python module bundled with the GEOS library. + * some fixes/enhancements for omerc projection. version 0.9.9.1 (svn revision 4808) * require python 2.4 (really only needed for building). Once namespace packages are re-enabled in matplotlib, Modified: trunk/toolkits/basemap/examples/test.py =================================================================== --- trunk/toolkits/basemap/examples/test.py 2008-02-13 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/examples/test.py 2008-02-13 17:15:11 UTC (rev 4960) @@ -196,10 +196,9 @@ # create new figure fig=figure() # setup oblique mercator basemap. -m = Basemap(llcrnrlon=-130.,llcrnrlat=39,urcrnrlon=-124.,urcrnrlat=60.,\ +m = Basemap(height=16700000,width=12000000, resolution='l',area_thresh=1000.,projection='omerc',\ - lon_2=-140,lat_2=55,lon_1=-120,lat_1=40) -fig.add_axes([0.125,0.2,0.6,0.6]) + lon_0=-100,lat_0=15,lon_2=-120,lat_2=65,lon_1=-50,lat_1=-55) # transform to nx x ny regularly spaced native projection grid nx = int((m.xmax-m.xmin)/20000.)+1; ny = int((m.ymax-m.ymin)/20000.)+1 topodat = m.transform_scalar(topoin,lons,lats,nx,ny) @@ -216,13 +215,9 @@ m.drawcountries() m.drawstates() # draw parallels -delat = 3. -circles = arange(40,60,delat) -m.drawparallels(circles,labels=[1,0,0,0],fontsize=10) +m.drawparallels(arange(-80,81,20),labels=[1,0,0,0],fontsize=10) # draw meridians -delon = 3. -meridians = arange(-140,-120,delon) -m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=10) +m.drawmeridians(arange(-180,181,30),labels=[0,0,0,1],fontsize=10) title('Oblique Mercator Projection') print 'plotting Oblique Mercator example ...' print m.srs Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-02-13 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-02-13 17:15:11 UTC (rev 4960) @@ -36,7 +36,7 @@ import numpy as npy from numpy import linspace, squeeze, ma from shapelib import ShapeFile -import _geos, pupynere, netcdftime +import _geoslib, pupynere, netcdftime # basemap data files now installed in lib/matplotlib/toolkits/basemap/data basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data']) @@ -79,7 +79,7 @@ projection_params = {'cyl' : 'corners only (no width/height)', 'merc' : 'corners plus lat_ts (no width/height)', 'tmerc' : 'lon_0,lat_0', - 'omerc' : 'lon_0,lat_0,lat_1,lat_2,lon_1,lon_2,no width/height', + 'omerc' : 'lat_0,lat_1,lat_2,lon_1,lon_2', 'mill' : 'corners only (no width/height)', 'lcc' : 'lon_0,lat_0,lat_1,lat_2', 'laea' : 'lon_0,lat_0', @@ -527,14 +527,23 @@ self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat elif projection == 'omerc': - if lat_1 is None or lon_1 is None or lat_2 is None or lon_2 is None: - raise ValueError, 'must specify lat_1,lon_1 and lat_2,lon_2 for Oblique Mercator basemap' + if lat_1 is None or lon_1 is None or lat_2 is None or lon_2 is None or lat_0 is None: + raise ValueError, 'must specify lat_0 and lat_1,lon_1 and lat_2,lon_2 for Oblique Mercator basemap' projparams['lat_1'] = lat_1 projparams['lon_1'] = lon_1 projparams['lat_2'] = lat_2 projparams['lon_2'] = lon_2 + projparams['lat_0'] = lat_0 + #if not using_corners: + # raise ValueError, 'cannot specify map region with width and height keywords for this projection, please specify lat/lon values of corners' if not using_corners: - raise ValueError, 'cannot specify map region with width and height keywords for this projection, please specify lat/lon values of corners' + if width is None or height is None: + raise ValueError, 'must either specify lat/lon values of corners (llcrnrlon,llcrnrlat,ucrnrlon,urcrnrlat) in degrees or width and height in meters' + if lon_0 is None or lat_0 is None: + raise ValueError, 'must specify lon_0 and lat_0 when using width, height to specify projection region' + llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = _choosecorners(width,height,**projparams) + self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat + self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat elif projection == 'aeqd': if lat_0 is None or lon_0 is None: raise ValueError, 'must specify lat_0 and lon_0 for Azimuthal Equidistant basemap' @@ -736,12 +745,12 @@ polygon_types = [] # coastlines are polygons, other boundaries are line segments. if name == 'gshhs': - Shape = _geos.Polygon + Shape = _geoslib.Polygon else: - Shape = _geos.LineString + Shape = _geoslib.LineString # see if map projection region polygon contains a pole. - NPole = _geos.Point(self(0.,90.)) - SPole = _geos.Point(self(0.,-90.)) + NPole = _geoslib.Point(self(0.,90.)) + SPole = _geoslib.Point(self(0.,-90.)) boundarypolyxy = self._boundarypolyxy boundarypolyll = self._boundarypolyll hasNP = NPole.within(boundarypolyxy) @@ -749,7 +758,8 @@ containsPole = hasNP or hasSP # these projections cannot cross pole. if containsPole and\ - self.projection in ['tmerc','cass','omerc','merc','mill','cyl','robin','moll','sinu','geos']: + self.projection in ['merc','mill','cyl','robin','moll','sinu','geos']: + #self.projection in ['tmerc','omerc','cass','merc','mill','cyl','robin','moll','sinu','geos']: raise ValueError('%s projection cannot cross pole'%(self.projection)) # make sure orthographic projection has containsPole=True # we will compute the intersections in stereographic @@ -770,7 +780,7 @@ b = self._boundarypolyll.boundary blons = b[:,0]; blats = b[:,1] b[:,0], b[:,1] = maptran(blons, blats) - boundarypolyxy = _geos.Polygon(b) + boundarypolyxy = _geoslib.Polygon(b) for line in bdatmetafile: linesplit = line.split() area = float(linesplit[1]) @@ -817,7 +827,7 @@ lats.append(-90.) b = npy.empty((len(lons),2),npy.float64) b[:,0] = lons; b[:,1] = lats - poly = _geos.Polygon(b) + poly = _geoslib.Polygon(b) antart = True else: poly = Shape(b) @@ -940,7 +950,7 @@ y = rminor*npy.sin(thetas) + rminor b = npy.empty((len(x),2),npy.float64) b[:,0]=x; b[:,1]=y - boundaryxy = _geos.Polygon(b) + boundaryxy = _geoslib.Polygon(b) # compute proj instance for full disk, if necessary. if not self._fulldisk: projparms = self.projparams.copy() @@ -979,7 +989,7 @@ x, y = maptran(lons,lats) b = npy.empty((len(x),2),npy.float64) b[:,0]=x; b[:,1]=y - boundaryxy = _geos.Polygon(b) + boundaryxy = _geoslib.Polygon(b) else: # all other projections are rectangular. # left side (x = xmin, ymin <= y <= ymax) yy = linspace(self.ymin, self.ymax, ny)[:-1] @@ -1000,7 +1010,7 @@ b = npy.empty((4,2),npy.float64) b[:,0]=[self.xmin,self.xmin,self.xmax,self.xmax] b[:,1]=[self.ymin,self.ymax,self.ymax,self.ymin] - boundaryxy = _geos.Polygon(b) + boundaryxy = _geoslib.Polygon(b) if self.projection in ['mill','merc','cyl']: # make sure map boundary doesn't quite include pole. if self.urcrnrlat > 89.9999: @@ -1016,7 +1026,7 @@ x, y = self(lons, lats) b = npy.empty((len(x),2),npy.float64) b[:,0]=x; b[:,1]=y - boundaryxy = _geos.Polygon(b) + boundaryxy = _geoslib.Polygon(b) else: if self.projection not in ['moll','robin','sinu']: lons, lats = maptran(x,y,inverse=True) @@ -1034,7 +1044,7 @@ n = n + 1 b = npy.empty((len(lons),2),npy.float64) b[:,0]=lons; b[:,1]=lats - boundaryll = _geos.Polygon(b) + boundaryll = _geoslib.Polygon(b) return boundaryll, boundaryxy Modified: trunk/toolkits/basemap/setup.py =================================================================== --- trunk/toolkits/basemap/setup.py 2008-02-13 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/setup.py 2008-02-13 17:15:11 UTC (rev 4960) @@ -31,7 +31,7 @@ else: return [("HAVE_UPDATE_HEADER", "0")] -def check_geosversion(GEOS_dir): +def checkversion(GEOS_dir): """check geos C-API header file (geos_c.h)""" try: f = open(os.path.join(GEOS_dir,'include/geos_c.h')) @@ -54,7 +54,7 @@ # if GEOS_dir not set, check a few standard locations. GEOS_dirs = ['/usr/local','/sw','/opt','/opt/local',os.path.expanduser('~')] for direc in GEOS_dirs: - geos_version = check_geosversion(direc) + geos_version = checkversion(direc) print 'checking for GEOS lib in %s ....' % direc if geos_version != '"2.2.3"': continue @@ -63,7 +63,7 @@ GEOS_dir = direc break else: - geos_version = check_geosversion(GEOS_dir) + geos_version = checkversion(GEOS_dir) #if geos_version != '"2.2.3"': # raise SystemExit(""" #Can't find geos library version 2.2.3. Please set the @@ -81,15 +81,15 @@ deps = glob.glob('src/*.c') deps.remove(os.path.join('src','_proj.c')) deps.remove(os.path.join('src','_geod.c')) -deps.remove(os.path.join('src','_geos.c')) +deps.remove(os.path.join('src','_geoslib.c')) packages = ['mpl_toolkits','mpl_toolkits.basemap'] package_dirs = {'':'lib'} extensions = [Extension("mpl_toolkits.basemap._proj",deps+['src/_proj.c'],include_dirs = ['src'],)] extensions.append(Extension("mpl_toolkits.basemap._geod",deps+['src/_geod.c'],include_dirs = ['src'],)) # for some reason, pickling won't work if this extension is installed -# as "matplotlib.toolkits.basemap._geos" -extensions.append(Extension("_geos",['src/_geos.c'], +# as "matplotlib.toolkits.basemap._geoslib" +extensions.append(Extension("_geoslib",['src/_geoslib.c'], library_dirs=geos_library_dirs, runtime_library_dirs=geos_library_dirs, include_dirs=geos_include_dirs, Deleted: trunk/toolkits/basemap/src/_geos.c =================================================================== --- trunk/toolkits/basemap/src/_geos.c 2008-02-13 13:50:29 UTC (rev 4959) +++ trunk/toolkits/basemap/src/_geos.c 2008-02-13 17:15:11 UTC (rev 4960) @@ -1,3119 +0,0 @@ -/* Generated by Cython 0.9.6.8 on Thu Nov 15 13:56:55 2007 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#if PY_VERSION_HEX < 0x02050000 - typedef int Py_ssize_t; - #define PY_SSIZE_T_MAX INT_MAX - #define PY_SSIZE_T_MIN INT_MIN - #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) -#endif -#ifndef WIN32 - #define __stdcall - #define __cdecl -#endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" -#else -#define __PYX_EXTERN_C extern -#endif -#include <math.h> -#include "numpy/arrayobject.h" -#include "geos_c.h" - - -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE -#endif - -typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ -typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/ - -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if (x == Py_False) return 0; - else return PyObject_IsTrue(x); -} - - - -static int __pyx_skip_dispatch = 0; - - -#ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ -#else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_b; -static int __pyx_lineno; -static char *__pyx_filename; -static char **__pyx_f; - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/ - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_WriteUnraisable(char *name); /*proto*/ - -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*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*/ - -static int __Pyx_RegisterCleanup(); /*proto*/ -static PyObject* cleanup(PyObject *self, PyObject *unused); /*proto*/ -static PyMethodDef cleanup_def = {"__cleanup", (PyCFunction)&cleanup, METH_NOARGS, 0}; - -/* Declarations from numpy */ - - -/* Declarations from _geos */ - -struct __pyx_obj_5_geos_BaseGeometry { - PyObject_HEAD - GEOSGeom *_geom; - unsigned int _npts; - PyObject *boundary; -}; - -struct __pyx_obj_5_geos_Polygon { - struct __pyx_obj_5_geos_BaseGeometry __pyx_base; -}; - -struct __pyx_obj_5_geos_LineString { - struct __pyx_obj_5_geos_BaseGeometry __pyx_base; -}; - -struct __pyx_obj_5_geos_Point { - struct __pyx_obj_5_geos_BaseGeometry __pyx_base; - PyObject *x; - PyObject *y; -}; - - - - - -static PyTypeObject *__pyx_ptype_5_geos_ndarray = 0; -static PyTypeObject *__pyx_ptype_5_geos_BaseGeometry = 0; -static PyTypeObject *__pyx_ptype_5_geos_Polygon = 0; -static PyTypeObject *__pyx_ptype_5_geos_LineString = 0; -static PyTypeObject *__pyx_ptype_5_geos_Point = 0; -static void __pyx_f_5_geos_notice_h(char *,char *); /*proto*/ -static void __pyx_f_5_geos_error_h(char *,char *); /*proto*/ -static PyObject *__pyx_f_5_geos_geos_version(void); /*proto*/ -static PyObject *__pyx_f_5_geos__get_coords(GEOSGeom *); /*proto*/ - - -/* Implementation of _geos */ - -static char __pyx_k3[] = "0.1"; -static char __pyx_k4[] = "2.2.3-CAPI-1.1.1"; -static char __pyx_k5[] = "version 2.2.3 of the geos library is required"; - -static PyObject *__pyx_n_is_valid; -static PyObject *__pyx_n_geom_type; -static PyObject *__pyx_n_within; -static PyObject *__pyx_n_intersects; -static PyObject *__pyx_n_intersection; -static PyObject *__pyx_n_get_coords; -static PyObject *__pyx_n___dealloc__; -static PyObject *__pyx_n___reduce__; -static PyObject *__pyx_n___init__; -static PyObject *__pyx_n_area; -static PyObject *__pyx_n_sys; -static PyObject *__pyx_n_numpy; -static PyObject *__pyx_n___version__; -static PyObject *__pyx_n___geos_version__; -static PyObject *__pyx_n_ValueError; - -static PyObject *__pyx_k3p; -static PyObject *__pyx_k4p; -static PyObject *__pyx_k5p; - -static PyObject *__pyx_builtin_ValueError; - -static PyObject *__pyx_n_stdout; -static PyObject *__pyx_n_write; - -static PyObject *__pyx_k6p; - -static char __pyx_k6[] = "GEOS_NOTICE: %s\n"; - -static void __pyx_f_5_geos_notice_h(char *__pyx_v_fmt,char *__pyx_v_msg) { - PyObject *__pyx_v_format; - PyObject *__pyx_v_message; - PyObject *__pyx_v_warn_msg; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - __pyx_v_format = Py_None; Py_INCREF(Py_None); - __pyx_v_message = Py_None; Py_INCREF(Py_None); - __pyx_v_warn_msg = Py_None; Py_INCREF(Py_None); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":101 - * - * cdef void notice_h(char *fmt, char*msg): - * format = PyString_FromString(fmt) # <<<<<<<<<<<<<< - * message = PyString_FromString(msg) - * try: - */ - __pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;} - Py_DECREF(__pyx_v_format); - __pyx_v_format = __pyx_1; - __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":102 - * cdef void notice_h(char *fmt, char*msg): - * format = PyString_FromString(fmt) - * message = PyString_FromString(msg) # <<<<<<<<<<<<<< - * try: - * warn_msg = format % message - */ - __pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L1;} - Py_DECREF(__pyx_v_message); - __pyx_v_message = __pyx_1; - __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":103 - * format = PyString_FromString(fmt) - * message = PyString_FromString(msg) - * try: # <<<<<<<<<<<<<< - * warn_msg = format % message - * except: - */ - /*try:*/ { - __pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L2;} - Py_DECREF(__pyx_v_warn_msg); - __pyx_v_warn_msg = __pyx_1; - __pyx_1 = 0; - } - goto __pyx_L3; - __pyx_L2:; - Py_XDECREF(__pyx_1); __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":105 - * try: - * warn_msg = format % message - * except: # <<<<<<<<<<<<<< - * warn_msg = format - * sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg) - */ - /*except:*/ { - __Pyx_AddTraceback("_geos.notice_h"); - if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;} - Py_INCREF(__pyx_v_format); - Py_DECREF(__pyx_v_warn_msg); - __pyx_v_warn_msg = __pyx_v_format; - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":107 - * except: - * warn_msg = format - * sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg) # <<<<<<<<<<<<<< - * - * cdef void error_h(char *fmt, char*msg): - */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stdout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = PyNumber_Remainder(__pyx_k6p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); - __pyx_1 = 0; - __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - __Pyx_WriteUnraisable("_geos.notice_h"); - __pyx_L0:; - Py_DECREF(__pyx_v_format); - Py_DECREF(__pyx_v_message); - Py_DECREF(__pyx_v_warn_msg); -} - -static PyObject *__pyx_n_stderr; - -static PyObject *__pyx_k7p; - -static char __pyx_k7[] = "GEOS_ERROR: %s\n"; - -static void __pyx_f_5_geos_error_h(char *__pyx_v_fmt,char *__pyx_v_msg) { - PyObject *__pyx_v_format; - PyObject *__pyx_v_message; - PyObject *__pyx_v_warn_msg; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - __pyx_v_format = Py_None; Py_INCREF(Py_None); - __pyx_v_message = Py_None; Py_INCREF(Py_None); - __pyx_v_warn_msg = Py_None; Py_INCREF(Py_None); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":110 - * - * cdef void error_h(char *fmt, char*msg): - * format = PyString_FromString(fmt) # <<<<<<<<<<<<<< - * message = PyString_FromString(msg) - * try: - */ - __pyx_1 = PyString_FromString(__pyx_v_fmt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;} - Py_DECREF(__pyx_v_format); - __pyx_v_format = __pyx_1; - __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":111 - * cdef void error_h(char *fmt, char*msg): - * format = PyString_FromString(fmt) - * message = PyString_FromString(msg) # <<<<<<<<<<<<<< - * try: - * warn_msg = format % message - */ - __pyx_1 = PyString_FromString(__pyx_v_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;} - Py_DECREF(__pyx_v_message); - __pyx_v_message = __pyx_1; - __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":112 - * format = PyString_FromString(fmt) - * message = PyString_FromString(msg) - * try: # <<<<<<<<<<<<<< - * warn_msg = format % message - * except: - */ - /*try:*/ { - __pyx_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_message); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L2;} - Py_DECREF(__pyx_v_warn_msg); - __pyx_v_warn_msg = __pyx_1; - __pyx_1 = 0; - } - goto __pyx_L3; - __pyx_L2:; - Py_XDECREF(__pyx_1); __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":114 - * try: - * warn_msg = format % message - * except: # <<<<<<<<<<<<<< - * warn_msg = format - * sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) - */ - /*except:*/ { - __Pyx_AddTraceback("_geos.error_h"); - if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;} - Py_INCREF(__pyx_v_format); - Py_DECREF(__pyx_v_warn_msg); - __pyx_v_warn_msg = __pyx_v_format; - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - goto __pyx_L3; - } - __pyx_L3:; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":116 - * except: - * warn_msg = format - * sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) # <<<<<<<<<<<<<< - * - * # check library version - */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_stderr); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_write); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_1 = PyNumber_Remainder(__pyx_k7p, __pyx_v_warn_msg); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); - __pyx_1 = 0; - __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; - - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - __Pyx_WriteUnraisable("_geos.error_h"); - __pyx_L0:; - Py_DECREF(__pyx_v_format); - Py_DECREF(__pyx_v_message); - Py_DECREF(__pyx_v_warn_msg); -} - -static PyObject *__pyx_f_5_geos_geos_version(void) { - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - __pyx_1 = PyString_FromString(GEOSversion()); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;} - __pyx_r = __pyx_1; - __pyx_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_1); - __Pyx_AddTraceback("_geos.geos_version"); - __pyx_r = 0; - __pyx_L0:; - return __pyx_r; -} - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_is_valid(PyObject *__pyx_v_self, PyObject *unused) { - char __pyx_v_valid; - PyObject *__pyx_r; - char __pyx_1; - Py_INCREF(__pyx_v_self); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":134 - * def is_valid(self): - * cdef char valid - * valid = GEOSisValid(self._geom) # <<<<<<<<<<<<<< - * if valid: - * return True - */ - __pyx_v_valid = GEOSisValid(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":135 - * cdef char valid - * valid = GEOSisValid(self._geom) - * if valid: # <<<<<<<<<<<<<< - * return True - * else: - */ - __pyx_1 = __pyx_v_valid; - if (__pyx_1) { - Py_INCREF(Py_True); - __pyx_r = Py_True; - goto __pyx_L0; - goto __pyx_L2; - } - /*else*/ { - Py_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - } - __pyx_L2:; - - __pyx_r = Py_None; Py_INCREF(Py_None); - __pyx_L0:; - Py_DECREF(__pyx_v_self); - return __pyx_r; -} - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_geom_type(PyObject *__pyx_v_self, PyObject *unused) { - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - Py_INCREF(__pyx_v_self); - __pyx_1 = PyString_FromString(GEOSGeomType(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; goto __pyx_L1;} - __pyx_r = __pyx_1; - __pyx_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_1); - __Pyx_AddTraceback("_geos.BaseGeometry.geom_type"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - return __pyx_r; -} - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_within(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { - GEOSGeom *__pyx_v_g1; - GEOSGeom *__pyx_v_g2; - char __pyx_v_answer; - PyObject *__pyx_r; - char __pyx_1; - Py_INCREF(__pyx_v_self); - Py_INCREF(__pyx_v_geom); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_5_geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;} - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":146 - * cdef GEOSGeom *g1, *g2 - * cdef char answer - * g1 = self._geom # <<<<<<<<<<<<<< - * g2 = geom._geom - * answer = GEOSWithin(g1, g2) - */ - __pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":147 - * cdef char answer - * g1 = self._geom - * g2 = geom._geom # <<<<<<<<<<<<<< - * answer = GEOSWithin(g1, g2) - * if answer: - */ - __pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":148 - * g1 = self._geom - * g2 = geom._geom - * answer = GEOSWithin(g1, g2) # <<<<<<<<<<<<<< - * if answer: - * return True - */ - __pyx_v_answer = GEOSWithin(__pyx_v_g1,__pyx_v_g2); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":149 - * g2 = geom._geom - * answer = GEOSWithin(g1, g2) - * if answer: # <<<<<<<<<<<<<< - * return True - * else: - */ - __pyx_1 = __pyx_v_answer; - if (__pyx_1) { - Py_INCREF(Py_True); - __pyx_r = Py_True; - goto __pyx_L0; - goto __pyx_L2; - } - /*else*/ { - Py_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - } - __pyx_L2:; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - __Pyx_AddTraceback("_geos.BaseGeometry.within"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - Py_DECREF(__pyx_v_geom); - return __pyx_r; -} - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersects(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { - GEOSGeom *__pyx_v_g1; - GEOSGeom *__pyx_v_g2; - char __pyx_v_answer; - PyObject *__pyx_r; - char __pyx_1; - Py_INCREF(__pyx_v_self); - Py_INCREF(__pyx_v_geom); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_5_geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; goto __pyx_L1;} - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":157 - * cdef GEOSGeom *g1, *g2 - * cdef char answer - * g1 = self._geom # <<<<<<<<<<<<<< - * g2 = geom._geom - * answer = GEOSIntersects(g1, g2) - */ - __pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":158 - * cdef char answer - * g1 = self._geom - * g2 = geom._geom # <<<<<<<<<<<<<< - * answer = GEOSIntersects(g1, g2) - * if answer: - */ - __pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":159 - * g1 = self._geom - * g2 = geom._geom - * answer = GEOSIntersects(g1, g2) # <<<<<<<<<<<<<< - * if answer: - * return True - */ - __pyx_v_answer = GEOSIntersects(__pyx_v_g1,__pyx_v_g2); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":160 - * g2 = geom._geom - * answer = GEOSIntersects(g1, g2) - * if answer: # <<<<<<<<<<<<<< - * return True - * else: - */ - __pyx_1 = __pyx_v_answer; - if (__pyx_1) { - Py_INCREF(Py_True); - __pyx_r = Py_True; - goto __pyx_L0; - goto __pyx_L2; - } - /*else*/ { - Py_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - } - __pyx_L2:; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - __Pyx_AddTraceback("_geos.BaseGeometry.intersects"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - Py_DECREF(__pyx_v_geom); - return __pyx_r; -} - -static PyObject *__pyx_n_append; -static PyObject *__pyx_n_NotImplementedError; - -static PyObject *__pyx_k8p; - -static PyObject *__pyx_builtin_NotImplementedError; - -static char __pyx_k8[] = "intersections of type '%s' not yet implemented"; - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_intersection(PyObject *__pyx_v_self, PyObject *__pyx_v_geom) { - GEOSGeom *__pyx_v_g1; - GEOSGeom *__pyx_v_g2; - GEOSGeom *__pyx_v_g3; - GEOSGeom *__pyx_v_gout; - int __pyx_v_numgeoms; - int __pyx_v_i; - int __pyx_v_typeid; - PyObject *__pyx_v_b; - PyObject *__pyx_v_p; - PyObject *__pyx_v_pout; - PyObject *__pyx_v_type; - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - Py_INCREF(__pyx_v_self); - Py_INCREF(__pyx_v_geom); - __pyx_v_b = Py_None; Py_INCREF(Py_None); - __pyx_v_p = Py_None; Py_INCREF(Py_None); - __pyx_v_pout = Py_None; Py_INCREF(Py_None); - __pyx_v_type = Py_None; Py_INCREF(Py_None); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_5_geos_BaseGeometry, 1, "geom"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;} - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":169 - * cdef char answer - * cdef int numgeoms, i, typeid - * g1 = self._geom # <<<<<<<<<<<<<< - * g2 = geom._geom - * g3 = GEOSIntersection(g1, g2) - */ - __pyx_v_g1 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":170 - * cdef int numgeoms, i, typeid - * g1 = self._geom - * g2 = geom._geom # <<<<<<<<<<<<<< - * g3 = GEOSIntersection(g1, g2) - * typeid = GEOSGeomTypeId(g3) - */ - __pyx_v_g2 = ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_geom)->_geom; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":171 - * g1 = self._geom - * g2 = geom._geom - * g3 = GEOSIntersection(g1, g2) # <<<<<<<<<<<<<< - * typeid = GEOSGeomTypeId(g3) - * if typeid == GEOS_POLYGON: - */ - __pyx_v_g3 = GEOSIntersection(__pyx_v_g1,__pyx_v_g2); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":172 - * g2 = geom._geom - * g3 = GEOSIntersection(g1, g2) - * typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<< - * if typeid == GEOS_POLYGON: - * b = _get_coords(g3) - */ - __pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":173 - * g3 = GEOSIntersection(g1, g2) - * typeid = GEOSGeomTypeId(g3) - * if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<< - * b = _get_coords(g3) - * p = Polygon(b) - */ - __pyx_1 = (__pyx_v_typeid == GEOS_POLYGON); - if (__pyx_1) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":174 - * typeid = GEOSGeomTypeId(g3) - * if typeid == GEOS_POLYGON: - * b = _get_coords(g3) # <<<<<<<<<<<<<< - * p = Polygon(b) - * pout = [p] - */ - __pyx_2 = __pyx_f_5_geos__get_coords(__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;} - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_2; - __pyx_2 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":175 - * if typeid == GEOS_POLYGON: - * b = _get_coords(g3) - * p = Polygon(b) # <<<<<<<<<<<<<< - * pout = [p] - * elif typeid == GEOS_LINESTRING: - */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;} - Py_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b); - __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_Polygon), __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_v_p); - __pyx_v_p = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":176 - * b = _get_coords(g3) - * p = Polygon(b) - * pout = [p] # <<<<<<<<<<<<<< - * elif typeid == GEOS_LINESTRING: - * b = _get_coords(g3) - */ - __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;} - Py_INCREF(__pyx_v_p); - PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p); - Py_DECREF(__pyx_v_pout); - __pyx_v_pout = __pyx_2; - __pyx_2 = 0; - goto __pyx_L2; - } - __pyx_1 = (__pyx_v_typeid == GEOS_LINESTRING); - if (__pyx_1) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":178 - * pout = [p] - * elif typeid == GEOS_LINESTRING: - * b = _get_coords(g3) # <<<<<<<<<<<<<< - * p = LineString(b) - * pout = [p] - */ - __pyx_3 = __pyx_f_5_geos__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; goto __pyx_L1;} - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":179 - * elif typeid == GEOS_LINESTRING: - * b = _get_coords(g3) - * p = LineString(b) # <<<<<<<<<<<<<< - * pout = [p] - * elif typeid == GEOS_MULTIPOLYGON: - */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;} - Py_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b); - __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_LineString), __pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_v_p); - __pyx_v_p = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":180 - * b = _get_coords(g3) - * p = LineString(b) - * pout = [p] # <<<<<<<<<<<<<< - * elif typeid == GEOS_MULTIPOLYGON: - * numgeoms = GEOSGetNumGeometries(g3) - */ - __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;} - Py_INCREF(__pyx_v_p); - PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p); - Py_DECREF(__pyx_v_pout); - __pyx_v_pout = __pyx_2; - __pyx_2 = 0; - goto __pyx_L2; - } - __pyx_1 = (__pyx_v_typeid == GEOS_MULTIPOLYGON); - if (__pyx_1) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":182 - * pout = [p] - * elif typeid == GEOS_MULTIPOLYGON: - * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<< - * pout = [] - * for i from 0 <= i < numgeoms: - */ - __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":183 - * elif typeid == GEOS_MULTIPOLYGON: - * numgeoms = GEOSGetNumGeometries(g3) - * pout = [] # <<<<<<<<<<<<<< - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) - */ - __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; goto __pyx_L1;} - Py_DECREF(__pyx_v_pout); - __pyx_v_pout = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":184 - * numgeoms = GEOSGetNumGeometries(g3) - * pout = [] - * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<< - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) - */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":185 - * pout = [] - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<< - * b = _get_coords(gout) - * p = Polygon(b) - */ - __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":186 - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) # <<<<<<<<<<<<<< - * p = Polygon(b) - * pout.append(p) - */ - __pyx_2 = __pyx_f_5_geos__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;} - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_2; - __pyx_2 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":187 - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) - * p = Polygon(b) # <<<<<<<<<<<<<< - * pout.append(p) - * elif typeid == GEOS_MULTILINESTRING: - */ - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;} - Py_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b); - __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_Polygon), __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_v_p); - __pyx_v_p = __pyx_2; - __pyx_2 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":188 - * b = _get_coords(gout) - * p = Polygon(b) - * pout.append(p) # <<<<<<<<<<<<<< - * elif typeid == GEOS_MULTILINESTRING: - * numgeoms = GEOSGetNumGeometries(g3) - */ - __pyx_3 = PyObject_GetAttr(__pyx_v_pout, __pyx_n_append); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;} - Py_INCREF(__pyx_v_p); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_p); - __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - } - goto __pyx_L2; - } - __pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING); - if (__pyx_1) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":190 - * pout.append(p) - * elif typeid == GEOS_MULTILINESTRING: - * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<< - * pout = [] - * for i from 0 <= i < numgeoms: - */ - __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":191 - * elif typeid == GEOS_MULTILINESTRING: - * numgeoms = GEOSGetNumGeometries(g3) - * pout = [] # <<<<<<<<<<<<<< - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) - */ - __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; goto __pyx_L1;} - Py_DECREF(__pyx_v_pout); - __pyx_v_pout = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":192 - * numgeoms = GEOSGetNumGeometries(g3) - * pout = [] - * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<< - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) - */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":193 - * pout = [] - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<< - * b = _get_coords(gout) - * p = LineString(b) - */ - __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3,__pyx_v_i); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":194 - * for i from 0 <= i < numgeoms: - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) # <<<<<<<<<<<<<< - * p = LineString(b) - * pout.append(p) - */ - __pyx_2 = __pyx_f_5_geos__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;} - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_2; - __pyx_2 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":195 - * gout = GEOSGetGeometryN(g3, i) - * b = _get_coords(gout) - * p = LineString(b) # <<<<<<<<<<<<<< - * pout.append(p) - * else: - */ - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;} - Py_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b); - __pyx_3 = PyObject_CallObject(((PyObject*)__pyx_ptype_5_geos_LineString), __pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_v_p); - __pyx_v_p = __pyx_3; - __pyx_3 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":196 - * b = _get_coords(gout) - * p = LineString(b) - * pout.append(p) # <<<<<<<<<<<<<< - * else: - * type = PyString_FromString(GEOSGeomType(g3)) - */ - __pyx_2 = PyObject_GetAttr(__pyx_v_pout, __pyx_n_append); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} - Py_INCREF(__pyx_v_p); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_p); - __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - goto __pyx_L2; - } - /*else*/ { - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":198 - * pout.append(p) - * else: - * type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<< - * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) - * GEOSGeom_destroy(g3) - */ - __pyx_2 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; goto __pyx_L1;} - Py_DECREF(__pyx_v_type); - __pyx_v_type = __pyx_2; - __pyx_2 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":199 - * else: - * type = PyString_FromString(GEOSGeomType(g3)) - * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<< - * GEOSGeom_destroy(g3) - * return pout - */ - __pyx_4 = PyNumber_Remainder(__pyx_k8p, __pyx_v_type); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4); - __pyx_4 = 0; - __pyx_2 = PyObject_CallObject(__pyx_builtin_NotImplementedError, __pyx_3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;} - Py_DECREF(__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 = 199; goto __pyx_L1;} - } - __pyx_L2:; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":200 - * type = PyString_FromString(GEOSGeomType(g3)) - * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) - * GEOSGeom_destroy(g3) # <<<<<<<<<<<<<< - * return pout - * - */ - GEOSGeom_destroy(__pyx_v_g3); - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":201 - * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) - * GEOSGeom_destroy(g3) - * return pout # <<<<<<<<<<<<<< - * - * def get_coords(self): - */ - Py_INCREF(__pyx_v_pout); - __pyx_r = __pyx_v_pout; - goto __pyx_L0; - - __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("_geos.BaseGeometry.intersection"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_b); - Py_DECREF(__pyx_v_p); - Py_DECREF(__pyx_v_pout); - Py_DECREF(__pyx_v_type); - Py_DECREF(__pyx_v_self); - Py_DECREF(__pyx_v_geom); - return __pyx_r; -} - -static PyObject *__pyx_pf_5_geos_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_5_geos_12BaseGeometry_get_coords(PyObject *__pyx_v_self, PyObject *unused) { - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - Py_INCREF(__pyx_v_self); - __pyx_1 = __pyx_f_5_geos__get_coords(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; goto __pyx_L1;} - __pyx_r = __pyx_1; - __pyx_1 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_1); - __Pyx_AddTraceback("_geos.BaseGeometry.get_coords"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - return __pyx_r; -} - -static void __pyx_pf_5_geos_12BaseGeometry___dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_5_geos_12BaseGeometry___dealloc__(PyObject *__pyx_v_self) { - Py_INCREF(__pyx_v_self); - GEOSGeom_destroy(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->_geom); - - Py_DECREF(__pyx_v_self); -} - -static PyObject *__pyx_n___class__; - -static PyObject *__pyx_pf_5_geos_12BaseGeometry___reduce__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ -static char __pyx_doc_5_geos_12BaseGeometry___reduce__[] = "special method that allows geos instance to be pickled"; -static PyObject *__pyx_pf_5_geos_12BaseGeometry___reduce__(PyObject *__pyx_v_self, PyObject *unused) { - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - Py_INCREF(__pyx_v_self); - __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;} - Py_INCREF(((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->boundary); - PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_geos_BaseGeometry *)__pyx_v_self)->boundary); - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2); - __pyx_1 = 0; - __pyx_2 = 0; - __pyx_r = __pyx_3; - __pyx_3 = 0; - goto __pyx_L0; - - __pyx_r = Py_None; Py_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - __Pyx_AddTraceback("_geos.BaseGeometry.__reduce__"); - __pyx_r = NULL; - __pyx_L0:; - Py_DECREF(__pyx_v_self); - return __pyx_r; -} - -static PyObject *__pyx_num_neg_1; -static PyObject *__pyx_num_0; -static PyObject *__pyx_num_1; - -static PyObject *__pyx_n_copy; -static PyObject *__pyx_n_shape; - -static int __pyx_pf_5_geos_7Polygon___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_5_geos_7Polygon___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_b = 0; - unsigned int __pyx_v_M; - unsigned int __pyx_v_m; - unsigned int __pyx_v_i; - double __pyx_v_dx; - double __pyx_v_dy; - double *__pyx_v_bbuffer; - GEOSCoordSeq *__pyx_v_cs; - GEOSGeom *__pyx_v_lr; - int __pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - unsigned int __pyx_5; - PyObject *__pyx_6 = 0; - static char *__pyx_argnames[] = {"b",0}; - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_b))) return -1; - Py_INCREF((PyObject *)__pyx_v_self); - Py_INCREF(__pyx_v_b); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5_geos_ndarray, 1, "b"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;} - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":225 - * # make sure data is contiguous. - * # if not, make a local copy. - * if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<< - * b = b.copy() - * - */ - __pyx_1 = (!PyArray_ISCONTIGUOUS(__pyx_v_b)); - if (__pyx_1) { - __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;} - __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_5_geos_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;} - Py_DECREF(((PyObject *)__pyx_v_b)); - __pyx_v_b = ((PyArrayObject *)__pyx_3); - __pyx_3 = 0; - goto __pyx_L2; - } - __pyx_L2:; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":228 - * b = b.copy() - * - * m = b.shape[0] # <<<<<<<<<<<<<< - * - * # Add closing coordinates to sequence? - */ - __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;} - if (PyList_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_2)) { - __pyx_4 = PyList_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4); - } else if (PyTuple_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_2)) { - __pyx_4 = PyTuple_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4); - } else { - __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;} - __pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_v_m = __pyx_5; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap-testing/src/_geos.pyx":231 - * - * # Add closing coordinates to sequence? - * if b[-1,0] != b[0,0] or b[-1,1] != b[0,1]: # <<<<<<<<<<<<<< - * M = m + 1 - * else: - */ - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_INCREF(__pyx_num_neg_1); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_num_neg_1); - Py_INCREF(__pyx_num_0); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_num_0); - __pyx_4 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_INCREF(__pyx_num_0); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_num_0); - Py_INCREF(__pyx_num_0); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_num_0); - __pyx_6 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_3); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_2 = PyObject_RichCompare(__pyx_4, __pyx_6, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - if (!__pyx_1) { - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_INCREF(__pyx_num_neg_1); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_num_neg_1); - Py_INCREF(__pyx_num_1); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_num_1); - __pyx_4 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_6 = PyTuple_New(2); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_INCREF(__pyx_num_0); - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_num_0); - Py_INCREF(__pyx_num_1); - PyTuple_SET_ITEM(__pyx_6, 1, __pyx_num_1); - __pyx_3 = PyObject_GetItem(((PyObject *)__pyx_v_b), __pyx_6); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_2 = PyObject_RichCompare(__pyx_4, __pyx_3, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_... [truncated message content] |
From: <js...@us...> - 2008-02-15 13:16:58
|
Revision: 4968 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4968&view=rev Author: jswhit Date: 2008-02-15 05:16:54 -0800 (Fri, 15 Feb 2008) Log Message: ----------- add warpimage method. Modified Paths: -------------- trunk/toolkits/basemap/MANIFEST.in trunk/toolkits/basemap/examples/README trunk/toolkits/basemap/examples/warpimage.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py trunk/toolkits/basemap/setup.py Added Paths: ----------- trunk/toolkits/basemap/examples/earth_lights_lrg.jpg trunk/toolkits/basemap/lib/mpl_toolkits/basemap/data/bmng.jpg Removed Paths: ------------- trunk/toolkits/basemap/examples/bmng.jpg Modified: trunk/toolkits/basemap/MANIFEST.in =================================================================== --- trunk/toolkits/basemap/MANIFEST.in 2008-02-14 23:18:09 UTC (rev 4967) +++ trunk/toolkits/basemap/MANIFEST.in 2008-02-15 13:16:54 UTC (rev 4968) @@ -49,7 +49,7 @@ include examples/run_all.py include examples/polarmaps.py include examples/warpimage.py -include examples/bmng.jpg +include examples/earth_lights_lrg.jpg include examples/pnganim.py include examples/garp.py include examples/setwh.py Modified: trunk/toolkits/basemap/examples/README =================================================================== --- trunk/toolkits/basemap/examples/README 2008-02-14 23:18:09 UTC (rev 4967) +++ trunk/toolkits/basemap/examples/README 2008-02-15 13:16:54 UTC (rev 4968) @@ -81,8 +81,8 @@ projections (prefixed by 'np' and 'sp'). warpimage.py shows how to interpolate (warp) an image from one -map projection to another. Requires PIL, and an image from -http://www.space-graphics.com/earth_topo-bathy.htm, +map projection to another using the 'warpimage' Basemap method. +Requires PIL. garp.py makes a 'World According to Garp' map - an azimuthal equidistant projection centered on a specified location. Straight lines from that Deleted: trunk/toolkits/basemap/examples/bmng.jpg =================================================================== (Binary files differ) Added: trunk/toolkits/basemap/examples/earth_lights_lrg.jpg =================================================================== (Binary files differ) Property changes on: trunk/toolkits/basemap/examples/earth_lights_lrg.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/toolkits/basemap/examples/warpimage.py =================================================================== --- trunk/toolkits/basemap/examples/warpimage.py 2008-02-14 23:18:09 UTC (rev 4967) +++ trunk/toolkits/basemap/examples/warpimage.py 2008-02-15 13:16:54 UTC (rev 4968) @@ -1,53 +1,35 @@ import pylab as P import numpy -from mpl_toolkits.basemap import Basemap as Basemap1 -from numpy import ma +from mpl_toolkits.basemap import Basemap -class Basemap(Basemap1): - # subclass Basemap and add bluemarble method. - def bluemarble(self,masked=False): - """display 'blue marble next generation' image from http://visibleearth.nasa.gov/""" - try: - from PIL import Image - except ImportError: - raise ImportError('bluemarble method requires PIL (http://www.pythonware.com/products/pil/)') - from matplotlib.image import pil_to_array - - # read in jpeg image to rgba array of normalized floats. - pilImage = Image.open('bmng.jpg') - rgba = pil_to_array(pilImage) - rgba = rgba.astype(numpy.float32)/255. # convert to normalized floats. - - # define lat/lon grid that image spans (projection='cyl'). - nlons = rgba.shape[1]; nlats = rgba.shape[0] - delta = 360./float(nlons) - lons = numpy.arange(-180.+0.5*delta,180.,delta) - lats = numpy.arange(-90.+0.5*delta,90.,delta) +# illustrate use of warpimage method to display an image background +# on the map projection region. Default background is the 'blue +# marble' image from NASA (http://visibleearth.nasa.gov). - if self.projection != 'cyl': - # transform to nx x ny regularly spaced native projection grid - # nx and ny chosen to have roughly the same horizontal res as original image. - dx = 2.*numpy.pi*m.rmajor/float(nlons) - nx = int((self.xmax-self.xmin)/dx)+1; ny = int((self.ymax-self.ymin)/dx)+1 - rgba_warped = ma.zeros((ny,nx,4),numpy.float64) - # interpolate rgba values from proj='cyl' (geographic coords) to 'lcc' - # if masked=True, values outside of projection limb will be masked. - for k in range(4): - rgba_warped[:,:,k] = self.transform_scalar(rgba[:,:,k],lons,lats,nx,ny,masked=masked) - # make points outside projection limb transparent. - rgba_warped = rgba_warped.filled(0.) - # plot warped rgba image. - im = self.imshow(rgba_warped) - else: - im = self.imshow(rgba) - return im +# create new figure +fig=P.figure() +# define orthographic projection centered on North America. +m = Basemap(projection='ortho',lat_0=40,lon_0=-100,resolution='l') +# display a non-default image. +m.warpimage(file='earth_lights_lrg.jpg') +# draw coastlines. +m.drawcoastlines(linewidth=0.5,color='0.5') +# draw lat/lon grid lines every 30 degrees. +m.drawmeridians(numpy.arange(0,360,30),color='0.5') +m.drawparallels(numpy.arange(-90,90,30),color='0.5') +P.title("Lights at Night image warped from 'cyl' to 'ortho' projection",fontsize=12) +print 'warp to orthographic map ...' +# redisplay should be fast. +fig = P.figure() +m.warpimage() + # create new figure fig=P.figure() # define cylindrical equidistant projection. m = Basemap(projection='cyl',llcrnrlon=-180,llcrnrlat=-90,urcrnrlon=180,urcrnrlat=90,resolution='l') # plot (unwarped) rgba image. -im = m.bluemarble() +im = m.warpimage() # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines. @@ -58,10 +40,10 @@ # create new figure fig=P.figure() -# define orthographic projection centered on North America. +# define orthographic projection centered on Europe. m = Basemap(projection='ortho',lat_0=40,lon_0=40,resolution='l') # plot warped rgba image. -im = m.bluemarble(masked=True) +im = m.warpimage(masked=True) # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines every 30 degrees. @@ -76,7 +58,7 @@ m = Basemap(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\ rsphere=(6378137.00,6356752.3142),lat_1=50.,lon_0=-107.,\ resolution='i',area_thresh=1000.,projection='lcc') -im = m.bluemarble() +im = m.warpimage() # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw parallels and meridians. @@ -95,7 +77,7 @@ resolution=None,projection='omerc',\ lon_0=-100,lat_0=15,lon_2=-120,lat_2=65,lon_1=-50,lat_1=-55) # plot warped rgba image. -im = m.bluemarble() +im = m.warpimage() # draw lat/lon grid lines every 20 degrees. m.drawmeridians(numpy.arange(0,360,20),color='0.5') m.drawparallels(numpy.arange(-80,81,20),color='0.5') Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-02-14 23:18:09 UTC (rev 4967) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-02-15 13:16:54 UTC (rev 4968) @@ -2674,6 +2674,84 @@ im = self.imshow(rgba,interpolation='nearest',ax=ax,**kwargs) return im + def warpimage(self,file=None,**kwargs): + """ + display an image (given by file keyword) as a background. + Default (if file not specified) is to display + 'blue marble next generation' image from http://visibleearth.nasa.gov/. + Specified image must have pixels covering the whole globe in a regular + lat/lon grid, starting and -180W and the South Pole. + extra keyword 'ax' can be used to override the default axis instance. + """ + try: + from PIL import Image + except ImportError: + raise ImportError('bluemarble method requires PIL (http://www.pythonware.com/products/pil/)') + from matplotlib.image import pil_to_array + if not kwargs.has_key('ax') and self.ax is None: + try: + ax = pylab.gca() + except: + import pylab + ax = pylab.gca() + elif not kwargs.has_key('ax') and self.ax is not None: + ax = self.ax + else: + ax = kwargs.pop('ax') + # default image file is blue marble next generation + # from NASA (http://visibleearth.nasa.gov). + if file is None: + file = os.path.join(basemap_datadir,'bmng.jpg') + newfile = False + else: + newfile = True + # read in jpeg image to rgba array of normalized floats. + if not hasattr(self,'bm_rgba') or newfile: + pilImage = Image.open(file) + self.bm_rgba = pil_to_array(pilImage) + # convert to normalized floats. + self.bm_rgba = self.bm_rgba.astype(npy.float32)/255. + # define lat/lon grid that image spans. + nlons = self.bm_rgba.shape[1]; nlats = self.bm_rgba.shape[0] + delta = 360./float(nlons) + self.bm_lons = npy.arange(-180.+0.5*delta,180.,delta) + self.bm_lats = npy.arange(-90.+0.5*delta,90.,delta) + + if self.projection != 'cyl': + if newfile or not hasattr(self,'bm_rgba_warped'): + # transform to nx x ny regularly spaced native + # projection grid. + # nx and ny chosen to have roughly the + # same horizontal res as original image. + dx = 2.*npy.pi*self.rmajor/float(nlons) + nx = int((self.xmax-self.xmin)/dx)+1 + ny = int((self.ymax-self.ymin)/dx)+1 + self.bm_rgba_warped = npy.zeros((ny,nx,4),npy.float64) + # interpolate rgba values from geographic coords (proj='cyl') + # to map projection coords. + # if masked=True, values outside of + # projection limb will be masked. + for k in range(4): + self.bm_rgba_warped[:,:,k],x,y = \ + self.transform_scalar(self.bm_rgba[:,:,k],\ + self.bm_lons,self.bm_lats,nx,ny,returnxy=True) + # for ortho,geos mask pixels outside projection limb. + if self.projection in ['geos','ortho']: + lonsr,latsr = self(x,y,inverse=True) + mask = ma.zeros((nx,ny,4),npy.int8) + mask[:,:,0] = npy.logical_or(lonsr>1.e20,latsr>1.e30) + for k in range(1,4): + mask[:,:,k] = mask[:,:,0] + self.bm_rgba_warped = \ + ma.masked_array(self.bm_rgba_warped,mask=mask) + # make points outside projection limb transparent. + self.bm_rgba_warped = self.bm_rgba_warped.filled(0.) + # plot warped rgba image. + im = self.imshow(self.bm_rgba_warped,ax=ax) + else: + im = self.imshow(self.bm_rgba,ax=ax) + return im + ### End of Basemap class def _searchlist(a,x): Added: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/data/bmng.jpg =================================================================== (Binary files differ) Property changes on: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/data/bmng.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/toolkits/basemap/setup.py =================================================================== --- trunk/toolkits/basemap/setup.py 2008-02-14 23:18:09 UTC (rev 4967) +++ trunk/toolkits/basemap/setup.py 2008-02-15 13:16:54 UTC (rev 4968) @@ -137,7 +137,7 @@ package_dirs['httlib2'] = os.path.join('lib','httplib2') # Specify all the required mpl data -pyproj_datafiles = ['data/epsg', 'data/esri', 'data/esri.extra', 'data/GL27', 'data/nad.lst', 'data/nad27', 'data/nad83', 'data/ntv2_out.dist', 'data/other.extra', 'data/pj_out27.dist', 'data/pj_out83.dist', 'data/proj_def.dat', 'data/README', 'data/td_out.dist', 'data/test27', 'data/test83', 'data/testntv2', 'data/testvarious', 'data/world'] +pyproj_datafiles = ['data/epsg', 'data/esri', 'data/esri.extra', 'data/GL27', 'data/nad.lst', 'data/nad27', 'data/nad83', 'data/ntv2_out.dist', 'data/other.extra', 'data/pj_out27.dist', 'data/pj_out83.dist', 'data/proj_def.dat', 'data/README', 'data/td_out.dist', 'data/test27', 'data/test83', 'data/testntv2', 'data/testvarious', 'data/world','data/bmng.jpg'] boundaryfiles = [] for resolution in ['c','l','i','h','f']: boundaryfiles = boundaryfiles + glob.glob("lib/mpl_toolkits/basemap/data/*_"+resolution+".dat") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-02-15 13:43:25
|
Revision: 4970 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4970&view=rev Author: jswhit Date: 2008-02-15 05:43:19 -0800 (Fri, 15 Feb 2008) Log Message: ----------- added warpimage method Modified Paths: -------------- trunk/toolkits/basemap/README trunk/toolkits/basemap/examples/run_all.py Modified: trunk/toolkits/basemap/README =================================================================== --- trunk/toolkits/basemap/README 2008-02-15 13:17:50 UTC (rev 4969) +++ trunk/toolkits/basemap/README 2008-02-15 13:43:19 UTC (rev 4970) @@ -16,6 +16,9 @@ setuptools (only if your are using python 2.3) +PIL (http://pythonware.com/products/pil) is optional (only +needed for Basemap warpimage method). + **Copyright** source code from proj.4 (http://proj.maptools.org) is included in the Modified: trunk/toolkits/basemap/examples/run_all.py =================================================================== --- trunk/toolkits/basemap/examples/run_all.py 2008-02-15 13:17:50 UTC (rev 4969) +++ trunk/toolkits/basemap/examples/run_all.py 2008-02-15 13:43:19 UTC (rev 4970) @@ -5,7 +5,6 @@ test_files.remove('plotsst.py') test_files.remove('testgdal.py') test_files.remove('pnganim.py') -test_files.remove('warpimage.py') test_files.remove('geos_demo_2.py') print test_files py_path = os.environ.get('PYTHONPATH') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-02-15 15:47:50
|
Revision: 4972 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4972&view=rev Author: jswhit Date: 2008-02-15 07:47:46 -0800 (Fri, 15 Feb 2008) Log Message: ----------- added "bluemarble" method, make sure data is cached correctly in warpimage. Modified Paths: -------------- trunk/toolkits/basemap/examples/README trunk/toolkits/basemap/examples/warpimage.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/examples/README =================================================================== --- trunk/toolkits/basemap/examples/README 2008-02-15 13:45:41 UTC (rev 4971) +++ trunk/toolkits/basemap/examples/README 2008-02-15 15:47:46 UTC (rev 4972) @@ -80,9 +80,8 @@ stereographic, lambert azimuthal equal area, azimuthal equidistant projections (prefixed by 'np' and 'sp'). -warpimage.py shows how to interpolate (warp) an image from one -map projection to another using the 'warpimage' Basemap method. -Requires PIL. +warpimage.py shows how to use an image as a map background with the +'warpimage' and 'bluemarble' Basemap methods. Requires PIL. garp.py makes a 'World According to Garp' map - an azimuthal equidistant projection centered on a specified location. Straight lines from that Modified: trunk/toolkits/basemap/examples/warpimage.py =================================================================== --- trunk/toolkits/basemap/examples/warpimage.py 2008-02-15 13:45:41 UTC (rev 4971) +++ trunk/toolkits/basemap/examples/warpimage.py 2008-02-15 15:47:46 UTC (rev 4972) @@ -11,7 +11,7 @@ # define orthographic projection centered on North America. m = Basemap(projection='ortho',lat_0=40,lon_0=-100,resolution='l') # display a non-default image. -m.warpimage(file='earth_lights_lrg.jpg') +m.warpimage(image='earth_lights_lrg.jpg') # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines every 30 degrees. @@ -20,16 +20,16 @@ P.title("Lights at Night image warped from 'cyl' to 'ortho' projection",fontsize=12) print 'warp to orthographic map ...' -# redisplay should be fast. +# redisplay (same image specified) should be fast since data is cached. fig = P.figure() -m.warpimage() +m.warpimage(image='earth_lights_lrg.jpg') # create new figure fig=P.figure() # define cylindrical equidistant projection. m = Basemap(projection='cyl',llcrnrlon=-180,llcrnrlat=-90,urcrnrlon=180,urcrnrlat=90,resolution='l') # plot (unwarped) rgba image. -im = m.warpimage() +im = m.bluemarble() # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines. @@ -43,7 +43,7 @@ # define orthographic projection centered on Europe. m = Basemap(projection='ortho',lat_0=40,lon_0=40,resolution='l') # plot warped rgba image. -im = m.warpimage(masked=True) +im = m.bluemarble() # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw lat/lon grid lines every 30 degrees. @@ -58,7 +58,7 @@ m = Basemap(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\ rsphere=(6378137.00,6356752.3142),lat_1=50.,lon_0=-107.,\ resolution='i',area_thresh=1000.,projection='lcc') -im = m.warpimage() +im = m.bluemarble() # draw coastlines. m.drawcoastlines(linewidth=0.5,color='0.5') # draw parallels and meridians. @@ -77,7 +77,7 @@ resolution=None,projection='omerc',\ lon_0=-100,lat_0=15,lon_2=-120,lat_2=65,lon_1=-50,lat_1=-55) # plot warped rgba image. -im = m.warpimage() +im = m.bluemarble() # draw lat/lon grid lines every 20 degrees. m.drawmeridians(numpy.arange(0,360,20),color='0.5') m.drawparallels(numpy.arange(-80,81,20),color='0.5') Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-02-15 13:45:41 UTC (rev 4971) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-02-15 15:47:46 UTC (rev 4972) @@ -2674,8 +2674,18 @@ im = self.imshow(rgba,interpolation='nearest',ax=ax,**kwargs) return im - def warpimage(self,file=None,**kwargs): + def bluemarble(self,ax=None): """ + display blue marble image (from http://visibleearth.nasa.gov) + as map background. + """ + if ax is not None: + self.warpimage(image='bluemarble',ax=ax) + else: + self.warpimage(image='bluemarble') + + def warpimage(self,image="bluemarble",**kwargs): + """ display an image (given by file keyword) as a background. Default (if file not specified) is to display 'blue marble next generation' image from http://visibleearth.nasa.gov/. @@ -2700,25 +2710,31 @@ ax = kwargs.pop('ax') # default image file is blue marble next generation # from NASA (http://visibleearth.nasa.gov). - if file is None: + if image == "bluemarble": file = os.path.join(basemap_datadir,'bmng.jpg') - newfile = False else: + file = image + # if image is same as previous invocation, used cached data. + # if not, regenerate rgba data. + if not hasattr(self,'_bm_file') or self._bm_file != file: newfile = True + else: + newfile = False + self._bm_file = file # read in jpeg image to rgba array of normalized floats. - if not hasattr(self,'bm_rgba') or newfile: - pilImage = Image.open(file) - self.bm_rgba = pil_to_array(pilImage) + if not hasattr(self,'_bm_rgba') or newfile: + pilImage = Image.open(self._bm_file) + self._bm_rgba = pil_to_array(pilImage) # convert to normalized floats. - self.bm_rgba = self.bm_rgba.astype(npy.float32)/255. + self._bm_rgba = self._bm_rgba.astype(npy.float32)/255. # define lat/lon grid that image spans. - nlons = self.bm_rgba.shape[1]; nlats = self.bm_rgba.shape[0] + nlons = self._bm_rgba.shape[1]; nlats = self._bm_rgba.shape[0] delta = 360./float(nlons) - self.bm_lons = npy.arange(-180.+0.5*delta,180.,delta) - self.bm_lats = npy.arange(-90.+0.5*delta,90.,delta) + self._bm_lons = npy.arange(-180.+0.5*delta,180.,delta) + self._bm_lats = npy.arange(-90.+0.5*delta,90.,delta) if self.projection != 'cyl': - if newfile or not hasattr(self,'bm_rgba_warped'): + if newfile or not hasattr(self,'_bm_rgba_warped'): # transform to nx x ny regularly spaced native # projection grid. # nx and ny chosen to have roughly the @@ -2726,15 +2742,15 @@ dx = 2.*npy.pi*self.rmajor/float(nlons) nx = int((self.xmax-self.xmin)/dx)+1 ny = int((self.ymax-self.ymin)/dx)+1 - self.bm_rgba_warped = npy.zeros((ny,nx,4),npy.float64) + self._bm_rgba_warped = npy.zeros((ny,nx,4),npy.float64) # interpolate rgba values from geographic coords (proj='cyl') # to map projection coords. # if masked=True, values outside of # projection limb will be masked. for k in range(4): - self.bm_rgba_warped[:,:,k],x,y = \ - self.transform_scalar(self.bm_rgba[:,:,k],\ - self.bm_lons,self.bm_lats,nx,ny,returnxy=True) + self._bm_rgba_warped[:,:,k],x,y = \ + self.transform_scalar(self._bm_rgba[:,:,k],\ + self._bm_lons,self._bm_lats,nx,ny,returnxy=True) # for ortho,geos mask pixels outside projection limb. if self.projection in ['geos','ortho']: lonsr,latsr = self(x,y,inverse=True) @@ -2742,14 +2758,14 @@ mask[:,:,0] = npy.logical_or(lonsr>1.e20,latsr>1.e30) for k in range(1,4): mask[:,:,k] = mask[:,:,0] - self.bm_rgba_warped = \ - ma.masked_array(self.bm_rgba_warped,mask=mask) + self._bm_rgba_warped = \ + ma.masked_array(self._bm_rgba_warped,mask=mask) # make points outside projection limb transparent. - self.bm_rgba_warped = self.bm_rgba_warped.filled(0.) + self._bm_rgba_warped = self._bm_rgba_warped.filled(0.) # plot warped rgba image. - im = self.imshow(self.bm_rgba_warped,ax=ax) + im = self.imshow(self._bm_rgba_warped,ax=ax) else: - im = self.imshow(self.bm_rgba,ax=ax) + im = self.imshow(self._bm_rgba,ax=ax) return im ### End of Basemap class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-03-04 21:59:47
|
Revision: 4992 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4992&view=rev Author: jswhit Date: 2008-03-04 13:59:45 -0800 (Tue, 04 Mar 2008) Log Message: ----------- added drawmapscale method. Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/README trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-02-29 14:04:48 UTC (rev 4991) +++ trunk/toolkits/basemap/Changelog 2008-03-04 21:59:45 UTC (rev 4992) @@ -1,4 +1,6 @@ version 0.99 + * added drawmapscale method to create a map scale bar similar + to that available with the GMT's psbasemap. * Now lives in mpl_toolkits.basemap. Instead of 'from matplotlib.toolkits.basemap import Basemap', use 'from mpl_toolkits.basemap import Basemap'. Modified: trunk/toolkits/basemap/README =================================================================== --- trunk/toolkits/basemap/README 2008-02-29 14:04:48 UTC (rev 4991) +++ trunk/toolkits/basemap/README 2008-03-04 21:59:45 UTC (rev 4992) @@ -114,5 +114,6 @@ Scott Sinclair Ivan Lima Erik Andersen +Michael Hearne for valuable contributions. Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-02-29 14:04:48 UTC (rev 4991) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-03-04 21:59:45 UTC (rev 4992) @@ -2768,6 +2768,176 @@ im = self.imshow(self._bm_rgba,ax=ax) return im + def drawmapscale(self,lon,lat,lon0,lat0,length,barstyle='simple',\ + units='km',fontsize=9,yoffset=None,labelstyle='simple',\ + fontcolor='k',fillcolor1='w',fillcolor2='k',ax=None): + """ + draw a map scale at lon,lat representing distance in the map + projection coordinates at lon0,lat0. The length of the scale + is specified by the length argument, with units given by the units + keyword (default 'km'). Two styles of scale bar are available + (specified by the labelstyle keyword) - 'simple' and 'fancy', which + correspond roughly to the corresponding styles provided by + the Generic Mapping Tools software. Default is 'simple'. + + The fontsize and color of the map scale annotations can be specified + with the fontsize (default 9) and fontcolor (default black) keywords. + + labelstyle='simple' results in basic annotation (the units on top + of the scalebar and the distance below). This is the default. + If labelstyle='fancy' the map scale factor (ratio between + the actual distance and map projection distance at lon0,lat0) and + the value of lon0,lat0 are also printed on top of the scale bar. + + yoffset controls how tall the scale bar is, and how far the annotations + are offset from the scale bar. Default is 0.02 times the height of the map + (0.02*(self.ymax-self.ymin)). + + fillcolor1 and fillcolor2 are only relevant for the 'fancy' scale bar. + They are the colors of the alternating filled regions (default white + and black). + """ + # get current axes instance (if none specified). + if ax is None and self.ax is None: + try: + ax = pylab.gca() + except: + import pylab + ax = pylab.gca() + elif ax is None and self.ax is not None: + ax = self.ax + # not valid for cylindrical projection + if self.projection == 'cyl': + raise ValueError("cannot draw map scale for projection='cyl'") + # convert length to meters + if units == 'km': + lenlab = length + length = length*1000 + elif units == 'mi': + lenlab = length + length = length*1609.344 + elif units == 'nmi': + lenlab = length + length = length*1852 + else: + msg = "units must be 'km' (kilometers), "\ + "'mi' (miles) or 'nmi' (nautical miles)" + raise KeyError(msg) + # reference point and center of scale. + x0,y0 = self(lon0,lat0) + xc,yc = self(lon,lat) + # make sure lon_0 between -180 and 180 + lon_0 = ((lon0+360) % 360) - 360 + if lat0>0: + if lon>0: + lonlatstr = u'%g\N{DEGREE SIGN}N, %g\N{DEGREE SIGN}E' % (lat0,lon_0) + elif lon<0: + lonlatstr = u'%g\N{DEGREE SIGN}N, %g\N{DEGREE SIGN}W' % (lat0,lon_0) + else: + lonlatstr = u'%g\N{DEGREE SIGN}, %g\N{DEGREE SIGN}W' % (lat0,lon_0) + else: + if lon>0: + lonlatstr = u'%g\N{DEGREE SIGN}S, %g\N{DEGREE SIGN}E' % (lat0,lon_0) + elif lon<0: + lonlatstr = u'%g\N{DEGREE SIGN}S, %g\N{DEGREE SIGN}W' % (lat0,lon_0) + else: + lonlatstr = u'%g\N{DEGREE SIGN}S, %g\N{DEGREE SIGN}' % (lat0,lon_0) + # left edge of scale + lon1,lat1 = self(x0-length/2,y0,inverse=True) + x1,y1 = self(lon1,lat1) + # right edge of scale + lon4,lat4 = self(x0+length/2,y0,inverse=True) + x4,y4 = self(lon4,lat4) + x1 = x1-x0+xc; y1 = y1-y0+yc + x4 = x4-x0+xc; y4 = y4-y0+yc + if x1 > 1.e20 or x4 > 1.e20 or y1 > 1.e20 or y4 > 1.e20: + raise ValueError("scale bar positioned outside projection limb") + # scale factor for true distance + gc = pyproj.Geod(a=self.rmajor,b=self.rminor) + az12,az21,dist = gc.inv(lon1,lat1,lon4,lat4) + scalefact = dist/length + # label to put on top of scale bar. + if labelstyle=='simple': + labelstr = units + elif labelstyle == 'fancy': + labelstr = units+" (scale factor %4.2f at %s)"%(scalefact,lonlatstr) + else: + raise KeyError("labelstyle must be 'simple' or 'fancy'") + # default y offset is 2 percent of map height. + if yoffset is None: yoffset = 0.02*(self.ymax-self.ymin) + # 'fancy' style + if barstyle == 'fancy': + #we need 5 sets of x coordinates (in map units) + #quarter scale + lon2,lat2 = self(x0-length/4,y0,inverse=True) + x2,y2 = self(lon2,lat2) + x2 = x2-x0+xc; y2 = y2-y0+yc + #three quarter scale + lon3,lat3 = self(x0+length/4,y0,inverse=True) + x3,y3 = self(lon3,lat3) + x3 = x3-x0+xc; y3 = y3-y0+yc + #plot top line + ytop = yc+yoffset/2 + ybottom = yc-yoffset/2 + ytick = ybottom - yoffset/2 + ytext = ytick - yoffset/2 + self.plot([x1,x4],[ytop,ytop],color=fontcolor) + #plot bottom line + self.plot([x1,x4],[ybottom,ybottom],color=fontcolor) + #plot left edge + self.plot([x1,x1],[ybottom,ytop],color=fontcolor) + #plot right edge + self.plot([x4,x4],[ybottom,ytop],color=fontcolor) + #make a filled black box from left edge to 1/4 way across + ax.fill([x1,x2,x2,x1,x1],[ytop,ytop,ybottom,ybottom,ytop],\ + ec=fontcolor,fc=fillcolor1) + #make a filled white box from 1/4 way across to 1/2 way across + ax.fill([x2,xc,xc,x2,x2],[ytop,ytop,ybottom,ybottom,ytop],\ + ec=fontcolor,fc=fillcolor2) + #make a filled white box from 1/2 way across to 3/4 way across + ax.fill([xc,x3,x3,xc,xc],[ytop,ytop,ybottom,ybottom,ytop],\ + ec=fontcolor,fc=fillcolor1) + #make a filled white box from 3/4 way across to end + ax.fill([x3,x4,x4,x3,x3],[ytop,ytop,ybottom,ybottom,ytop],\ + ec=fontcolor,fc=fillcolor2) + #plot 3 tick marks at left edge, center, and right edge + self.plot([x1,x1],[ytick,ybottom],color=fontcolor) + self.plot([xc,xc],[ytick,ybottom],color=fontcolor) + self.plot([x4,x4],[ytick,ybottom],color=fontcolor) + #label 3 tick marks + ax.text(x1,ytext,'%d' % (0),\ + horizontalalignment='center',\ + verticalalignment='top',\ + fontsize=fontsize,color=fontcolor) + ax.text(xc,ytext,'%d' % (0.5*lenlab),\ + horizontalalignment='center',\ + verticalalignment='top',\ + fontsize=fontsize,color=fontcolor) + ax.text(x4,ytext,'%d' % (lenlab),\ + horizontalalignment='center',\ + verticalalignment='top',\ + fontsize=fontsize,color=fontcolor) + #put units, scale factor on top + ax.text(xc,ytop+yoffset/2,labelstr,\ + horizontalalignment='center',\ + verticalalignment='bottom',\ + fontsize=fontsize,color=fontcolor) + # 'simple' style + elif barstyle == 'simple': + self.plot([x1,x4],[yc,yc],color=fontcolor) + self.plot([x1,x1],[yc-yoffset,yc+yoffset],color=fontcolor) + self.plot([x4,x4],[yc-yoffset,yc+yoffset],color=fontcolor) + ax.text(xc,yc-yoffset,'%d' % lenlab,\ + verticalalignment='top',horizontalalignment='center',\ + fontsize=fontsize,color=fontcolor) + #put units, scale factor on top + ax.text(xc,yc+yoffset,labelstr,\ + horizontalalignment='center',\ + verticalalignment='bottom',\ + fontsize=fontsize,color=fontcolor) + else: + raise KeyError("barstyle must be 'simple' or 'fancy'") + ### End of Basemap class def _searchlist(a,x): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-03-13 16:27:21
|
Revision: 5001 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5001&view=rev Author: jswhit Date: 2008-03-13 09:27:17 -0700 (Thu, 13 Mar 2008) Log Message: ----------- updates suggested by Eric (see Changelog entries) Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-03-11 12:07:10 UTC (rev 5000) +++ trunk/toolkits/basemap/Changelog 2008-03-13 16:27:17 UTC (rev 5001) @@ -1,4 +1,11 @@ version 0.99 + * drawparallels and drawmeridians return a dictionary containing + the Line2D and Text instances associated with each lat or lon. + * drawcoastlines, drawcountries and friends now have + PatchCollection return values. + * make sure '_nolabel_' set on coastlines, countries, states, + rivers, parallels and meridians so they are not included in + a legend. * added drawmapscale method to create a map scale bar similar to that available with the GMT's psbasemap. * Now lives in mpl_toolkits.basemap. Instead Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-03-11 12:07:10 UTC (rev 5000) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-03-13 16:27:17 UTC (rev 5001) @@ -1068,6 +1068,7 @@ (default 0). ax - axes instance to use (default None, use default axes instance). + returns PatchCollection representing map boundary. """ # get current axes instance (if none specified). if ax is None and self.ax is None: @@ -1078,6 +1079,7 @@ ax = pylab.gca() elif ax is None and self.ax is not None: ax = self.ax + limb = None if self.projection == 'ortho': limb = Circle((self.rmajor,self.rmajor),self.rmajor) elif self.projection == 'geos': @@ -1115,16 +1117,16 @@ lats = npy.array(lats1+lats2+lats3+lats4,npy.float64) x, y = self(lons,lats) xy = zip(x,y) - poly = Polygon(xy,edgecolor=color,linewidth=linewidth) - ax.add_patch(poly) + limb = Polygon(xy,edgecolor=color,linewidth=linewidth) + ax.add_patch(limb) if fill_color is None: - poly.set_fill(False) + limb.set_fill(False) else: - poly.set_facecolor(fill_color) - poly.set_zorder(0) - poly.set_clip_on(False) + limb.set_facecolor(fill_color) + limb.set_zorder(0) + limb.set_clip_on(False) if zorder is not None: - poly.set_zorder(zorder) + limb.set_zorder(zorder) else: # all other projections are rectangular. ax.axesPatch.set_linewidth(linewidth) if self.projection not in ['geos','ortho']: @@ -1159,6 +1161,7 @@ limb.set_clip_on(True) # set axes limits to fit map region. self.set_axes_limits(ax=ax) + return limb def fillcontinents(self,color='0.8',lake_color=None,ax=None,zorder=None): """ @@ -1172,6 +1175,8 @@ over the filled continents). After filling continents, lakes are re-filled with axis background color. + + returns Polygon object. """ if self.resolution is None: raise AttributeError, 'there are no boundary datasets associated with this Basemap instance' @@ -1219,6 +1224,7 @@ np = np + 1 # set axes limits to fit map region. self.set_axes_limits(ax=ax) + return poly def drawcoastlines(self,linewidth=1.,color='k',antialiased=1,ax=None,zorder=None): """ @@ -1230,6 +1236,7 @@ ax - axes instance (overrides default axes instance) zorder - sets the zorder for the coastlines (if not specified, uses default zorder for LineCollections). + returns a LineCollection. """ if self.resolution is None: raise AttributeError, 'there are no boundary datasets associated with this Basemap instance' @@ -1245,11 +1252,13 @@ coastlines = LineCollection(self.coastsegs,antialiaseds=(antialiased,)) coastlines.set_color(color) coastlines.set_linewidth(linewidth) + coastlines.set_label('_nolabel_') if zorder is not None: coastlines.set_zorder(zorder) ax.add_collection(coastlines) # set axes limits to fit map region. self.set_axes_limits(ax=ax) + return coastlines def drawcountries(self,linewidth=0.5,color='k',antialiased=1,ax=None,zorder=None): """ @@ -1261,6 +1270,7 @@ ax - axes instance (overrides default axes instance) zorder - sets the zorder for the country boundaries (if not specified, uses default zorder for LineCollections). + returns a LineCollection. """ if self.resolution is None: raise AttributeError, 'there are no boundary datasets associated with this Basemap instance' @@ -1277,14 +1287,16 @@ ax = pylab.gca() elif ax is None and self.ax is not None: ax = self.ax - coastlines = LineCollection(self.cntrysegs,antialiaseds=(antialiased,)) - coastlines.set_color(color) - coastlines.set_linewidth(linewidth) + countries = LineCollection(self.cntrysegs,antialiaseds=(antialiased,)) + countries.set_color(color) + countries.set_linewidth(linewidth) + countries.set_label('_nolabel_') if zorder is not None: - coastlines.set_zorder(zorder) - ax.add_collection(coastlines) + countries.set_zorder(zorder) + ax.add_collection(countries) # set axes limits to fit map region. self.set_axes_limits(ax=ax) + return countries def drawstates(self,linewidth=0.5,color='k',antialiased=1,ax=None,zorder=None): """ @@ -1296,6 +1308,7 @@ ax - axes instance (overrides default axes instance) zorder - sets the zorder for the state boundaries (if not specified, uses default zorder for LineCollections). + returns a LineCollection. """ if self.resolution is None: raise AttributeError, 'there are no boundary datasets associated with this Basemap instance' @@ -1312,14 +1325,16 @@ ax = pylab.gca() elif ax is None and self.ax is not None: ax = self.ax - coastlines = LineCollection(self.statesegs,antialiaseds=(antialiased,)) - coastlines.set_color(color) - coastlines.set_linewidth(linewidth) + states = LineCollection(self.statesegs,antialiaseds=(antialiased,)) + states.set_color(color) + states.set_linewidth(linewidth) + states.set_label('_nolabel_') if zorder is not None: - coastlines.set_zorder(zorder) - ax.add_collection(coastlines) + states.set_zorder(zorder) + ax.add_collection(states) # set axes limits to fit map region. self.set_axes_limits(ax=ax) + return states def drawrivers(self,linewidth=0.5,color='k',antialiased=1,ax=None,zorder=None): """ @@ -1331,6 +1346,7 @@ ax - axes instance (overrides default axes instance) zorder - sets the zorder for the rivers (if not specified, uses default zorder for LineCollections). + returns a LineCollection """ if self.resolution is None: raise AttributeError, 'there are no boundary datasets associated with this Basemap instance' @@ -1347,14 +1363,16 @@ ax = pylab.gca() elif ax is None and self.ax is not None: ax = self.ax - coastlines = LineCollection(self.riversegs,antialiaseds=(antialiased,)) - coastlines.set_color(color) - coastlines.set_linewidth(linewidth) + rivers = LineCollection(self.riversegs,antialiaseds=(antialiased,)) + rivers.set_color(color) + rivers.set_linewidth(linewidth) + rivers.set_label('_nolabel_') if zorder is not None: - coastlines.set_zorder(zorder) - ax.add_collection(coastlines) + rivers.set_zorder(zorder) + ax.add_collection(rivers) # set axes limits to fit map region. self.set_axes_limits(ax=ax) + return rivers def readshapefile(self,shapefile,name,drawbounds=True,zorder=None, linewidth=0.5,color='k',antialiased=1,ax=None): @@ -1474,6 +1492,7 @@ lines = LineCollection(shpsegs,antialiaseds=(1,)) lines.set_color(color) lines.set_linewidth(linewidth) + lines.set_label('_nolabel_') if zorder is not None: lines.set_zorder(zorder) ax.add_collection(lines) @@ -1517,6 +1536,10 @@ additional keyword arguments control text properties for labels (see pylab.text documentation) + + returns a dictionary whose keys are the parallels, and + whose values are tuples containing lists of the Line2D and Text instances + associated with each parallel. """ # get current axes instance (if none specified). if ax is None and self.ax is None: @@ -1559,6 +1582,7 @@ circlesl.append(-latmax) xdelta = 0.01*(self.xmax-self.xmin) ydelta = 0.01*(self.ymax-self.ymin) + linecolls = {} for circ in circlesl: lats = circ*npy.ones(len(lons),npy.float32) x,y = self(lons,lats) @@ -1569,6 +1593,7 @@ testy = npy.logical_and(y>=self.ymin-ydelta,y<=self.ymax+ydelta) x = npy.compress(testy, x) y = npy.compress(testy, y) + lines = [] if len(x) > 1 and len(y) > 1: # split into separate line segments if necessary. # (not necessary for mercator or cylindrical or miller). @@ -1596,9 +1621,12 @@ l = Line2D(x,y,linewidth=linewidth) l.set_color(color) l.set_dashes(dashes) + l.set_label('_nolabel_') if zorder is not None: l.set_zorder(zorder) ax.add_line(l) + lines.append(l) + linecolls[circ] = (lines,[]) # draw labels for parallels # parallels not labelled for fulldisk orthographic or geostationary if self.projection in ['ortho','geos'] and max(labels): @@ -1688,27 +1716,33 @@ # don't bother if close to the first label. if i and abs(nr-nl) < 100: continue if n >= 0: + t = None if side == 'l': if self.projection in ['moll','robin','sinu']: xlab,ylab = self(lon_0-179.9,lat) else: xlab = self.llcrnrx xlab = xlab-xoffset - ax.text(xlab,yy[n],latlab,horizontalalignment='right',verticalalignment='center',**kwargs) + t = ax.text(xlab,yy[n],latlab,horizontalalignment='right',verticalalignment='center',**kwargs) elif side == 'r': if self.projection in ['moll','robin','sinu']: xlab,ylab = self(lon_0+179.9,lat) else: xlab = self.urcrnrx xlab = xlab+xoffset - ax.text(xlab,yy[n],latlab,horizontalalignment='left',verticalalignment='center',**kwargs) + t = ax.text(xlab,yy[n],latlab,horizontalalignment='left',verticalalignment='center',**kwargs) elif side == 'b': - ax.text(xx[n],self.llcrnry-yoffset,latlab,horizontalalignment='center',verticalalignment='top',**kwargs) + t = ax.text(xx[n],self.llcrnry-yoffset,latlab,horizontalalignment='center',verticalalignment='top',**kwargs) else: - ax.text(xx[n],self.urcrnry+yoffset,latlab,horizontalalignment='center',verticalalignment='bottom',**kwargs) + t = ax.text(xx[n],self.urcrnry+yoffset,latlab,horizontalalignment='center',verticalalignment='bottom',**kwargs) + if t is not None: linecolls[lat][1].append(t) # set axes limits to fit map region. self.set_axes_limits(ax=ax) + keys = linecolls.keys(); vals = linecolls.values() + for k,v in zip(keys,vals): + if v == ([], []): del linecolls[k] + return linecolls def drawmeridians(self,meridians,color='k',linewidth=1., zorder=None,\ dashes=[1,1],labels=[0,0,0,0],labelstyle=None,\ @@ -1741,6 +1775,10 @@ additional keyword arguments control text properties for labels (see pylab.text documentation) + + returns a dictionary whose keys are the meridians, and + whose values are tuples containing lists of the Line2D and Text instances + associated with each meridian. """ # get current axes instance (if none specified). if ax is None and self.ax is None: @@ -1769,6 +1807,7 @@ lats = npy.arange(-90,90.01,0.01) xdelta = 0.01*(self.xmax-self.xmin) ydelta = 0.01*(self.ymax-self.ymin) + linecolls = {} for merid in meridians: lons = merid*npy.ones(len(lats),npy.float32) x,y = self(lons,lats) @@ -1779,6 +1818,7 @@ testy = npy.logical_and(y>=self.ymin-ydelta,y<=self.ymax+ydelta) x = npy.compress(testy, x) y = npy.compress(testy, y) + lines = [] if len(x) > 1 and len(y) > 1: # split into separate line segments if necessary. # (not necessary for mercator or cylindrical or miller). @@ -1806,9 +1846,12 @@ l = Line2D(x,y,linewidth=linewidth) l.set_color(color) l.set_dashes(dashes) + l.set_label('_nolabel_') if zorder is not None: l.set_zorder(zorder) ax.add_line(l) + lines.append(l) + linecolls[merid] = (lines,[]) # draw labels for meridians. # meridians not labelled for sinusoidal, mollweide, or # or full-disk orthographic/geostationary. @@ -1906,19 +1949,26 @@ # don't bother if close to the first label. if i and abs(nr-nl) < 100: continue if n >= 0: + t = None if side == 'l': - ax.text(self.llcrnrx-xoffset,yy[n],lonlab,horizontalalignment='right',verticalalignment='center',**kwargs) + t = ax.text(self.llcrnrx-xoffset,yy[n],lonlab,horizontalalignment='right',verticalalignment='center',**kwargs) elif side == 'r': - ax.text(self.urcrnrx+xoffset,yy[n],lonlab,horizontalalignment='left',verticalalignment='center',**kwargs) + t = ax.text(self.urcrnrx+xoffset,yy[n],lonlab,horizontalalignment='left',verticalalignment='center',**kwargs) elif side == 'b': if self.projection != 'robin' or (xx[n] > xmin and xx[n] < xmax): - ax.text(xx[n],self.llcrnry-yoffset,lonlab,horizontalalignment='center',verticalalignment='top',**kwargs) + t = ax.text(xx[n],self.llcrnry-yoffset,lonlab,horizontalalignment='center',verticalalignment='top',**kwargs) else: if self.projection != 'robin' or (xx[n] > xmin and xx[n] < xmax): - ax.text(xx[n],self.urcrnry+yoffset,lonlab,horizontalalignment='center',verticalalignment='bottom',**kwargs) + t = ax.text(xx[n],self.urcrnry+yoffset,lonlab,horizontalalignment='center',verticalalignment='bottom',**kwargs) + if t is not None: linecolls[lon][1].append(t) # set axes limits to fit map region. self.set_axes_limits(ax=ax) + # remove empty values from linecolls dictionary + keys = linecolls.keys(); vals = linecolls.values() + for k,v in zip(keys,vals): + if v == ([], []): del linecolls[k] + return linecolls def gcpoints(self,lon1,lat1,lon2,lat2,npoints): """ @@ -1948,6 +1998,8 @@ Note: cannot handle situations in which the great circle intersects the edge of the map projection domain, and then re-enters the domain. + + Returns a Line2D object. """ # use great circle formula for a perfect sphere. gc = pyproj.Geod(a=self.rmajor,b=self.rminor) @@ -1960,7 +2012,7 @@ lats.append(lat) lons.append(lon2); lats.append(lat2) x, y = self(lons, lats) - self.plot(x,y,**kwargs) + return self.plot(x,y,**kwargs) def transform_scalar(self,datin,lons,lats,nx,ny,returnxy=False,checkbounds=False,order=1,masked=False): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-05-05 17:01:27
|
Revision: 5113 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5113&view=rev Author: jswhit Date: 2008-05-05 10:01:24 -0700 (Mon, 05 May 2008) Log Message: ----------- allow controlling package installation with setup.cfg Modified Paths: -------------- trunk/toolkits/basemap/MANIFEST.in trunk/toolkits/basemap/setup.py Added Paths: ----------- trunk/toolkits/basemap/setup.cfg Modified: trunk/toolkits/basemap/MANIFEST.in =================================================================== --- trunk/toolkits/basemap/MANIFEST.in 2008-05-05 15:13:23 UTC (rev 5112) +++ trunk/toolkits/basemap/MANIFEST.in 2008-05-05 17:01:24 UTC (rev 5113) @@ -8,6 +8,7 @@ include KNOWN_BUGS include Changelog include setup.py +include setup.cfg include setupegg.py include src/* include examples/simpletest.py Added: trunk/toolkits/basemap/setup.cfg =================================================================== --- trunk/toolkits/basemap/setup.cfg (rev 0) +++ trunk/toolkits/basemap/setup.cfg 2008-05-05 17:01:24 UTC (rev 5113) @@ -0,0 +1,10 @@ +[provide_packages] +# By default, basemap checks for a few dependencies and +# installs them if missing. This feature can be turned off +# by uncommenting the following lines. Acceptible values are: +# True: install, overwrite an existing installation +# False: do not install +# auto: install only if the package is unavailable. This +# is the default behavior +pydap = auto +httplib2 = auto Modified: trunk/toolkits/basemap/setup.py =================================================================== --- trunk/toolkits/basemap/setup.py 2008-05-05 15:13:23 UTC (rev 5112) +++ trunk/toolkits/basemap/setup.py 2008-05-05 17:01:24 UTC (rev 5113) @@ -1,3 +1,5 @@ +# basemap build options can be modified with the setup.cfg file. See +# setup.cfg for more information. import sys, glob, os, numpy major, minor1, minor2, s, tmp = sys.version_info if major==2 and minor1<=3: @@ -114,27 +116,68 @@ include_dirs = ["pyshapelib/shapelib"], define_macros = dbf_macros()) ] -# install dap and httplib2, if not already available. -# only a subset of dap is installed (the client, not the server) -__dapversion__ = None -try: - from dap.lib import __version__ as __dapversion__ -except ImportError: +# check setup.cfg file to see how to install auxilliary packages. +options = {} +if os.path.exists("setup.cfg"): + import ConfigParser + config = ConfigParser.SafeConfigParser() + config.read("setup.cfg") + try: options['provide_pydap'] = config.getboolean("provide_packages", "pydap") + except: options['provide_pydap'] = 'auto' + try: options['provide_httplib2'] = config.getboolean("provide_packages", "httplib2") + except: options['provide_httplib2'] = 'auto' +else: + options['provide_pydap'] = 'auto' + options['provide_httplib2'] = 'auto' + +provide_pydap = options['provide_pydap'] +if provide_pydap == 'auto': # install pydap stuff if not already available. + # only the client is installed (not the server). + __dapversion__ = None + print 'checking to see if required version of pydap installed ..' + try: + from dap.lib import __version__ as __dapversion__ + except ImportError: + print 'pydap not installed, client will be installed' + packages = packages + ['dap','dap.util','dap.parsers'] + package_dirs['dap'] = os.path.join('lib','dap') + else: + print 'pydap installed, checking version ...' + # install dap client anyway if installed version is older than + # version provided here. + if __dapversion__ is not None: + __dapversion__ = [repr(v)+'.' for v in __dapversion__] + __dapversion__ = ''.join(__dapversion__)[:-1] + if __dapversion__ < '2.2.6.2': + print 'required version of pydap not installed, client will be installed' + packages = packages + ['dap','dap.util','dap.parsers'] + package_dirs['dap'] = os.path.join('lib','dap') + else: + print 'pydap version OK, will not be installed' +elif provide_pydap: # force install of pydap stuff. + print 'forcing install of included pydap client' packages = packages + ['dap','dap.util','dap.parsers'] package_dirs['dap'] = os.path.join('lib','dap') -# install dap client anyway if installed version is older than -# version provided here. -if __dapversion__ is not None: - __dapversion__ = [repr(v)+'.' for v in __dapversion__] - __dapversion__ = ''.join(__dapversion__)[:-1] - if __dapversion__ < '2.2.6.2': - packages = packages + ['dap','dap.util','dap.parsers'] - package_dirs['dap'] = os.path.join('lib','dap') -try: - import httplib2 -except ImportError: +else: + print 'will not install pydap' + +provide_httplib2 = options['provide_httplib2'] +if provide_httplib2 == 'auto': + print 'checking to see if httplib2 installed ..' + try: + import httplib2 + except ImportError: + print 'httplib2 not installed, will be installed' + packages = packages + ['httplib2'] + package_dirs['httlib2'] = os.path.join('lib','httplib2') + else: + print 'httplib2 installed' +elif provide_httplib2: # force install of httplib2 + print 'forcing install of included httplib2' packages = packages + ['httplib2'] package_dirs['httlib2'] = os.path.join('lib','httplib2') +else: + print 'will not install httplib2' # Specify all the required mpl data pyproj_datafiles = ['data/epsg', 'data/esri', 'data/esri.extra', 'data/GL27', 'data/nad.lst', 'data/nad27', 'data/nad83', 'data/ntv2_out.dist', 'data/other.extra', 'data/pj_out27.dist', 'data/pj_out83.dist', 'data/proj_def.dat', 'data/README', 'data/td_out.dist', 'data/test27', 'data/test83', 'data/testntv2', 'data/testvarious', 'data/world','data/bmng.jpg'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-05-16 20:15:41
|
Revision: 5157 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5157&view=rev Author: jswhit Date: 2008-05-16 13:15:36 -0700 (Fri, 16 May 2008) Log Message: ----------- convert more examples to pyplot and numpy namespaces. Modified Paths: -------------- trunk/toolkits/basemap/examples/simpletest.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/examples/simpletest.py =================================================================== --- trunk/toolkits/basemap/examples/simpletest.py 2008-05-16 20:09:54 UTC (rev 5156) +++ trunk/toolkits/basemap/examples/simpletest.py 2008-05-16 20:15:36 UTC (rev 5157) @@ -1,22 +1,23 @@ from mpl_toolkits.basemap import Basemap -from pylab import load, show, title, meshgrid, cm, arange +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.mlab as mlab # read in topo data (on a regular lat/lon grid) -etopo=load('etopo20data.gz') -lons=load('etopo20lons.gz') -lats=load('etopo20lats.gz') +etopo=mlab.load('etopo20data.gz') +lons=mlab.load('etopo20lons.gz') +lats=mlab.load('etopo20lats.gz') # create Basemap instance for Robinson projection. m = Basemap(projection='robin',lon_0=0.5*(lons[0]+lons[-1])) # make filled contour plot. -x, y = m(*meshgrid(lons, lats)) -cs = m.contourf(x,y,etopo,30,cmap=cm.jet) +x, y = m(*np.meshgrid(lons, lats)) +cs = m.contourf(x,y,etopo,30,cmap=plt.cm.jet) # draw coastlines. m.drawcoastlines() # draw a line around the map region. m.drawmapboundary() # draw parallels and meridians. -m.drawparallels(arange(-60.,90.,30.),labels=[1,0,0,0]) -m.drawmeridians(arange(0.,420.,60.),labels=[0,0,0,1]) +m.drawparallels(np.arange(-60.,90.,30.),labels=[1,0,0,0]) +m.drawmeridians(np.arange(0.,420.,60.),labels=[0,0,0,1]) # add a title. -title('Robinson Projection') -show() - +plt.title('Robinson Projection') +plt.show() Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-05-16 20:09:54 UTC (rev 5156) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-05-16 20:15:36 UTC (rev 5157) @@ -305,23 +305,25 @@ Example Usage: >>> from mpl_toolkits.basemap import Basemap - >>> from pylab import load, meshgrid, title, arange, show + >>> import numpy as np + >>> import matplotlib.pyplot as plt + >>> import matplotlib.mlab as mlab >>> # read in topo data (on a regular lat/lon grid) - >>> etopo = load('etopo20data.gz') - >>> lons = load('etopo20lons.gz') - >>> lats = load('etopo20lats.gz') + >>> etopo = mlab.load('etopo20data.gz') + >>> lons = mlab.load('etopo20lons.gz') + >>> lats = mlab.load('etopo20lats.gz') >>> # create Basemap instance for Robinson projection. >>> m = Basemap(projection='robin',lon_0=0.5*(lons[0]+lons[-1])) >>> # compute native map projection coordinates for lat/lon grid. - >>> x, y = m(*meshgrid(lons,lats)) + >>> x, y = m(*np.meshgrid(lons,lats)) >>> # make filled contour plot. - >>> cs = m.contourf(x,y,etopo,30,cmap=cm.jet) + >>> cs = m.contourf(x,y,etopo,30,cmap=plt.cm.jet) >>> m.drawcoastlines() # draw coastlines >>> m.drawmapboundary() # draw a line around the map region - >>> m.drawparallels(arange(-90.,120.,30.),labels=[1,0,0,0]) # draw parallels - >>> m.drawmeridians(arange(0.,420.,60.),labels=[0,0,0,1]) # draw meridians - >>> title('Robinson Projection') # add a title - >>> show() + >>> m.drawparallels(np.arange(-90.,120.,30.),labels=[1,0,0,0]) # draw parallels + >>> m.drawmeridians(np.arange(0.,420.,60.),labels=[0,0,0,1]) # draw meridians + >>> plt.title('Robinson Projection') # add a title + >>> plt.show() [this example (simpletest.py) plus many others can be found in the examples directory of source distribution. The "OO" version of this This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-05-20 15:29:38
|
Revision: 5202 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5202&view=rev Author: jswhit Date: 2008-05-20 08:27:21 -0700 (Tue, 20 May 2008) Log Message: ----------- regenerate C source using newest version of Cython Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py trunk/toolkits/basemap/src/_geod.c trunk/toolkits/basemap/src/_geoslib.c trunk/toolkits/basemap/src/_proj.c Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py 2008-05-20 15:14:39 UTC (rev 5201) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py 2008-05-20 15:27:21 UTC (rev 5202) @@ -53,7 +53,7 @@ from array import array from types import TupleType, ListType, NoneType import os -import numpy as npy +import numpy as np pyproj_datadir = os.sep.join([os.path.dirname(__file__), 'data']) set_datapath(pyproj_datadir) @@ -159,8 +159,8 @@ radians = kw.get('radians', False) errcheck = kw.get('errcheck', False) if len(args) == 1: - latlon = npy.array(args[0], copy=True, - order='C', dtype=float, ndmin=2) + latlon = np.array(args[0], copy=True, + order='C', dtype=float, ndmin=2) if inverse: _Proj._invn(self, latlon, radians=radians, errcheck=errcheck) else: Modified: trunk/toolkits/basemap/src/_geod.c =================================================================== --- trunk/toolkits/basemap/src/_geod.c 2008-05-20 15:14:39 UTC (rev 5201) +++ trunk/toolkits/basemap/src/_geod.c 2008-05-20 15:27:21 UTC (rev 5202) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.9.6.9 on Tue Jan 1 07:25:28 2008 */ +/* Generated by Cython 0.9.6.14 on Tue May 20 09:25:55 2008 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -18,8 +18,10 @@ #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #endif -#ifndef WIN32 +#ifndef __stdcall #define __stdcall +#endif +#ifndef __cdecl #define __cdecl #endif #ifdef __cplusplus @@ -45,27 +47,33 @@ typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/ -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if (x == Py_False) return 0; - else return PyObject_IsTrue(x); -} +static int __pyx_skip_dispatch = 0; -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)) @@ -82,17 +90,33 @@ 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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *); /*proto*/ +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static inline PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (PyList_Append(L, x) < 0) return NULL; + Py_INCREF(Py_None); + return Py_None; // this is just to have an accurate signature + } + else { + return PyObject_CallMethod(L, "append", "(O)", x); + } +} + static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/ @@ -101,15 +125,9 @@ static void __Pyx_AddTraceback(char *funcname); /*proto*/ -static PyObject *__Pyx_ImportModule(char *name); /*proto*/ +/* Declarations */ -static int __Pyx_RegisterCleanup(); /*proto*/ -static PyObject* cleanup(PyObject *self, PyObject *unused); /*proto*/ -static PyMethodDef cleanup_def = {"__cleanup", (PyCFunction)&cleanup, METH_NOARGS, 0}; - -/* Declarations from _geod */ - -/* "/Users/jsw/python/pyproj/_geod.pyx":5 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":5 * include "_pyproj.pxi" * * cdef class Geod: # <<<<<<<<<<<<<< @@ -125,24 +143,12 @@ char *geodinitstring; }; - -/* "/Users/jsw/python/pyproj/_geod.pyx":5 - * include "_pyproj.pxi" - * - * cdef class Geod: # <<<<<<<<<<<<<< - * cdef GEODESIC_T geodesic_t - * cdef public object geodparams - */ - static PyTypeObject *__pyx_ptype_5_geod_Geod = 0; -static PyObject *__pyx_k3; -static PyObject *__pyx_k4; -static PyObject *__pyx_k5; /* Implementation of _geod */ -static char __pyx_k2[] = "1.8.4"; +static char __pyx_k_2[] = "1.8.4"; static PyObject *__pyx_n___cinit__; static PyObject *__pyx_n___reduce__; @@ -157,9 +163,9 @@ static PyObject *__pyx_n__doublesize; static PyObject *__pyx_n___version__; -static PyObject *__pyx_k2p; +static PyObject *__pyx_k_2p; -/* "/Users/jsw/python/pyproj/_geod.pyx":11 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":11 * cdef char *geodinitstring * * def __new__(self, geodparams): # <<<<<<<<<<<<<< @@ -172,17 +178,17 @@ static PyObject *__pyx_n_join; static PyObject *__pyx_n_RuntimeError; -static PyObject *__pyx_k6p; -static PyObject *__pyx_k7p; -static PyObject *__pyx_k8p; -static PyObject *__pyx_k9p; +static PyObject *__pyx_k_3p; +static PyObject *__pyx_k_4p; +static PyObject *__pyx_k_5p; +static PyObject *__pyx_k_6p; static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k6[] = "+"; -static char __pyx_k7[] = "="; -static char __pyx_k8[] = " "; -static char __pyx_k9[] = ""; +static char __pyx_k_3[] = "+"; +static char __pyx_k_4[] = "="; +static char __pyx_k_5[] = " "; +static char __pyx_k_6[] = ""; static int __pyx_pf_5_geod_4Geod___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_5_geod_4Geod___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -193,21 +199,28 @@ PyObject *__pyx_v_value; int __pyx_r; PyObject *__pyx_1 = 0; - Py_ssize_t __pyx_2; + Py_ssize_t __pyx_2 = 0; PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; - PyObject *__pyx_6 = 0; - int __pyx_7; + int __pyx_6; static char *__pyx_argnames[] = {"geodparams",0}; - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_geodparams))) return -1; - Py_INCREF(__pyx_v_self); - Py_INCREF(__pyx_v_geodparams); + if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 1)) { + __pyx_v_geodparams = PyTuple_GET_ITEM(__pyx_args, 0); + } + else { + if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_geodparams))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L2;} + } + goto __pyx_L3; + __pyx_L2:; + __Pyx_AddTraceback("_geod.Geod.__cinit__"); + return -1; + __pyx_L3:; __pyx_v_geodargs = Py_None; Py_INCREF(Py_None); __pyx_v_key = Py_None; Py_INCREF(Py_None); __pyx_v_value = Py_None; Py_INCREF(Py_None); - /* "/Users/jsw/python/pyproj/_geod.pyx":13 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":13 * def __new__(self, geodparams): * cdef GEODESIC_T GEOD_T * self.geodparams = geodparams # <<<<<<<<<<<<<< @@ -218,40 +231,32 @@ Py_DECREF(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams); ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams = __pyx_v_geodparams; - /* "/Users/jsw/python/pyproj/_geod.pyx":15 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":15 * self.geodparams = geodparams * # setup proj initialization string. * geodargs = [] # <<<<<<<<<<<<<< * for key,value in geodparams.iteritems(): * geodargs.append('+'+key+"="+str(value)+' ') */ - __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;} + __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_v_geodargs); - __pyx_v_geodargs = __pyx_1; + __pyx_v_geodargs = ((PyObject *)__pyx_1); __pyx_1 = 0; - /* "/Users/jsw/python/pyproj/_geod.pyx":16 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":16 * # setup proj initialization string. * geodargs = [] * for key,value in geodparams.iteritems(): # <<<<<<<<<<<<<< * geodargs.append('+'+key+"="+str(value)+' ') * self.geodinitstring = PyString_AsString(''.join(geodargs)) */ - __pyx_1 = PyObject_GetAttr(__pyx_v_geodparams, __pyx_n_iteritems); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;} - __pyx_3 = PyObject_CallObject(__pyx_1, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;} + __pyx_1 = PyObject_GetAttr(__pyx_v_geodparams, __pyx_n_iteritems); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; if (PyList_CheckExact(__pyx_3)) { __pyx_2 = 0; __pyx_1 = __pyx_3; Py_INCREF(__pyx_1); } - else { __pyx_1 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;} } + else { __pyx_1 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} } Py_DECREF(__pyx_3); __pyx_3 = 0; for (;;) { - - /* "/Users/jsw/python/pyproj/_geod.pyx":16 - * # setup proj initialization string. - * geodargs = [] - * for key,value in geodparams.iteritems(): # <<<<<<<<<<<<<< - * geodargs.append('+'+key+"="+str(value)+' ') - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - */ if (PyList_CheckExact(__pyx_1)) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_3 = PyList_GET_ITEM(__pyx_1, __pyx_2++); Py_INCREF(__pyx_3); } else { __pyx_3 = PyIter_Next(__pyx_1); @@ -260,216 +265,124 @@ } } if (PyTuple_CheckExact(__pyx_3) && PyTuple_GET_SIZE(__pyx_3) == 2) { - __pyx_5 = PyTuple_GET_ITEM(__pyx_3, 0); + PyObject* tuple = __pyx_3; + __pyx_5 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(__pyx_5); - - /* "/Users/jsw/python/pyproj/_geod.pyx":16 - * # setup proj initialization string. - * geodargs = [] - * for key,value in geodparams.iteritems(): # <<<<<<<<<<<<<< - * geodargs.append('+'+key+"="+str(value)+' ') - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - */ Py_DECREF(__pyx_v_key); __pyx_v_key = __pyx_5; __pyx_5 = 0; - __pyx_5 = PyTuple_GET_ITEM(__pyx_3, 1); + __pyx_5 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(__pyx_5); - - /* "/Users/jsw/python/pyproj/_geod.pyx":16 - * # setup proj initialization string. - * geodargs = [] - * for key,value in geodparams.iteritems(): # <<<<<<<<<<<<<< - * geodargs.append('+'+key+"="+str(value)+' ') - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - */ Py_DECREF(__pyx_v_value); __pyx_v_value = __pyx_5; __pyx_5 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; } else { - __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;} + __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":16 - * # setup proj initialization string. - * geodargs = [] - * for key,value in geodparams.iteritems(): # <<<<<<<<<<<<<< - * geodargs.append('+'+key+"="+str(value)+' ') - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - */ + __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_v_key); __pyx_v_key = __pyx_5; __pyx_5 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":16 - * # setup proj initialization string. - * geodargs = [] - * for key,value in geodparams.iteritems(): # <<<<<<<<<<<<<< - * geodargs.append('+'+key+"="+str(value)+' ') - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - */ + __pyx_5 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_v_value); __pyx_v_value = __pyx_5; __pyx_5 = 0; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;} + if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; } - /* "/Users/jsw/python/pyproj/_geod.pyx":17 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":17 * geodargs = [] * for key,value in geodparams.iteritems(): * geodargs.append('+'+key+"="+str(value)+' ') # <<<<<<<<<<<<<< * self.geodinitstring = PyString_AsString(''.join(geodargs)) * # initialize projection */ - __pyx_5 = PyObject_GetAttr(__pyx_v_geodargs, __pyx_n_append); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":17 - * geodargs = [] - * for key,value in geodparams.iteritems(): - * geodargs.append('+'+key+"="+str(value)+' ') # <<<<<<<<<<<<<< - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - * # initialize projection - */ - __pyx_3 = PyNumber_Add(__pyx_k6p, __pyx_v_key); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":17 - * geodargs = [] - * for key,value in geodparams.iteritems(): - * geodargs.append('+'+key+"="+str(value)+' ') # <<<<<<<<<<<<<< - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - * # initialize projection - */ - __pyx_4 = PyNumber_Add(__pyx_3, __pyx_k7p); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - - /* "/Users/jsw/python/pyproj/_geod.pyx":17 - * geodargs = [] - * for key,value in geodparams.iteritems(): - * geodargs.append('+'+key+"="+str(value)+' ') # <<<<<<<<<<<<<< - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - * # initialize projection - */ - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;} + __pyx_5 = PyNumber_Add(__pyx_k_3p, __pyx_v_key); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyNumber_Add(__pyx_5, __pyx_k_4p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} + Py_DECREF(__pyx_5); __pyx_5 = 0; + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_value); - __pyx_6 = PyObject_CallObject(((PyObject*)&PyString_Type), __pyx_3); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_value); + __pyx_5 = PyObject_Call(((PyObject*)&PyString_Type), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} + Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + __pyx_4 = PyNumber_Add(__pyx_3, __pyx_5); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyNumber_Add(__pyx_4, __pyx_6); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;} + Py_DECREF(__pyx_5); __pyx_5 = 0; + __pyx_3 = PyNumber_Add(__pyx_4, __pyx_k_5p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_6); __pyx_6 = 0; - - /* "/Users/jsw/python/pyproj/_geod.pyx":17 - * geodargs = [] - * for key,value in geodparams.iteritems(): - * geodargs.append('+'+key+"="+str(value)+' ') # <<<<<<<<<<<<<< - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - * # initialize projection - */ - __pyx_4 = PyNumber_Add(__pyx_3, __pyx_k8p); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;} + __pyx_5 = __Pyx_PyObject_Append(__pyx_v_geodargs, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_6 = PyTuple_New(1); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_6, 0, __pyx_4); - __pyx_4 = 0; - __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_6); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; } Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Users/jsw/python/pyproj/_geod.pyx":18 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":18 * for key,value in geodparams.iteritems(): * geodargs.append('+'+key+"="+str(value)+' ') * self.geodinitstring = PyString_AsString(''.join(geodargs)) # <<<<<<<<<<<<<< * # initialize projection * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] */ - __pyx_4 = PyObject_GetAttr(__pyx_k9p, __pyx_n_join); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":18 - * for key,value in geodparams.iteritems(): - * geodargs.append('+'+key+"="+str(value)+' ') - * self.geodinitstring = PyString_AsString(''.join(geodargs)) # <<<<<<<<<<<<<< - * # initialize projection - * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] - */ - __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_k_6p, __pyx_n_join); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_INCREF(__pyx_v_geodargs); - PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_geodargs); - __pyx_6 = PyObject_CallObject(__pyx_4, __pyx_5); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_geodargs); + __pyx_5 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; + Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodinitstring = PyString_AsString(__pyx_5); Py_DECREF(__pyx_5); __pyx_5 = 0; - /* "/Users/jsw/python/pyproj/_geod.pyx":18 - * for key,value in geodparams.iteritems(): - * geodargs.append('+'+key+"="+str(value)+' ') - * self.geodinitstring = PyString_AsString(''.join(geodargs)) # <<<<<<<<<<<<<< - * # initialize projection - * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] - */ - ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodinitstring = PyString_AsString(__pyx_6); - Py_DECREF(__pyx_6); __pyx_6 = 0; - - /* "/Users/jsw/python/pyproj/_geod.pyx":20 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":20 * self.geodinitstring = PyString_AsString(''.join(geodargs)) * # initialize projection * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] # <<<<<<<<<<<<<< * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) */ - ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t = (GEOD_init_plus(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodinitstring,(&__pyx_v_GEOD_T))[0]); + ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t = (GEOD_init_plus(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodinitstring, (&__pyx_v_GEOD_T))[0]); - /* "/Users/jsw/python/pyproj/_geod.pyx":21 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":21 * # initialize projection * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] * if pj_errno != 0: # <<<<<<<<<<<<<< * raise RuntimeError(pj_strerrno(pj_errno)) * self.proj_version = PJ_VERSION/100. */ - __pyx_7 = (pj_errno != 0); - if (__pyx_7) { + __pyx_6 = (pj_errno != 0); + if (__pyx_6) { - /* "/Users/jsw/python/pyproj/_geod.pyx":22 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":22 * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< * self.proj_version = PJ_VERSION/100. * */ - __pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;} - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3); - __pyx_3 = 0; - __pyx_4 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_Raise(__pyx_4, 0, 0); - Py_DECREF(__pyx_4); __pyx_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;} - goto __pyx_L4; + __pyx_1 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1); + __pyx_1 = 0; + __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; + __Pyx_Raise(__pyx_3, 0, 0); + Py_DECREF(__pyx_3); __pyx_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + goto __pyx_L6; } - __pyx_L4:; + __pyx_L6:; - /* "/Users/jsw/python/pyproj/_geod.pyx":23 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":23 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * self.proj_version = PJ_VERSION/100. # <<<<<<<<<<<<<< * * def __reduce__(self): */ - __pyx_5 = PyFloat_FromDouble((PJ_VERSION / 100.)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":23 - * if pj_errno != 0: - * raise RuntimeError(pj_strerrno(pj_errno)) - * self.proj_version = PJ_VERSION/100. # <<<<<<<<<<<<<< - * - * def __reduce__(self): - */ + __pyx_5 = PyFloat_FromDouble((PJ_VERSION / 100.)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->proj_version); ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->proj_version = __pyx_5; __pyx_5 = 0; @@ -481,19 +394,16 @@ Py_XDECREF(__pyx_3); Py_XDECREF(__pyx_4); Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_6); __Pyx_AddTraceback("_geod.Geod.__cinit__"); __pyx_r = -1; __pyx_L0:; Py_DECREF(__pyx_v_geodargs); Py_DECREF(__pyx_v_key); Py_DECREF(__pyx_v_value); - Py_DECREF(__pyx_v_self); - Py_DECREF(__pyx_v_geodparams); return __pyx_r; } -/* "/Users/jsw/python/pyproj/_geod.pyx":25 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":25 * self.proj_version = PJ_VERSION/100. * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -510,33 +420,24 @@ PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - Py_INCREF(__pyx_v_self); - /* "/Users/jsw/python/pyproj/_geod.pyx":27 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":27 * def __reduce__(self): * """special method that allows pyproj.Geod instance to be pickled""" * return (self.__class__,(self.geodparams,)) # <<<<<<<<<<<<<< * * def _fwd(self, object lons, object lats, object az, object dist, radians=False): */ - __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":27 - * def __reduce__(self): - * """special method that allows pyproj.Geod instance to be pickled""" - * return (self.__class__,(self.geodparams,)) # <<<<<<<<<<<<<< - * - * def _fwd(self, object lons, object lats, object az, object dist, radians=False): - */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; goto __pyx_L1;} + __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_INCREF(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams); PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams); - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; goto __pyx_L1;} + __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2); + PyTuple_SET_ITEM(__pyx_3, 1, ((PyObject *)__pyx_2)); __pyx_1 = 0; __pyx_2 = 0; - __pyx_r = __pyx_3; + __pyx_r = ((PyObject *)__pyx_3); __pyx_3 = 0; goto __pyx_L0; @@ -549,11 +450,10 @@ __Pyx_AddTraceback("_geod.Geod.__reduce__"); __pyx_r = NULL; __pyx_L0:; - Py_DECREF(__pyx_v_self); return __pyx_r; } -/* "/Users/jsw/python/pyproj/_geod.pyx":29 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":29 * return (self.__class__,(self.geodparams,)) * * def _fwd(self, object lons, object lats, object az, object dist, radians=False): # <<<<<<<<<<<<<< @@ -563,13 +463,13 @@ static PyObject *__pyx_n_ValueError; -static PyObject *__pyx_k10p; -static PyObject *__pyx_k11p; +static PyObject *__pyx_k_7p; +static PyObject *__pyx_k_8p; static PyObject *__pyx_builtin_ValueError; -static char __pyx_k10[] = "Buffer lengths not the same"; -static char __pyx_k11[] = "undefined forward geodesic (may be an equatorial arc)"; +static char __pyx_k_7[] = "Buffer lengths not the same"; +static char __pyx_k_8[] = "undefined forward geodesic (may be an equatorial arc)"; static PyObject *__pyx_pf_5_geod_4Geod__fwd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5_geod_4Geod__fwd[] = "\n forward transformation - determine longitude, latitude and back azimuth \n of a terminus point given an initial point longitude and latitude, plus\n forward azimuth and distance.\n if radians=True, lons/lats are radians instead of degrees.\n "; @@ -599,30 +499,40 @@ PyObject *__pyx_3 = 0; PyObject *__pyx_4 = 0; PyObject *__pyx_5 = 0; - Py_ssize_t __pyx_6; + Py_ssize_t __pyx_6 = 0; double __pyx_7; int __pyx_8; static char *__pyx_argnames[] = {"lons","lats","az","dist","radians",0}; - __pyx_v_radians = __pyx_k3; - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO|O", __pyx_argnames, &__pyx_v_lons, &__pyx_v_lats, &__pyx_v_az, &__pyx_v_dist, &__pyx_v_radians))) return NULL; - Py_INCREF(__pyx_v_self); - Py_INCREF(__pyx_v_lons); - Py_INCREF(__pyx_v_lats); - Py_INCREF(__pyx_v_az); - Py_INCREF(__pyx_v_dist); - Py_INCREF(__pyx_v_radians); + __pyx_v_radians = Py_False; + if (likely(!__pyx_kwds) && likely(4 <= PyTuple_GET_SIZE(__pyx_args)) && likely(PyTuple_GET_SIZE(__pyx_args) <= 5)) { + __pyx_v_lons = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_lats = PyTuple_GET_ITEM(__pyx_args, 1); + __pyx_v_az = PyTuple_GET_ITEM(__pyx_args, 2); + __pyx_v_dist = PyTuple_GET_ITEM(__pyx_args, 3); + if (PyTuple_GET_SIZE(__pyx_args) > 4) { + __pyx_v_radians = PyTuple_GET_ITEM(__pyx_args, 4); + } + } + else { + if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO|O", __pyx_argnames, &__pyx_v_lons, &__pyx_v_lats, &__pyx_v_az, &__pyx_v_dist, &__pyx_v_radians))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L2;} + } + goto __pyx_L3; + __pyx_L2:; + __Pyx_AddTraceback("_geod.Geod._fwd"); + return NULL; + __pyx_L3:; - /* "/Users/jsw/python/pyproj/_geod.pyx":40 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":40 * cdef void *londata, *latdata, *azdat, *distdat * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons, &londata, &buflenlons) <> 0: # <<<<<<<<<<<<<< * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: */ - __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lons,(&__pyx_v_londata),(&__pyx_v_buflenlons)) != 0); + __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lons, (&__pyx_v_londata), (&__pyx_v_buflenlons)) != 0); if (__pyx_1) { - /* "/Users/jsw/python/pyproj/_geod.pyx":41 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":41 * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons, &londata, &buflenlons) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -630,22 +540,22 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;} - goto __pyx_L2; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1;} + goto __pyx_L4; } - __pyx_L2:; + __pyx_L4:; - /* "/Users/jsw/python/pyproj/_geod.pyx":42 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":42 * if PyObject_AsWriteBuffer(lons, &londata, &buflenlons) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: # <<<<<<<<<<<<<< * raise RuntimeError * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: */ - __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lats,(&__pyx_v_latdata),(&__pyx_v_buflenlats)) != 0); + __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lats, (&__pyx_v_latdata), (&__pyx_v_buflenlats)) != 0); if (__pyx_1) { - /* "/Users/jsw/python/pyproj/_geod.pyx":43 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":43 * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -653,22 +563,22 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; goto __pyx_L1;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1;} + goto __pyx_L5; } - __pyx_L3:; + __pyx_L5:; - /* "/Users/jsw/python/pyproj/_geod.pyx":44 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":44 * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: # <<<<<<<<<<<<<< * raise RuntimeError * if PyObject_AsWriteBuffer(dist, &distdat, &buflend) <> 0: */ - __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_az,(&__pyx_v_azdat),(&__pyx_v_buflenaz)) != 0); + __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_az, (&__pyx_v_azdat), (&__pyx_v_buflenaz)) != 0); if (__pyx_1) { - /* "/Users/jsw/python/pyproj/_geod.pyx":45 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":45 * raise RuntimeError * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -676,22 +586,22 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;} - goto __pyx_L4; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1;} + goto __pyx_L6; } - __pyx_L4:; + __pyx_L6:; - /* "/Users/jsw/python/pyproj/_geod.pyx":46 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":46 * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(dist, &distdat, &buflend) <> 0: # <<<<<<<<<<<<<< * raise RuntimeError * # process data in buffer */ - __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_dist,(&__pyx_v_distdat),(&__pyx_v_buflend)) != 0); + __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_dist, (&__pyx_v_distdat), (&__pyx_v_buflend)) != 0); if (__pyx_1) { - /* "/Users/jsw/python/pyproj/_geod.pyx":47 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":47 * raise RuntimeError * if PyObject_AsWriteBuffer(dist, &distdat, &buflend) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -699,12 +609,12 @@ * if not buflenlons == buflenlats == buflenaz == buflend: */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/Users/jsw/python/pyproj/_geod.pyx":49 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":49 * raise RuntimeError * # process data in buffer * if not buflenlons == buflenlats == buflenaz == buflend: # <<<<<<<<<<<<<< @@ -713,74 +623,50 @@ */ __pyx_1 = (__pyx_v_buflenlons == __pyx_v_buflenlats); if (__pyx_1) { - - /* "/Users/jsw/python/pyproj/_geod.pyx":49 - * raise RuntimeError - * # process data in buffer - * if not buflenlons == buflenlats == buflenaz == buflend: # <<<<<<<<<<<<<< - * raise RuntimeError("Buffer lengths not the same") - * ndim = buflenlons/_doublesize - */ __pyx_1 = (__pyx_v_buflenlats == __pyx_v_buflenaz); if (__pyx_1) { - - /* "/Users/jsw/python/pyproj/_geod.pyx":49 - * raise RuntimeError - * # process data in buffer - * if not buflenlons == buflenlats == buflenaz == buflend: # <<<<<<<<<<<<<< - * raise RuntimeError("Buffer lengths not the same") - * ndim = buflenlons/_doublesize - */ __pyx_1 = (__pyx_v_buflenaz == __pyx_v_buflend); } } __pyx_2 = (!__pyx_1); if (__pyx_2) { - /* "/Users/jsw/python/pyproj/_geod.pyx":50 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":50 * # process data in buffer * if not buflenlons == buflenlats == buflenaz == buflend: * raise RuntimeError("Buffer lengths not the same") # <<<<<<<<<<<<<< * ndim = buflenlons/_doublesize * lonsdata = <double *>londata */ - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;} - Py_INCREF(__pyx_k10p); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k10p); - __pyx_4 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1;} + Py_INCREF(__pyx_k_7p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k_7p); + __pyx_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __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 = 50; goto __pyx_L1;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/Users/jsw/python/pyproj/_geod.pyx":51 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":51 * if not buflenlons == buflenlats == buflenaz == buflend: * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize # <<<<<<<<<<<<<< * lonsdata = <double *>londata * latsdata = <double *>latdata */ - __pyx_3 = PyInt_FromSsize_t(__pyx_v_buflenlons); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":51 - * if not buflenlons == buflenlats == buflenaz == buflend: - * raise RuntimeError("Buffer lengths not the same") - * ndim = buflenlons/_doublesize # <<<<<<<<<<<<<< - * lonsdata = <double *>londata - * latsdata = <double *>latdata - */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__doublesize); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;} - __pyx_5 = PyNumber_Divide(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;} + __pyx_3 = PyInt_FromSsize_t(__pyx_v_buflenlons); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__doublesize); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyNumber_Divide(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_6 = __pyx_PyIndex_AsSsize_t(__pyx_5); if (unlikely((__pyx_6 == -1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; goto __pyx_L1;} + __pyx_6 = __pyx_PyIndex_AsSsize_t(__pyx_5); if (unlikely((__pyx_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; __pyx_v_ndim = __pyx_6; - /* "/Users/jsw/python/pyproj/_geod.pyx":52 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":52 * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize * lonsdata = <double *>londata # <<<<<<<<<<<<<< @@ -789,7 +675,7 @@ */ __pyx_v_lonsdata = ((double *)__pyx_v_londata); - /* "/Users/jsw/python/pyproj/_geod.pyx":53 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":53 * ndim = buflenlons/_doublesize * lonsdata = <double *>londata * latsdata = <double *>latdata # <<<<<<<<<<<<<< @@ -798,7 +684,7 @@ */ __pyx_v_latsdata = ((double *)__pyx_v_latdata); - /* "/Users/jsw/python/pyproj/_geod.pyx":54 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":54 * lonsdata = <double *>londata * latsdata = <double *>latdata * azdata = <double *>azdat # <<<<<<<<<<<<<< @@ -807,7 +693,7 @@ */ __pyx_v_azdata = ((double *)__pyx_v_azdat); - /* "/Users/jsw/python/pyproj/_geod.pyx":55 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":55 * latsdata = <double *>latdata * azdata = <double *>azdat * distdata = <double *>distdat # <<<<<<<<<<<<<< @@ -816,7 +702,7 @@ */ __pyx_v_distdata = ((double *)__pyx_v_distdat); - /* "/Users/jsw/python/pyproj/_geod.pyx":56 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":56 * azdata = <double *>azdat * distdata = <double *>distdat * for i from 0 <= i < ndim: # <<<<<<<<<<<<<< @@ -825,17 +711,17 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) { - /* "/Users/jsw/python/pyproj/_geod.pyx":57 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":57 * distdata = <double *>distdat * for i from 0 <= i < ndim: * if radians: # <<<<<<<<<<<<<< * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] */ - __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;} + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;} if (__pyx_1) { - /* "/Users/jsw/python/pyproj/_geod.pyx":58 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":58 * for i from 0 <= i < ndim: * if radians: * self.geodesic_t.p1.v = lonsdata[i] # <<<<<<<<<<<<<< @@ -844,7 +730,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = (__pyx_v_lonsdata[__pyx_v_i]); - /* "/Users/jsw/python/pyproj/_geod.pyx":59 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":59 * if radians: * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] # <<<<<<<<<<<<<< @@ -853,7 +739,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = (__pyx_v_latsdata[__pyx_v_i]); - /* "/Users/jsw/python/pyproj/_geod.pyx":60 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":60 * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] * self.geodesic_t.ALPHA12 = azdata[i] # <<<<<<<<<<<<<< @@ -862,7 +748,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA12 = (__pyx_v_azdata[__pyx_v_i]); - /* "/Users/jsw/python/pyproj/_geod.pyx":61 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":61 * self.geodesic_t.p1.u = latsdata[i] * self.geodesic_t.ALPHA12 = azdata[i] * self.geodesic_t.DIST = distdata[i] # <<<<<<<<<<<<<< @@ -870,107 +756,59 @@ * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.DIST = (__pyx_v_distdata[__pyx_v_i]); - goto __pyx_L9; + goto __pyx_L11; } /*else*/ { - /* "/Users/jsw/python/pyproj/_geod.pyx":63 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":63 * self.geodesic_t.DIST = distdata[i] * else: * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] # <<<<<<<<<<<<<< * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":63 - * self.geodesic_t.DIST = distdata[i] - * else: - * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] # <<<<<<<<<<<<<< - * self.geodesic_t.p1.u = _dg2rad*latsdata[i] - * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] - */ - __pyx_4 = PyFloat_FromDouble((__pyx_v_lonsdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;} - __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;} + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyFloat_FromDouble((__pyx_v_lonsdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;} + __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; - - /* "/Users/jsw/python/pyproj/_geod.pyx":63 - * self.geodesic_t.DIST = distdata[i] - * else: - * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] # <<<<<<<<<<<<<< - * self.geodesic_t.p1.u = _dg2rad*latsdata[i] - * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] - */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = __pyx_7; - /* "/Users/jsw/python/pyproj/_geod.pyx":64 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":64 * else: * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] * self.geodesic_t.p1.u = _dg2rad*latsdata[i] # <<<<<<<<<<<<<< * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] * self.geodesic_t.DIST = distdata[i] */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":64 - * else: - * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] - * self.geodesic_t.p1.u = _dg2rad*latsdata[i] # <<<<<<<<<<<<<< - * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] - * self.geodesic_t.DIST = distdata[i] - */ - __pyx_4 = PyFloat_FromDouble((__pyx_v_latsdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; goto __pyx_L1;} - __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; goto __pyx_L1;} + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyFloat_FromDouble((__pyx_v_latsdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; goto __pyx_L1;} + __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; - - /* "/Users/jsw/python/pyproj/_geod.pyx":64 - * else: - * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] - * self.geodesic_t.p1.u = _dg2rad*latsdata[i] # <<<<<<<<<<<<<< - * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] - * self.geodesic_t.DIST = distdata[i] - */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = __pyx_7; - /* "/Users/jsw/python/pyproj/_geod.pyx":65 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":65 * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] # <<<<<<<<<<<<<< * self.geodesic_t.DIST = distdata[i] * geod_pre(&self.geodesic_t) */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;} - - /* "/Users/jsw/python/pyproj/_geod.pyx":65 - * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] - * self.geodesic_t.p1.u = _dg2rad*latsdata[i] - * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] # <<<<<<<<<<<<<< - * self.geodesic_t.DIST = distdata[i] - * geod_pre(&self.geodesic_t) - */ - __pyx_4 = PyFloat_FromDouble((__pyx_v_azdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;} - __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;} + __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyFloat_FromDouble((__pyx_v_azdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; goto __pyx_L1;} + __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; - - /* "/Users/jsw/python/pyproj/_geod.pyx":65 - * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] - * self.geodesic_t.p1.u = _dg2rad*latsdata[i] - * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] # <<<<<<<<<<<<<< - * self.geodesic_t.DIST = distdata[i] - * geod_pre(&self.geodesic_t) - */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA12 = __pyx_7; - /* "/Users/jsw/python/pyproj/_geod.pyx":66 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":66 * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] * self.geodesic_t.DIST = distdata[i] # <<<<<<<<<<<<<< @@ -979,9 +817,9 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.DIST = (__pyx_v_distdata[__pyx_v_i]); } - __pyx_L9:; + __pyx_L11:; - /* "/Users/jsw/python/pyproj/_geod.pyx":67 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":67 * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] * self.geodesic_t.DIST = distdata[i] * geod_pre(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -990,7 +828,7 @@ */ geod_pre((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Users/jsw/python/pyproj/_geod.pyx":68 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":68 * self.geodesic_t.DIST = distdata[i] * geod_pre(&self.geodesic_t) * if pj_errno != 0: # <<<<<<<<<<<<<< @@ -1000,27 +838,27 @@ __pyx_2 = (pj_errno != 0); if (__pyx_2) { - /* "/Users/jsw/python/pyproj/_geod.pyx":69 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":69 * geod_pre(&self.geodesic_t) * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< * geod_for(&self.geodesic_t) * if pj_errno != 0: */ - __pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;} + __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_5 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; + __pyx_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__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_5, 0, 0); Py_DECREF(__pyx_5); __pyx_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/Users/jsw/python/pyproj/_geod.pyx":70 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":70 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * geod_for(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -1029,7 +867,7 @@ */ geod_for((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Users/jsw/python/pyproj/_geod.pyx":71 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":71 * raise RuntimeError(pj_strerrno(pj_errno)) * geod_for(&self.geodesic_t) * if pj_errno != 0: # <<<<<<<<<<<<<< @@ -1039,27 +877,27 @@ __pyx_1 = (pj_errno != 0); if (__pyx_1) { - /* "/Users/jsw/python/pyproj/_geod.pyx":72 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":72 * geod_for(&self.geodesic_t) * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< * if isnan(self.geodesic_t.ALPHA21): * raise ValueError('undefined forward geodesic (may be an equatorial arc)') */ - __pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;} + __pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3); __pyx_3 = 0; - __pyx_5 = PyObject_CallObject(__pyx_builtin_RuntimeError, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7... [truncated message content] |
From: <js...@us...> - 2008-05-20 15:59:01
|
Revision: 5203 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5203&view=rev Author: jswhit Date: 2008-05-20 08:57:58 -0700 (Tue, 20 May 2008) Log Message: ----------- added Eric's support to 2-d lat/lon array back to proj wrapper Modified Paths: -------------- trunk/toolkits/basemap/setup.py trunk/toolkits/basemap/src/_proj.c trunk/toolkits/basemap/src/_proj.pyx Modified: trunk/toolkits/basemap/setup.py =================================================================== --- trunk/toolkits/basemap/setup.py 2008-05-20 15:27:21 UTC (rev 5202) +++ trunk/toolkits/basemap/setup.py 2008-05-20 15:57:58 UTC (rev 5203) @@ -12,8 +12,9 @@ http://peak.telecommunity.com/dist/ez_setup.py and run it (as su if you are doing a system wide install) to install the proper version of setuptools for your system""") -from distutils.core import setup -from distutils.core import Extension +#from distutils.core import setup +#from distutils.core import Extension +from numpy.distutils.core import setup, Extension from distutils.util import convert_path def dbf_macros(): Modified: trunk/toolkits/basemap/src/_proj.c =================================================================== --- trunk/toolkits/basemap/src/_proj.c 2008-05-20 15:27:21 UTC (rev 5202) +++ trunk/toolkits/basemap/src/_proj.c 2008-05-20 15:57:58 UTC (rev 5203) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.9.6.14 on Tue May 20 09:26:02 2008 */ +/* Generated by Cython 0.9.6.14 on Tue May 20 09:53:32 2008 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -34,6 +34,7 @@ #include "math.h" #include "geodesic.h" #include "proj_api.h" +#include "numpy/arrayobject.h" #ifdef __GNUC__ @@ -125,11 +126,15 @@ 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":10 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":13 * pj_set_searchpath(1, &searchpath) * * cdef class Proj: # <<<<<<<<<<<<<< @@ -146,6 +151,12 @@ 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; @@ -158,6 +169,8 @@ 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; @@ -167,11 +180,12 @@ static PyObject *__pyx_n__rad2dg; static PyObject *__pyx_n__doublesize; static PyObject *__pyx_n___version__; +static PyObject *__pyx_n_numpy; static PyObject *__pyx_k_2p; -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":5 - * include "_pyproj.pxi" +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":8 + * c_numpy.import_array() * * def set_datapath(datapath): # <<<<<<<<<<<<<< * cdef char *searchpath @@ -183,7 +197,7 @@ char *__pyx_v_searchpath; PyObject *__pyx_r; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":7 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":10 * def set_datapath(datapath): * cdef char *searchpath * searchpath = PyString_AsString(datapath) # <<<<<<<<<<<<<< @@ -192,7 +206,7 @@ */ __pyx_v_searchpath = PyString_AsString(__pyx_v_datapath); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":8 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":11 * cdef char *searchpath * searchpath = PyString_AsString(datapath) * pj_set_searchpath(1, &searchpath) # <<<<<<<<<<<<<< @@ -205,7 +219,7 @@ return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":17 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":20 * cdef public object srs * * def __new__(self, projparams): # <<<<<<<<<<<<<< @@ -218,17 +232,17 @@ static PyObject *__pyx_n_join; static PyObject *__pyx_n_RuntimeError; -static PyObject *__pyx_k_3p; static PyObject *__pyx_k_4p; static PyObject *__pyx_k_5p; static PyObject *__pyx_k_6p; +static PyObject *__pyx_k_7p; static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_3[] = "+"; -static char __pyx_k_4[] = "="; -static char __pyx_k_5[] = " "; -static char __pyx_k_6[] = ""; +static char __pyx_k_4[] = "+"; +static char __pyx_k_5[] = "="; +static char __pyx_k_6[] = " "; +static char __pyx_k_7[] = ""; 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) { @@ -248,7 +262,7 @@ __pyx_v_projparams = PyTuple_GET_ITEM(__pyx_args, 0); } else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_projparams))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L2;} + if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_projparams))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L2;} } goto __pyx_L3; __pyx_L2:; @@ -259,7 +273,7 @@ __pyx_v_key = Py_None; Py_INCREF(Py_None); __pyx_v_value = Py_None; Py_INCREF(Py_None); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":18 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":21 * * def __new__(self, projparams): * self.projparams = projparams # <<<<<<<<<<<<<< @@ -270,30 +284,30 @@ Py_DECREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams); ((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams = __pyx_v_projparams; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":20 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":23 * self.projparams = projparams * # setup proj initialization string. * pjargs = [] # <<<<<<<<<<<<<< * for key,value in projparams.iteritems(): * pjargs.append('+'+key+"="+str(value)+' ') */ - __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_v_pjargs); __pyx_v_pjargs = ((PyObject *)__pyx_1); __pyx_1 = 0; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":21 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":24 * # setup proj initialization string. * pjargs = [] * for key,value in projparams.iteritems(): # <<<<<<<<<<<<<< * pjargs.append('+'+key+"="+str(value)+' ') * self.srs = ''.join(pjargs) */ - __pyx_1 = PyObject_GetAttr(__pyx_v_projparams, __pyx_n_iteritems); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_1 = PyObject_GetAttr(__pyx_v_projparams, __pyx_n_iteritems); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; if (PyList_CheckExact(__pyx_3)) { __pyx_2 = 0; __pyx_1 = __pyx_3; Py_INCREF(__pyx_1); } - else { __pyx_1 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1;} } + else { __pyx_1 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} } Py_DECREF(__pyx_3); __pyx_3 = 0; for (;;) { if (PyList_CheckExact(__pyx_1)) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_3 = PyList_GET_ITEM(__pyx_1, __pyx_2++); Py_INCREF(__pyx_3); } @@ -318,65 +332,65 @@ Py_DECREF(__pyx_3); __pyx_3 = 0; } else { - __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_v_key); __pyx_v_key = __pyx_5; __pyx_5 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_v_value); __pyx_v_value = __pyx_5; __pyx_5 = 0; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1;} + if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; } - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":22 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":25 * pjargs = [] * for key,value in projparams.iteritems(): * pjargs.append('+'+key+"="+str(value)+' ') # <<<<<<<<<<<<<< * self.srs = ''.join(pjargs) * self.pjinitstring = PyString_AsString(self.srs) */ - __pyx_5 = PyNumber_Add(__pyx_k_3p, __pyx_v_key); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyNumber_Add(__pyx_5, __pyx_k_4p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyNumber_Add(__pyx_k_4p, __pyx_v_key); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyNumber_Add(__pyx_5, __pyx_k_5p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_INCREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_value); - __pyx_5 = PyObject_Call(((PyObject*)&PyString_Type), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyObject_Call(((PyObject*)&PyString_Type), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_4 = PyNumber_Add(__pyx_3, __pyx_5); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyNumber_Add(__pyx_3, __pyx_5); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = PyNumber_Add(__pyx_4, __pyx_k_5p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyNumber_Add(__pyx_4, __pyx_k_6p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_5 = __Pyx_PyObject_Append(__pyx_v_pjargs, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = __Pyx_PyObject_Append(__pyx_v_pjargs, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_5); __pyx_5 = 0; } Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":23 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":26 * for key,value in projparams.iteritems(): * pjargs.append('+'+key+"="+str(value)+' ') * self.srs = ''.join(pjargs) # <<<<<<<<<<<<<< * self.pjinitstring = PyString_AsString(self.srs) * # initialize projection */ - __pyx_4 = PyObject_GetAttr(__pyx_k_6p, __pyx_n_join); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyObject_GetAttr(__pyx_k_7p, __pyx_n_join); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_INCREF(__pyx_v_pjargs); PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_pjargs); - __pyx_5 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; Py_DECREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs); ((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs = __pyx_5; __pyx_5 = 0; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":24 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":27 * pjargs.append('+'+key+"="+str(value)+' ') * self.srs = ''.join(pjargs) * self.pjinitstring = PyString_AsString(self.srs) # <<<<<<<<<<<<<< @@ -385,7 +399,7 @@ */ ((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":26 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":29 * self.pjinitstring = PyString_AsString(self.srs) * # initialize projection * self.projpj = pj_init_plus(self.pjinitstring) # <<<<<<<<<<<<<< @@ -394,7 +408,7 @@ */ ((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":27 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":30 * # initialize projection * self.projpj = pj_init_plus(self.pjinitstring) * if pj_errno != 0: # <<<<<<<<<<<<<< @@ -404,34 +418,34 @@ __pyx_6 = (pj_errno != 0); if (__pyx_6) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":28 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":31 * 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 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_1 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1); __pyx_1 = 0; - __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; __Pyx_Raise(__pyx_3, 0, 0); Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":29 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":32 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * self.proj_version = PJ_VERSION/100. # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __pyx_5 = PyFloat_FromDouble((PJ_VERSION / 100.)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyFloat_FromDouble((PJ_VERSION / 100.)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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_5; __pyx_5 = 0; @@ -452,7 +466,7 @@ return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":31 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":34 * self.proj_version = PJ_VERSION/100. * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -464,7 +478,7 @@ 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":33 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":36 * def __dealloc__(self): * """destroy projection definition""" * pj_free(self.projpj) # <<<<<<<<<<<<<< @@ -475,7 +489,7 @@ } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":35 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":38 * pj_free(self.projpj) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -493,18 +507,18 @@ PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":37 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":40 * def __reduce__(self): * """special method that allows pyproj.Proj instance to be pickled""" * return (self.__class__,(self.projparams,)) # <<<<<<<<<<<<<< * * 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 = 37; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_INCREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams); PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams); - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __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; @@ -525,7 +539,7 @@ return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":39 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":42 * return (self.__class__,(self.projparams,)) * * def _fwd(self, object lons, object lats, radians=False, errcheck=False): # <<<<<<<<<<<<<< @@ -533,9 +547,9 @@ * forward transformation - lons,lats to x,y (done in place). */ -static PyObject *__pyx_k_7p; +static PyObject *__pyx_k_8p; -static char __pyx_k_7[] = "Buffer lengths not the same"; +static char __pyx_k_8[] = "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 "; @@ -575,7 +589,7 @@ } } 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 = 39; __pyx_clineno = __LINE__; goto __pyx_L2;} + 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 = 42; __pyx_clineno = __LINE__; goto __pyx_L2;} } goto __pyx_L3; __pyx_L2:; @@ -583,7 +597,7 @@ return NULL; __pyx_L3:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":53 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":56 * cdef void *londata, *latdata * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons, &londata, &buflenx) <> 0: # <<<<<<<<<<<<<< @@ -593,7 +607,7 @@ __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":54 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":57 * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons, &londata, &buflenx) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -601,12 +615,12 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":55 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":58 * if PyObject_AsWriteBuffer(lons, &londata, &buflenx) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &bufleny) <> 0: # <<<<<<<<<<<<<< @@ -616,7 +630,7 @@ __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":56 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":59 * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &bufleny) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -624,12 +638,12 @@ * if buflenx != bufleny: */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":58 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":61 * raise RuntimeError * # process data in buffer * if buflenx != bufleny: # <<<<<<<<<<<<<< @@ -639,42 +653,42 @@ __pyx_1 = (__pyx_v_buflenx != __pyx_v_bufleny); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":59 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":62 * # 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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(__pyx_k_7p); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k_7p); - __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1;} + Py_INCREF(__pyx_k_8p); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k_8p); + __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":60 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":63 * 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 = 60; __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 = 60; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = PyInt_FromSsize_t(__pyx_v_buflenx); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __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 = 63; __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 = 63; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 63; __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":61 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":64 * raise RuntimeError("Buffer lengths not the same") * ndim = buflenx/_doublesize * lonsdata = <double *>londata # <<<<<<<<<<<<<< @@ -683,7 +697,7 @@ */ __pyx_v_lonsdata = ((double *)__pyx_v_londata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":62 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":65 * ndim = buflenx/_doublesize * lonsdata = <double *>londata * latsdata = <double *>latdata # <<<<<<<<<<<<<< @@ -692,7 +706,7 @@ */ __pyx_v_latsdata = ((double *)__pyx_v_latdata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":63 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":66 * lonsdata = <double *>londata * latsdata = <double *>latdata * for i from 0 <= i < ndim: # <<<<<<<<<<<<<< @@ -701,17 +715,17 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":64 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":67 * 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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1;} if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":65 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":68 * for i from 0 <= i < ndim: * if radians: * projlonlatin.u = lonsdata[i] # <<<<<<<<<<<<<< @@ -720,7 +734,7 @@ */ __pyx_v_projlonlatin.u = (__pyx_v_lonsdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":66 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":69 * if radians: * projlonlatin.u = lonsdata[i] * projlonlatin.v = latsdata[i] # <<<<<<<<<<<<<< @@ -732,41 +746,41 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":68 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":71 * 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 = 68; __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 = 68; __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __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 = 71; __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 = 71; __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_6 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __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":69 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":72 * 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 = 69; __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 = 69; __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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __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 = 72; __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 = 72; __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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_6 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __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":70 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":73 * projlonlatin.u = _dg2rad*lonsdata[i] * projlonlatin.v = _dg2rad*latsdata[i] * projxyout = pj_fwd(projlonlatin,self.projpj) # <<<<<<<<<<<<<< @@ -775,7 +789,7 @@ */ __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":71 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":74 * projlonlatin.v = _dg2rad*latsdata[i] * projxyout = pj_fwd(projlonlatin,self.projpj) * if errcheck and pj_errno != 0: # <<<<<<<<<<<<<< @@ -784,36 +798,36 @@ */ __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 = 71; __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 = 74; __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = __Pyx_PyBool_FromLong((pj_errno != 0)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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 = 71; __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":72 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":75 * 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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L10; } __pyx_L10:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":75 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":78 * # since HUGE_VAL can be 'inf', * # change it to a real (but very large) number. * if projxyout.u == HUGE_VAL: # <<<<<<<<<<<<<< @@ -823,7 +837,7 @@ __pyx_1 = (__pyx_v_projxyout.u == HUGE_VAL); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":76 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":79 * # change it to a real (but very large) number. * if projxyout.u == HUGE_VAL: * lonsdata[i] = 1.e30 # <<<<<<<<<<<<<< @@ -835,7 +849,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":78 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":81 * lonsdata[i] = 1.e30 * else: * lonsdata[i] = projxyout.u # <<<<<<<<<<<<<< @@ -846,7 +860,7 @@ } __pyx_L11:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":79 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":82 * else: * lonsdata[i] = projxyout.u * if projxyout.v == HUGE_VAL: # <<<<<<<<<<<<<< @@ -856,7 +870,7 @@ __pyx_1 = (__pyx_v_projxyout.v == HUGE_VAL); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":80 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":83 * lonsdata[i] = projxyout.u * if projxyout.v == HUGE_VAL: * latsdata[i] = 1.e30 # <<<<<<<<<<<<<< @@ -868,7 +882,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":82 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":85 * latsdata[i] = 1.e30 * else: * latsdata[i] = projxyout.v # <<<<<<<<<<<<<< @@ -892,7 +906,7 @@ return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":84 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":87 * latsdata[i] = projxyout.v * * def _inv(self, object x, object y, radians=False, errcheck=False): # <<<<<<<<<<<<<< @@ -900,9 +914,9 @@ * inverse transformation - x,y to lons,lats (done in place). */ -static PyObject *__pyx_k_8p; +static PyObject *__pyx_k_9p; -static char __pyx_k_8[] = "Buffer lengths not the same"; +static char __pyx_k_9[] = "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 "; @@ -942,7 +956,7 @@ } } 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 = 84; __pyx_clineno = __LINE__; goto __pyx_L2;} + 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 = 87; __pyx_clineno = __LINE__; goto __pyx_L2;} } goto __pyx_L3; __pyx_L2:; @@ -950,7 +964,7 @@ return NULL; __pyx_L3:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":98 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":101 * cdef double *xdatab, *ydatab * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(x, &xdata, &buflenx) <> 0: # <<<<<<<<<<<<<< @@ -960,7 +974,7 @@ __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":99 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":102 * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(x, &xdata, &buflenx) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -968,12 +982,12 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":100 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":103 * if PyObject_AsWriteBuffer(x, &xdata, &buflenx) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(y, &ydata, &bufleny) <> 0: # <<<<<<<<<<<<<< @@ -983,7 +997,7 @@ __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":101 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":104 * raise RuntimeError * if PyObject_AsWriteBuffer(y, &ydata, &bufleny) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -991,12 +1005,12 @@ * # (for numpy/regular python arrays). */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":104 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":107 * # process data in buffer * # (for numpy/regular python arrays). * if buflenx != bufleny: # <<<<<<<<<<<<<< @@ -1006,42 +1020,42 @@ __pyx_1 = (__pyx_v_buflenx != __pyx_v_bufleny); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":105 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":108 * # (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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(__pyx_k_8p); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k_8p); - __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1;} + Py_INCREF(__pyx_k_9p); + PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k_9p); + __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":106 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":109 * 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 = 106; __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 = 106; __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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = PyInt_FromSsize_t(__pyx_v_buflenx); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __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 = 109; __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 = 109; __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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 109; __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":107 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":110 * raise RuntimeError("Buffer lengths not the same") * ndim = buflenx/_doublesize * xdatab = <double *>xdata # <<<<<<<<<<<<<< @@ -1050,7 +1064,7 @@ */ __pyx_v_xdatab = ((double *)__pyx_v_xdata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":108 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":111 * ndim = buflenx/_doublesize * xdatab = <double *>xdata * ydatab = <double *>ydata # <<<<<<<<<<<<<< @@ -1059,7 +1073,7 @@ */ __pyx_v_ydatab = ((double *)__pyx_v_ydata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":109 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":112 * xdatab = <double *>xdata * ydatab = <double *>ydata * for i from 0 <= i < ndim: # <<<<<<<<<<<<<< @@ -1068,7 +1082,7 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":110 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":113 * ydatab = <double *>ydata * for i from 0 <= i < ndim: * projxyin.u = xdatab[i] # <<<<<<<<<<<<<< @@ -1077,7 +1091,7 @@ */ __pyx_v_projxyin.u = (__pyx_v_xdatab[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":111 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":114 * for i from 0 <= i < ndim: * projxyin.u = xdatab[i] * projxyin.v = ydatab[i] # <<<<<<<<<<<<<< @@ -1086,7 +1100,7 @@ */ __pyx_v_projxyin.v = (__pyx_v_ydatab[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":112 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":115 * projxyin.u = xdatab[i] * projxyin.v = ydatab[i] * projlonlatout = pj_inv(projxyin,self.projpj) # <<<<<<<<<<<<<< @@ -1095,7 +1109,7 @@ */ __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":113 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":116 * projxyin.v = ydatab[i] * projlonlatout = pj_inv(projxyin,self.projpj) * if errcheck and pj_errno != 0: # <<<<<<<<<<<<<< @@ -1104,36 +1118,36 @@ */ __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 = 113; __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 = 116; __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 = 113; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = __Pyx_PyBool_FromLong((pj_errno != 0)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __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 = 113; __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 = 116; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":114 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":117 * 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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L9; } __pyx_L9:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":117 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":120 * # since HUGE_VAL can be 'inf', * # change it to a real (but very large) number. * if projlonlatout.u == HUGE_VAL: # <<<<<<<<<<<<<< @@ -1143,7 +1157,7 @@ __pyx_1 = (__pyx_v_projlonlatout.u == HUGE_VAL); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":118 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":121 * # change it to a real (but very large) number. * if projlonlatout.u == HUGE_VAL: * xdatab[i] = 1.e30 # <<<<<<<<<<<<<< @@ -1154,17 +1168,17 @@ goto __pyx_L10; } - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":119 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":122 * 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 = 119; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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":120 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":123 * xdatab[i] = 1.e30 * elif radians: * xdatab[i] = projlonlatout.u # <<<<<<<<<<<<<< @@ -1176,25 +1190,25 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":122 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":125 * 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 = 122; __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 = 122; __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 = 122; __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 = 125; __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 = 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 = 122; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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_xdatab[__pyx_v_i]) = __pyx_6; } __pyx_L10:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":123 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":126 * else: * xdatab[i] = _rad2dg*projlonlatout.u * if projlonlatout.v == HUGE_VAL: # <<<<<<<<<<<<<< @@ -1204,7 +1218,7 @@ __pyx_1 = (__pyx_v_projl... [truncated message content] |
From: <js...@us...> - 2008-05-23 21:53:34
|
Revision: 5247 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5247&view=rev Author: jswhit Date: 2008-05-23 14:53:33 -0700 (Fri, 23 May 2008) Log Message: ----------- update pyproj to 1.8.5 Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py trunk/toolkits/basemap/src/_proj.c trunk/toolkits/basemap/src/_proj.pyx trunk/toolkits/basemap/src/_pyproj.pxi Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py 2008-05-23 21:53:01 UTC (rev 5246) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py 2008-05-23 21:53:33 UTC (rev 5247) @@ -66,7 +66,8 @@ A Proj class instance is initialized with proj map projection control parameter key/value pairs. The key/value pairs can - either be passed in a dictionary, or as keyword arguments. See + either be passed in a dictionary, or as keyword arguments, + or as a proj4 string (compatible with the proj command). See http://www.remotesensing.org/geotiff/proj_list for examples of key/value pairs defining different map projections. @@ -97,7 +98,7 @@ Example usage: >>> from pyproj import Proj - >>> p = Proj(proj='utm',zone=10,ellps='WGS84') + >>> p = Proj(proj='utm',zone=10,ellps='WGS84') # use kwargs >>> x,y = p(-120.108, 34.36116666) >>> print 'x=%9.3f y=%11.3f' % (x,y) x=765975.641 y=3805993.134 @@ -116,20 +117,35 @@ lons: -119.720 -118.400 -122.380 >>> print 'lats: %8.3f %8.3f %8.3f' % lats lats: 36.770 33.930 37.620 + >>> p2 = Proj('+proj=utm +zone=10 +ellps=WGS84') # use proj4 string + >>> x,y = p2(-120.108, 34.36116666) + >>> print 'x=%9.3f y=%11.3f' % (x,y) + x=765975.641 y=3805993.134 """ # if projparams is None, use kwargs. if projparams is None: if len(kwargs) == 0: raise RuntimeError('no projection control parameters specified') else: - projparams = kwargs - # set units to meters. - if not projparams.has_key('units'): - projparams['units']='m' - elif projparams['units'] != 'm': - print 'resetting units to meters ...' - projparams['units']='m' - return _Proj.__new__(self, projparams) + projstring = _dict2string(kwargs) + elif type(projparams) == str: + # if projparams is a string, interpret as a proj4 init string. + projstring = projparams + else: # projparams a dict + projstring = _dict2string(projparams) + # make sure units are meters. + if not projstring.count('+units='): + projstring = '+units=m '+projstring + else: + kvpairs = [] + for kvpair in projstring.split(): + if kvpair.startswith('+units'): + k,v = kvpair.split('=') + kvpairs.append(k+'=m ') + else: + kvpairs.append(kvpair+' ') + projstring = ''.join(kvpairs) + return _Proj.__new__(self, projstring) def __call__(self, *args, **kw): #,lon,lat,inverse=False,radians=False,errcheck=False): @@ -331,6 +347,13 @@ else: return inx +def _dict2string(projparams): + # convert a dict to a proj4 string. + pjargs = [] + for key,value in projparams.iteritems(): + pjargs.append('+'+key+"="+str(value)+' ') + return ''.join(pjargs) + class Geod(_Geod): """ performs forward and inverse geodetic, or Great Circle, Modified: trunk/toolkits/basemap/src/_proj.c =================================================================== --- trunk/toolkits/basemap/src/_proj.c 2008-05-23 21:53:01 UTC (rev 5246) +++ trunk/toolkits/basemap/src/_proj.c 2008-05-23 21:53:33 UTC (rev 5247) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.9.6.14 on Tue May 20 09:59:26 2008 */ +/* Generated by Cython 0.9.6.14 on Fri May 23 15:52:15 2008 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -106,20 +106,6 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ - -static inline PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; - Py_INCREF(Py_None); - return Py_None; // this is just to have an accurate signature - } - else { - return PyObject_CallMethod(L, "append", "(O)", x); - } -} - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/ @@ -139,13 +125,12 @@ * * cdef class Proj: # <<<<<<<<<<<<<< * cdef projPJ projpj - * cdef public object projparams + * cdef public object proj_version */ struct __pyx_obj_5_proj_Proj { PyObject_HEAD projPJ projpj; - PyObject *projparams; PyObject *proj_version; char *pjinitstring; PyObject *srs; @@ -162,7 +147,7 @@ /* Implementation of _proj */ -static char __pyx_k_2[] = "1.8.4"; +static char __pyx_k_2[] = "1.8.5"; static PyObject *__pyx_n___cinit__; static PyObject *__pyx_n___dealloc__; @@ -218,187 +203,59 @@ return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":19 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":18 * cdef public object srs * - * def __new__(self, projparams): # <<<<<<<<<<<<<< - * self.projparams = projparams + * def __new__(self, projstring): # <<<<<<<<<<<<<< * # setup proj initialization string. + * self.srs = projstring */ -static PyObject *__pyx_n_iteritems; -static PyObject *__pyx_n_append; -static PyObject *__pyx_n_join; static PyObject *__pyx_n_RuntimeError; -static PyObject *__pyx_k_3p; -static PyObject *__pyx_k_4p; -static PyObject *__pyx_k_5p; -static PyObject *__pyx_k_6p; - static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_3[] = "+"; -static char __pyx_k_4[] = "="; -static char __pyx_k_5[] = " "; -static char __pyx_k_6[] = ""; - static int __pyx_pf_5_proj_4Proj___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_5_proj_4Proj___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_projparams = 0; - PyObject *__pyx_v_pjargs; - PyObject *__pyx_v_key; - PyObject *__pyx_v_value; + PyObject *__pyx_v_projstring = 0; int __pyx_r; - PyObject *__pyx_1 = 0; - Py_ssize_t __pyx_2 = 0; + int __pyx_1; + PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - PyObject *__pyx_5 = 0; - int __pyx_6; - static char *__pyx_argnames[] = {"projparams",0}; + static char *__pyx_argnames[] = {"projstring",0}; if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 1)) { - __pyx_v_projparams = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_projstring = PyTuple_GET_ITEM(__pyx_args, 0); } else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_projparams))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L2;} + 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:; - __pyx_v_pjargs = Py_None; Py_INCREF(Py_None); - __pyx_v_key = Py_None; Py_INCREF(Py_None); - __pyx_v_value = Py_None; Py_INCREF(Py_None); /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":20 - * - * def __new__(self, projparams): - * self.projparams = projparams # <<<<<<<<<<<<<< + * def __new__(self, projstring): * # setup proj initialization string. - * pjargs = [] - */ - Py_INCREF(__pyx_v_projparams); - Py_DECREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams); - ((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams = __pyx_v_projparams; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":22 - * self.projparams = projparams - * # setup proj initialization string. - * pjargs = [] # <<<<<<<<<<<<<< - * for key,value in projparams.iteritems(): - * pjargs.append('+'+key+"="+str(value)+' ') - */ - __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_v_pjargs); - __pyx_v_pjargs = ((PyObject *)__pyx_1); - __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":23 - * # setup proj initialization string. - * pjargs = [] - * for key,value in projparams.iteritems(): # <<<<<<<<<<<<<< - * pjargs.append('+'+key+"="+str(value)+' ') - * self.srs = ''.join(pjargs) - */ - __pyx_1 = PyObject_GetAttr(__pyx_v_projparams, __pyx_n_iteritems); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (PyList_CheckExact(__pyx_3)) { __pyx_2 = 0; __pyx_1 = __pyx_3; Py_INCREF(__pyx_1); } - else { __pyx_1 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} } - Py_DECREF(__pyx_3); __pyx_3 = 0; - for (;;) { - if (PyList_CheckExact(__pyx_1)) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_3 = PyList_GET_ITEM(__pyx_1, __pyx_2++); Py_INCREF(__pyx_3); } - else { - __pyx_3 = PyIter_Next(__pyx_1); - if (!__pyx_3) { - break; - } - } - if (PyTuple_CheckExact(__pyx_3) && PyTuple_GET_SIZE(__pyx_3) == 2) { - PyObject* tuple = __pyx_3; - __pyx_5 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_5); - Py_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_5; - __pyx_5 = 0; - __pyx_5 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_5); - Py_DECREF(__pyx_v_value); - __pyx_v_value = __pyx_5; - __pyx_5 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - else { - __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_5; - __pyx_5 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_v_value); - __pyx_v_value = __pyx_5; - __pyx_5 = 0; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - } - - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":24 - * pjargs = [] - * for key,value in projparams.iteritems(): - * pjargs.append('+'+key+"="+str(value)+' ') # <<<<<<<<<<<<<< - * self.srs = ''.join(pjargs) + * self.srs = projstring # <<<<<<<<<<<<<< * self.pjinitstring = PyString_AsString(self.srs) - */ - __pyx_5 = PyNumber_Add(__pyx_k_3p, __pyx_v_key); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyNumber_Add(__pyx_5, __pyx_k_4p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_value); - __pyx_5 = PyObject_Call(((PyObject*)&PyString_Type), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_4 = PyNumber_Add(__pyx_3, __pyx_5); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = PyNumber_Add(__pyx_4, __pyx_k_5p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_5 = __Pyx_PyObject_Append(__pyx_v_pjargs, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - } - Py_DECREF(__pyx_1); __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":25 - * for key,value in projparams.iteritems(): - * pjargs.append('+'+key+"="+str(value)+' ') - * self.srs = ''.join(pjargs) # <<<<<<<<<<<<<< - * self.pjinitstring = PyString_AsString(self.srs) * # initialize projection */ - __pyx_4 = PyObject_GetAttr(__pyx_k_6p, __pyx_n_join); if (unlikely(!__pyx_4)) {__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;} - Py_INCREF(__pyx_v_pjargs); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_pjargs); - __pyx_5 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; + 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_5; - __pyx_5 = 0; + ((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->srs = __pyx_v_projstring; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":26 - * pjargs.append('+'+key+"="+str(value)+' ') - * self.srs = ''.join(pjargs) + /* "/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":28 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":23 * self.pjinitstring = PyString_AsString(self.srs) * # initialize projection * self.projpj = pj_init_plus(self.pjinitstring) # <<<<<<<<<<<<<< @@ -407,65 +264,60 @@ */ ((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":29 + /* "/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_6 = (pj_errno != 0); - if (__pyx_6) { + __pyx_1 = (pj_errno != 0); + if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":30 + /* "/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_1 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1); - __pyx_1 = 0; - __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1;} - goto __pyx_L6; + __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_L6:; + __pyx_L4:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":31 + /* "/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_5 = PyFloat_FromDouble((PJ_VERSION / 100.)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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_5; - __pyx_5 = 0; + ((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_1); + Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - Py_XDECREF(__pyx_5); __Pyx_AddTraceback("_proj.Proj.__cinit__"); __pyx_r = -1; __pyx_L0:; - Py_DECREF(__pyx_v_pjargs); - Py_DECREF(__pyx_v_key); - Py_DECREF(__pyx_v_value); return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":33 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":28 * self.proj_version = PJ_VERSION/100. * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -477,7 +329,7 @@ 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":35 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":30 * def __dealloc__(self): * """destroy projection definition""" * pj_free(self.projpj) # <<<<<<<<<<<<<< @@ -488,12 +340,12 @@ } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":37 +/* "/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.projparams,)) + * return (self.__class__,(self.srs,)) */ static PyObject *__pyx_n___class__; @@ -506,18 +358,18 @@ PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":39 + /* "/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.projparams,)) # <<<<<<<<<<<<<< + * 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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams); - PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_proj_Proj *)__pyx_v_self)->projparams); - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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; @@ -538,17 +390,17 @@ return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":41 - * return (self.__class__,(self.projparams,)) +/* "/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_7p; +static PyObject *__pyx_k_3p; -static char __pyx_k_7[] = "Buffer lengths not the same"; +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 "; @@ -588,7 +440,7 @@ } } 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 = 41; __pyx_clineno = __LINE__; goto __pyx_L2;} + 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:; @@ -596,7 +448,7 @@ return NULL; __pyx_L3:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":55 + /* "/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: # <<<<<<<<<<<<<< @@ -606,7 +458,7 @@ __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":56 + /* "/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 # <<<<<<<<<<<<<< @@ -614,12 +466,12 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__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":57 + /* "/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: # <<<<<<<<<<<<<< @@ -629,7 +481,7 @@ __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":58 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":53 * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &bufleny) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -637,12 +489,12 @@ * if buflenx != bufleny: */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__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":60 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":55 * raise RuntimeError * # process data in buffer * if buflenx != bufleny: # <<<<<<<<<<<<<< @@ -652,42 +504,42 @@ __pyx_1 = (__pyx_v_buflenx != __pyx_v_bufleny); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":61 + /* "/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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(__pyx_k_7p); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k_7p); - __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__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":62 + /* "/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 = 62; __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 = 62; __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 = 62; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 62; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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":63 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":58 * raise RuntimeError("Buffer lengths not the same") * ndim = buflenx/_doublesize * lonsdata = <double *>londata # <<<<<<<<<<<<<< @@ -696,7 +548,7 @@ */ __pyx_v_lonsdata = ((double *)__pyx_v_londata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":64 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":59 * ndim = buflenx/_doublesize * lonsdata = <double *>londata * latsdata = <double *>latdata # <<<<<<<<<<<<<< @@ -705,7 +557,7 @@ */ __pyx_v_latsdata = ((double *)__pyx_v_latdata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":65 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":60 * lonsdata = <double *>londata * latsdata = <double *>latdata * for i from 0 <= i < ndim: # <<<<<<<<<<<<<< @@ -714,17 +566,17 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":66 + /* "/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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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":67 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":62 * for i from 0 <= i < ndim: * if radians: * projlonlatin.u = lonsdata[i] # <<<<<<<<<<<<<< @@ -733,7 +585,7 @@ */ __pyx_v_projlonlatin.u = (__pyx_v_lonsdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":68 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":63 * if radians: * projlonlatin.u = lonsdata[i] * projlonlatin.v = latsdata[i] # <<<<<<<<<<<<<< @@ -745,41 +597,41 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":70 + /* "/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 = 70; __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 = 70; __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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":71 + /* "/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 = 71; __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 = 71; __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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":72 + /* "/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) # <<<<<<<<<<<<<< @@ -788,7 +640,7 @@ */ __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":73 + /* "/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: # <<<<<<<<<<<<<< @@ -797,36 +649,36 @@ */ __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 = 73; __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;} 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 = 73; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 73; __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":74 + /* "/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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__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":77 + /* "/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: # <<<<<<<<<<<<<< @@ -836,7 +688,7 @@ __pyx_1 = (__pyx_v_projxyout.u == HUGE_VAL); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":78 + /* "/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 # <<<<<<<<<<<<<< @@ -848,7 +700,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":80 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":75 * lonsdata[i] = 1.e30 * else: * lonsdata[i] = projxyout.u # <<<<<<<<<<<<<< @@ -859,7 +711,7 @@ } __pyx_L11:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":81 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":76 * else: * lonsdata[i] = projxyout.u * if projxyout.v == HUGE_VAL: # <<<<<<<<<<<<<< @@ -869,7 +721,7 @@ __pyx_1 = (__pyx_v_projxyout.v == HUGE_VAL); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":82 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":77 * lonsdata[i] = projxyout.u * if projxyout.v == HUGE_VAL: * latsdata[i] = 1.e30 # <<<<<<<<<<<<<< @@ -881,7 +733,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":84 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":79 * latsdata[i] = 1.e30 * else: * latsdata[i] = projxyout.v # <<<<<<<<<<<<<< @@ -905,7 +757,7 @@ return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":86 +/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":81 * latsdata[i] = projxyout.v * * def _inv(self, object x, object y, radians=False, errcheck=False): # <<<<<<<<<<<<<< @@ -913,9 +765,9 @@ * inverse transformation - x,y to lons,lats (done in place). */ -static PyObject *__pyx_k_8p; +static PyObject *__pyx_k_4p; -static char __pyx_k_8[] = "Buffer lengths not the same"; +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 "; @@ -955,7 +807,7 @@ } } 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 = 86; __pyx_clineno = __LINE__; goto __pyx_L2;} + 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:; @@ -963,7 +815,7 @@ return NULL; __pyx_L3:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":100 + /* "/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: # <<<<<<<<<<<<<< @@ -973,7 +825,7 @@ __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":101 + /* "/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 # <<<<<<<<<<<<<< @@ -981,12 +833,12 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__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":102 + /* "/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: # <<<<<<<<<<<<<< @@ -996,7 +848,7 @@ __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":103 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":98 * raise RuntimeError * if PyObject_AsWriteBuffer(y, &ydata, &bufleny) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -1004,12 +856,12 @@ * # (for numpy/regular python arrays). */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__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":106 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":101 * # process data in buffer * # (for numpy/regular python arrays). * if buflenx != bufleny: # <<<<<<<<<<<<<< @@ -1019,42 +871,42 @@ __pyx_1 = (__pyx_v_buflenx != __pyx_v_bufleny); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":107 + /* "/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 = 107; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(__pyx_k_8p); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k_8p); - __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 107; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__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":108 + /* "/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 = 108; __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 = 108; __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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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":109 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":104 * raise RuntimeError("Buffer lengths not the same") * ndim = buflenx/_doublesize * xdatab = <double *>xdata # <<<<<<<<<<<<<< @@ -1063,7 +915,7 @@ */ __pyx_v_xdatab = ((double *)__pyx_v_xdata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":110 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":105 * ndim = buflenx/_doublesize * xdatab = <double *>xdata * ydatab = <double *>ydata # <<<<<<<<<<<<<< @@ -1072,7 +924,7 @@ */ __pyx_v_ydatab = ((double *)__pyx_v_ydata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":111 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":106 * xdatab = <double *>xdata * ydatab = <double *>ydata * for i from 0 <= i < ndim: # <<<<<<<<<<<<<< @@ -1081,7 +933,7 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":112 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":107 * ydatab = <double *>ydata * for i from 0 <= i < ndim: * projxyin.u = xdatab[i] # <<<<<<<<<<<<<< @@ -1090,7 +942,7 @@ */ __pyx_v_projxyin.u = (__pyx_v_xdatab[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":113 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":108 * for i from 0 <= i < ndim: * projxyin.u = xdatab[i] * projxyin.v = ydatab[i] # <<<<<<<<<<<<<< @@ -1099,7 +951,7 @@ */ __pyx_v_projxyin.v = (__pyx_v_ydatab[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":114 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":109 * projxyin.u = xdatab[i] * projxyin.v = ydatab[i] * projlonlatout = pj_inv(projxyin,self.projpj) # <<<<<<<<<<<<<< @@ -1108,7 +960,7 @@ */ __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":115 + /* "/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: # <<<<<<<<<<<<<< @@ -1117,36 +969,36 @@ */ __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 = 115; __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;} 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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 115; __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":116 + /* "/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 = 116; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 116; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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 = 116; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__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":119 + /* "/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: # <<<<<<<<<<<<<< @@ -1156,7 +1008,7 @@ __pyx_1 = (__pyx_v_projlonlatout.u == HUGE_VAL); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":120 + /* "/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 # <<<<<<<<<<<<<< @@ -1167,17 +1019,17 @@ goto __pyx_L10; } - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":121 + /* "/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 = 121; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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":122 + /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":117 * xdatab[i] = 1.e30 * elif radians: * xdatab[i] = projlonlatout.u # <<<<<<<<<<<<<< @@ -1189,25 +1041,25 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":124 + /* "/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 = 124; __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 = 124; __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 = 124; __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 = 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_clinen... [truncated message content] |
From: <js...@us...> - 2008-05-29 11:47:47
|
Revision: 5297 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5297&view=rev Author: jswhit Date: 2008-05-29 04:47:44 -0700 (Thu, 29 May 2008) Log Message: ----------- added Changelog entry for pyproj update, fixed typo in README. Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/README Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-05-28 18:39:05 UTC (rev 5296) +++ trunk/toolkits/basemap/Changelog 2008-05-29 11:47:44 UTC (rev 5297) @@ -1,4 +1,5 @@ version 0.99 + * updated pyproj to 1.8.5. * fixed bug in NetCDFFile creating masked arrays when both _FillValue and missing_value exist. * drawparallels and drawmeridians return a dictionary containing Modified: trunk/toolkits/basemap/README =================================================================== --- trunk/toolkits/basemap/README 2008-05-28 18:39:05 UTC (rev 5296) +++ trunk/toolkits/basemap/README 2008-05-29 11:47:44 UTC (rev 5297) @@ -100,7 +100,7 @@ the client is included) and httplib2. By default, setup.py checks to see if these are already installed, and if so does not try to overwrite them. If you get import errors related to either of these two packages, -edit setup.cfg and set pydap and/or httplib to True to force +edit setup.cfg and set pydap and/or httplib2 to True to force installation of the included versions. 4) To test, cd to the examples directory and run 'python simpletest.py'. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-05-30 20:55:34
|
Revision: 5338 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5338&view=rev Author: jswhit Date: 2008-05-30 13:55:24 -0700 (Fri, 30 May 2008) Log Message: ----------- added basemap workbook chapter pdf from py4science course. Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/MANIFEST.in Added Paths: ----------- trunk/toolkits/basemap/basemap_workbook.pdf Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-05-30 20:25:57 UTC (rev 5337) +++ trunk/toolkits/basemap/Changelog 2008-05-30 20:55:24 UTC (rev 5338) @@ -1,4 +1,4 @@ -version 0.99 (svn revision 5316) +version 0.99 (svn revision 5338) * updated pyproj to 1.8.5. * fixed bug in NetCDFFile creating masked arrays when both _FillValue and missing_value exist. Modified: trunk/toolkits/basemap/MANIFEST.in =================================================================== --- trunk/toolkits/basemap/MANIFEST.in 2008-05-30 20:25:57 UTC (rev 5337) +++ trunk/toolkits/basemap/MANIFEST.in 2008-05-30 20:55:24 UTC (rev 5338) @@ -4,6 +4,7 @@ include LICENSE_proj4 include LICENSE_pyshapelib include LICENSE_data +include basemap_workbook.pdf include API_CHANGES include KNOWN_BUGS include Changelog Added: trunk/toolkits/basemap/basemap_workbook.pdf =================================================================== (Binary files differ) Property changes on: trunk/toolkits/basemap/basemap_workbook.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-05-30 22:24:11
|
Revision: 5339 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5339&view=rev Author: jswhit Date: 2008-05-30 15:24:06 -0700 (Fri, 30 May 2008) Log Message: ----------- updated pyproj to 1.8.6 Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py trunk/toolkits/basemap/src/_geod.c trunk/toolkits/basemap/src/_geod.pyx trunk/toolkits/basemap/src/_pyproj.pxi Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-05-30 20:55:24 UTC (rev 5338) +++ trunk/toolkits/basemap/Changelog 2008-05-30 22:24:06 UTC (rev 5339) @@ -1,5 +1,5 @@ -version 0.99 (svn revision 5338) - * updated pyproj to 1.8.5. +version 0.99 (svn revision 5339) + * updated pyproj to 1.8.6. * fixed bug in NetCDFFile creating masked arrays when both _FillValue and missing_value exist. * drawparallels and drawmeridians return a dictionary containing Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py 2008-05-30 20:55:24 UTC (rev 5338) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pyproj.py 2008-05-30 22:24:06 UTC (rev 5339) @@ -53,7 +53,7 @@ from array import array from types import TupleType, ListType, NoneType import os -import numpy as np +#import numpy as np pyproj_datadir = os.sep.join([os.path.dirname(__file__), 'data']) set_datapath(pyproj_datadir) @@ -369,10 +369,11 @@ """ initialize a Geod class instance. - Geodetic parameters for specifying the ellipsoid or sphere to - use must either be given in a dictionary 'initparams' or as - keyword arguments. Following is a list of the ellipsoids that - may be defined using the 'ellps' keyword: + Geodetic parameters for specifying the ellipsoid + can be given in a dictionary 'initparams', as keyword arguments, + or as as proj4 geod initialization string. + Following is a list of the ellipsoids that may be defined using the + 'ellps' keyword: MERIT a=6378137.0 rf=298.257 MERIT 1983 SGS85 a=6378136.0 rf=298.257 Soviet Geodetic System 85 @@ -457,20 +458,35 @@ 54.663 -123.448 288303.720 -65.463 79.342 4013037.318 51.254 -71.576 5579916.649 + >>> g2 = Geod('+ellps=clrk66') # use proj4 style initialization string + >>> az12,az21,dist = g2.inv(boston_lon,boston_lat,portland_lon,portland_lat) + >>> print "%7.3f %6.3f %12.3f" % (az12,az21,dist) + -66.531 75.654 4164192.708 """ - # if projparams is None, use kwargs. + # if initparams is None, use kwargs. if initparams is None: if len(kwargs) == 0: raise RuntimeError('no ellipsoid control parameters specified') else: - initparams = kwargs - # set units to meters. - if not initparams.has_key('units'): - initparams['units']='m' - elif initparams['units'] != 'm': - print 'resetting units to meters ...' - initparams['units']='m' - return _Geod.__new__(self, initparams) + initstring = _dict2string(kwargs) + elif type(initparams) == str: + # if projparams is a string, interpret as a proj4 init string. + initstring = initparams + else: # projparams a dict + initstring = _dict2string(initparams) + # make sure units are meters. + if not initstring.count('+units='): + initstring = '+units=m '+initstring + else: + kvpairs = [] + for kvpair in initstring.split(): + if kvpair.startswith('+units'): + k,v = kvpair.split('=') + kvpairs.append(k+'=m ') + else: + kvpairs.append(kvpair+' ') + initstring = ''.join(kvpairs) + return _Geod.__new__(self, initstring) def fwd(self, lons, lats, az, dist, radians=False): """ Modified: trunk/toolkits/basemap/src/_geod.c =================================================================== --- trunk/toolkits/basemap/src/_geod.c 2008-05-30 20:55:24 UTC (rev 5338) +++ trunk/toolkits/basemap/src/_geod.c 2008-05-30 22:24:06 UTC (rev 5339) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.9.6.14 on Tue May 20 09:25:55 2008 */ +/* Generated by Cython 0.9.6.14 on Fri May 30 16:08:08 2008 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -103,20 +103,6 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ - -static inline PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; - Py_INCREF(Py_None); - return Py_None; // this is just to have an accurate signature - } - else { - return PyObject_CallMethod(L, "append", "(O)", x); - } -} - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/ @@ -127,18 +113,18 @@ /* Declarations */ -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":5 +/* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":5 * include "_pyproj.pxi" * * cdef class Geod: # <<<<<<<<<<<<<< * cdef GEODESIC_T geodesic_t - * cdef public object geodparams + * cdef public object geodstring */ struct __pyx_obj_5_geod_Geod { PyObject_HEAD GEODESIC_T geodesic_t; - PyObject *geodparams; + PyObject *geodstring; PyObject *proj_version; char *geodinitstring; }; @@ -148,7 +134,7 @@ /* Implementation of _geod */ -static char __pyx_k_2[] = "1.8.4"; +static char __pyx_k_2[] = "1.8.5"; static PyObject *__pyx_n___cinit__; static PyObject *__pyx_n___reduce__; @@ -165,179 +151,61 @@ static PyObject *__pyx_k_2p; -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":11 +/* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":11 * cdef char *geodinitstring * - * def __new__(self, geodparams): # <<<<<<<<<<<<<< + * def __new__(self, geodstring): # <<<<<<<<<<<<<< * cdef GEODESIC_T GEOD_T - * self.geodparams = geodparams + * # setup geod initialization string. */ -static PyObject *__pyx_n_iteritems; -static PyObject *__pyx_n_append; -static PyObject *__pyx_n_join; static PyObject *__pyx_n_RuntimeError; -static PyObject *__pyx_k_3p; -static PyObject *__pyx_k_4p; -static PyObject *__pyx_k_5p; -static PyObject *__pyx_k_6p; - static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_3[] = "+"; -static char __pyx_k_4[] = "="; -static char __pyx_k_5[] = " "; -static char __pyx_k_6[] = ""; - static int __pyx_pf_5_geod_4Geod___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_5_geod_4Geod___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_geodparams = 0; + PyObject *__pyx_v_geodstring = 0; GEODESIC_T __pyx_v_GEOD_T; - PyObject *__pyx_v_geodargs; - PyObject *__pyx_v_key; - PyObject *__pyx_v_value; int __pyx_r; - PyObject *__pyx_1 = 0; - Py_ssize_t __pyx_2 = 0; + int __pyx_1; + PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - PyObject *__pyx_5 = 0; - int __pyx_6; - static char *__pyx_argnames[] = {"geodparams",0}; + static char *__pyx_argnames[] = {"geodstring",0}; if (likely(!__pyx_kwds) && likely(PyTuple_GET_SIZE(__pyx_args) == 1)) { - __pyx_v_geodparams = PyTuple_GET_ITEM(__pyx_args, 0); + __pyx_v_geodstring = PyTuple_GET_ITEM(__pyx_args, 0); } else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_geodparams))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L2;} + if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_geodstring))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L2;} } goto __pyx_L3; __pyx_L2:; __Pyx_AddTraceback("_geod.Geod.__cinit__"); return -1; __pyx_L3:; - __pyx_v_geodargs = Py_None; Py_INCREF(Py_None); - __pyx_v_key = Py_None; Py_INCREF(Py_None); - __pyx_v_value = Py_None; Py_INCREF(Py_None); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":13 - * def __new__(self, geodparams): + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":14 * cdef GEODESIC_T GEOD_T - * self.geodparams = geodparams # <<<<<<<<<<<<<< - * # setup proj initialization string. - * geodargs = [] - */ - Py_INCREF(__pyx_v_geodparams); - Py_DECREF(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams); - ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams = __pyx_v_geodparams; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":15 - * self.geodparams = geodparams - * # setup proj initialization string. - * geodargs = [] # <<<<<<<<<<<<<< - * for key,value in geodparams.iteritems(): - * geodargs.append('+'+key+"="+str(value)+' ') - */ - __pyx_1 = PyList_New(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_v_geodargs); - __pyx_v_geodargs = ((PyObject *)__pyx_1); - __pyx_1 = 0; - - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":16 - * # setup proj initialization string. - * geodargs = [] - * for key,value in geodparams.iteritems(): # <<<<<<<<<<<<<< - * geodargs.append('+'+key+"="+str(value)+' ') - * self.geodinitstring = PyString_AsString(''.join(geodargs)) - */ - __pyx_1 = PyObject_GetAttr(__pyx_v_geodparams, __pyx_n_iteritems); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - if (PyList_CheckExact(__pyx_3)) { __pyx_2 = 0; __pyx_1 = __pyx_3; Py_INCREF(__pyx_1); } - else { __pyx_1 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} } - Py_DECREF(__pyx_3); __pyx_3 = 0; - for (;;) { - if (PyList_CheckExact(__pyx_1)) { if (__pyx_2 >= PyList_GET_SIZE(__pyx_1)) break; __pyx_3 = PyList_GET_ITEM(__pyx_1, __pyx_2++); Py_INCREF(__pyx_3); } - else { - __pyx_3 = PyIter_Next(__pyx_1); - if (!__pyx_3) { - break; - } - } - if (PyTuple_CheckExact(__pyx_3) && PyTuple_GET_SIZE(__pyx_3) == 2) { - PyObject* tuple = __pyx_3; - __pyx_5 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_5); - Py_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_5; - __pyx_5 = 0; - __pyx_5 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_5); - Py_DECREF(__pyx_v_value); - __pyx_v_value = __pyx_5; - __pyx_5 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - else { - __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_5; - __pyx_5 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_v_value); - __pyx_v_value = __pyx_5; - __pyx_5 = 0; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - } - - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":17 - * geodargs = [] - * for key,value in geodparams.iteritems(): - * geodargs.append('+'+key+"="+str(value)+' ') # <<<<<<<<<<<<<< - * self.geodinitstring = PyString_AsString(''.join(geodargs)) + * # setup geod initialization string. + * self.geodstring = geodstring # <<<<<<<<<<<<<< + * self.geodinitstring = PyString_AsString(self.geodstring) * # initialize projection */ - __pyx_5 = PyNumber_Add(__pyx_k_3p, __pyx_v_key); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyNumber_Add(__pyx_5, __pyx_k_4p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_value); - __pyx_5 = PyObject_Call(((PyObject*)&PyString_Type), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_4 = PyNumber_Add(__pyx_3, __pyx_5); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = PyNumber_Add(__pyx_4, __pyx_k_5p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_5 = __Pyx_PyObject_Append(__pyx_v_geodargs, __pyx_3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - } - Py_DECREF(__pyx_1); __pyx_1 = 0; + Py_INCREF(__pyx_v_geodstring); + Py_DECREF(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodstring); + ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodstring = __pyx_v_geodstring; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":18 - * for key,value in geodparams.iteritems(): - * geodargs.append('+'+key+"="+str(value)+' ') - * self.geodinitstring = PyString_AsString(''.join(geodargs)) # <<<<<<<<<<<<<< + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":15 + * # setup geod initialization string. + * self.geodstring = geodstring + * self.geodinitstring = PyString_AsString(self.geodstring) # <<<<<<<<<<<<<< * # initialize projection * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] */ - __pyx_4 = PyObject_GetAttr(__pyx_k_6p, __pyx_n_join); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(__pyx_v_geodargs); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_geodargs); - __pyx_5 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodinitstring = PyString_AsString(__pyx_5); - Py_DECREF(__pyx_5); __pyx_5 = 0; + ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodinitstring = PyString_AsString(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodstring); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":20 - * self.geodinitstring = PyString_AsString(''.join(geodargs)) + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":17 + * self.geodinitstring = PyString_AsString(self.geodstring) * # initialize projection * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] # <<<<<<<<<<<<<< * if pj_errno != 0: @@ -345,70 +213,65 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t = (GEOD_init_plus(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodinitstring, (&__pyx_v_GEOD_T))[0]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":21 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":18 * # initialize projection * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] * if pj_errno != 0: # <<<<<<<<<<<<<< * raise RuntimeError(pj_strerrno(pj_errno)) * self.proj_version = PJ_VERSION/100. */ - __pyx_6 = (pj_errno != 0); - if (__pyx_6) { + __pyx_1 = (pj_errno != 0); + if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":22 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":19 * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< * self.proj_version = PJ_VERSION/100. * */ - __pyx_1 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1); - __pyx_1 = 0; - __pyx_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1;} - goto __pyx_L6; + __pyx_2 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __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 = 19; __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 = 19; __pyx_clineno = __LINE__; goto __pyx_L1;} + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":23 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":20 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * self.proj_version = PJ_VERSION/100. # <<<<<<<<<<<<<< * * def __reduce__(self): */ - __pyx_5 = PyFloat_FromDouble((PJ_VERSION / 100.)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyFloat_FromDouble((PJ_VERSION / 100.)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->proj_version); - ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->proj_version = __pyx_5; - __pyx_5 = 0; + ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->proj_version = __pyx_3; + __pyx_3 = 0; __pyx_r = 0; goto __pyx_L0; __pyx_L1:; - Py_XDECREF(__pyx_1); + Py_XDECREF(__pyx_2); Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - Py_XDECREF(__pyx_5); __Pyx_AddTraceback("_geod.Geod.__cinit__"); __pyx_r = -1; __pyx_L0:; - Py_DECREF(__pyx_v_geodargs); - Py_DECREF(__pyx_v_key); - Py_DECREF(__pyx_v_value); return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":25 +/* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":22 * self.proj_version = PJ_VERSION/100. * * def __reduce__(self): # <<<<<<<<<<<<<< * """special method that allows pyproj.Geod instance to be pickled""" - * return (self.__class__,(self.geodparams,)) + * return (self.__class__,(self.geodstring,)) */ static PyObject *__pyx_n___class__; @@ -421,18 +284,18 @@ PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":27 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":24 * def __reduce__(self): * """special method that allows pyproj.Geod instance to be pickled""" - * return (self.__class__,(self.geodparams,)) # <<<<<<<<<<<<<< + * return (self.__class__,(self.geodstring,)) # <<<<<<<<<<<<<< * * def _fwd(self, object lons, object lats, object az, object dist, radians=False): */ - __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams); - PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams); - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} + Py_INCREF(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodstring); + PyTuple_SET_ITEM(__pyx_2, 0, ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodstring); + __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __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; @@ -453,8 +316,8 @@ return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":29 - * return (self.__class__,(self.geodparams,)) +/* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":26 + * return (self.__class__,(self.geodstring,)) * * def _fwd(self, object lons, object lats, object az, object dist, radians=False): # <<<<<<<<<<<<<< * """ @@ -463,13 +326,13 @@ static PyObject *__pyx_n_ValueError; -static PyObject *__pyx_k_7p; -static PyObject *__pyx_k_8p; +static PyObject *__pyx_k_3p; +static PyObject *__pyx_k_4p; static PyObject *__pyx_builtin_ValueError; -static char __pyx_k_7[] = "Buffer lengths not the same"; -static char __pyx_k_8[] = "undefined forward geodesic (may be an equatorial arc)"; +static char __pyx_k_3[] = "Buffer lengths not the same"; +static char __pyx_k_4[] = "undefined forward geodesic (may be an equatorial arc)"; static PyObject *__pyx_pf_5_geod_4Geod__fwd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5_geod_4Geod__fwd[] = "\n forward transformation - determine longitude, latitude and back azimuth \n of a terminus point given an initial point longitude and latitude, plus\n forward azimuth and distance.\n if radians=True, lons/lats are radians instead of degrees.\n "; @@ -514,7 +377,7 @@ } } else { - if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO|O", __pyx_argnames, &__pyx_v_lons, &__pyx_v_lats, &__pyx_v_az, &__pyx_v_dist, &__pyx_v_radians))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L2;} + if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO|O", __pyx_argnames, &__pyx_v_lons, &__pyx_v_lats, &__pyx_v_az, &__pyx_v_dist, &__pyx_v_radians))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L2;} } goto __pyx_L3; __pyx_L2:; @@ -522,7 +385,7 @@ return NULL; __pyx_L3:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":40 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":37 * cdef void *londata, *latdata, *azdat, *distdat * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons, &londata, &buflenlons) <> 0: # <<<<<<<<<<<<<< @@ -532,7 +395,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lons, (&__pyx_v_londata), (&__pyx_v_buflenlons)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":41 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":38 * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons, &londata, &buflenlons) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -540,12 +403,12 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L4; } __pyx_L4:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":42 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":39 * if PyObject_AsWriteBuffer(lons, &londata, &buflenlons) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: # <<<<<<<<<<<<<< @@ -555,7 +418,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lats, (&__pyx_v_latdata), (&__pyx_v_buflenlats)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":43 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":40 * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -563,12 +426,12 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L5; } __pyx_L5:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":44 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":41 * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: # <<<<<<<<<<<<<< @@ -578,7 +441,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_az, (&__pyx_v_azdat), (&__pyx_v_buflenaz)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":45 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":42 * raise RuntimeError * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -586,12 +449,12 @@ * raise RuntimeError */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L6; } __pyx_L6:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":46 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":43 * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(dist, &distdat, &buflend) <> 0: # <<<<<<<<<<<<<< @@ -601,7 +464,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_dist, (&__pyx_v_distdat), (&__pyx_v_buflend)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":47 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":44 * raise RuntimeError * if PyObject_AsWriteBuffer(dist, &distdat, &buflend) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -609,12 +472,12 @@ * if not buflenlons == buflenlats == buflenaz == buflend: */ __Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L7; } __pyx_L7:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":49 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":46 * raise RuntimeError * # process data in buffer * if not buflenlons == buflenlats == buflenaz == buflend: # <<<<<<<<<<<<<< @@ -631,42 +494,42 @@ __pyx_2 = (!__pyx_1); if (__pyx_2) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":50 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":47 * # process data in buffer * if not buflenlons == buflenlats == buflenaz == buflend: * raise RuntimeError("Buffer lengths not the same") # <<<<<<<<<<<<<< * ndim = buflenlons/_doublesize * lonsdata = <double *>londata */ - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(__pyx_k_7p); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k_7p); - __pyx_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1;} + Py_INCREF(__pyx_k_3p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k_3p); + __pyx_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L8; } __pyx_L8:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":51 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":48 * if not buflenlons == buflenlats == buflenaz == buflend: * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize # <<<<<<<<<<<<<< * lonsdata = <double *>londata * latsdata = <double *>latdata */ - __pyx_3 = PyInt_FromSsize_t(__pyx_v_buflenlons); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__doublesize); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_5 = PyNumber_Divide(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyInt_FromSsize_t(__pyx_v_buflenlons); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__doublesize); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyNumber_Divide(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_6 = __pyx_PyIndex_AsSsize_t(__pyx_5); if (unlikely((__pyx_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_6 = __pyx_PyIndex_AsSsize_t(__pyx_5); if (unlikely((__pyx_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; __pyx_v_ndim = __pyx_6; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":52 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":49 * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize * lonsdata = <double *>londata # <<<<<<<<<<<<<< @@ -675,7 +538,7 @@ */ __pyx_v_lonsdata = ((double *)__pyx_v_londata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":53 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":50 * ndim = buflenlons/_doublesize * lonsdata = <double *>londata * latsdata = <double *>latdata # <<<<<<<<<<<<<< @@ -684,7 +547,7 @@ */ __pyx_v_latsdata = ((double *)__pyx_v_latdata); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":54 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":51 * lonsdata = <double *>londata * latsdata = <double *>latdata * azdata = <double *>azdat # <<<<<<<<<<<<<< @@ -693,7 +556,7 @@ */ __pyx_v_azdata = ((double *)__pyx_v_azdat); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":55 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":52 * latsdata = <double *>latdata * azdata = <double *>azdat * distdata = <double *>distdat # <<<<<<<<<<<<<< @@ -702,7 +565,7 @@ */ __pyx_v_distdata = ((double *)__pyx_v_distdat); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":56 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":53 * azdata = <double *>azdat * distdata = <double *>distdat * for i from 0 <= i < ndim: # <<<<<<<<<<<<<< @@ -711,17 +574,17 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":57 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":54 * distdata = <double *>distdat * for i from 0 <= i < ndim: * if radians: # <<<<<<<<<<<<<< * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] */ - __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1;} if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":58 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":55 * for i from 0 <= i < ndim: * if radians: * self.geodesic_t.p1.v = lonsdata[i] # <<<<<<<<<<<<<< @@ -730,7 +593,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = (__pyx_v_lonsdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":59 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":56 * if radians: * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] # <<<<<<<<<<<<<< @@ -739,7 +602,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = (__pyx_v_latsdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":60 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":57 * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] * self.geodesic_t.ALPHA12 = azdata[i] # <<<<<<<<<<<<<< @@ -748,7 +611,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA12 = (__pyx_v_azdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":61 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":58 * self.geodesic_t.p1.u = latsdata[i] * self.geodesic_t.ALPHA12 = azdata[i] * self.geodesic_t.DIST = distdata[i] # <<<<<<<<<<<<<< @@ -760,55 +623,55 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":63 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":60 * self.geodesic_t.DIST = distdata[i] * else: * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] # <<<<<<<<<<<<<< * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyFloat_FromDouble((__pyx_v_lonsdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyFloat_FromDouble((__pyx_v_lonsdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = __pyx_7; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":64 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":61 * else: * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] * self.geodesic_t.p1.u = _dg2rad*latsdata[i] # <<<<<<<<<<<<<< * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] * self.geodesic_t.DIST = distdata[i] */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyFloat_FromDouble((__pyx_v_latsdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyFloat_FromDouble((__pyx_v_latsdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = __pyx_7; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":65 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":62 * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] # <<<<<<<<<<<<<< * self.geodesic_t.DIST = distdata[i] * geod_pre(&self.geodesic_t) */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__dg2rad); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyFloat_FromDouble((__pyx_v_azdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __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 = 62; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyFloat_FromDouble((__pyx_v_azdata[__pyx_v_i])); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA12 = __pyx_7; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":66 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":63 * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] * self.geodesic_t.DIST = distdata[i] # <<<<<<<<<<<<<< @@ -819,7 +682,7 @@ } __pyx_L11:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":67 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":64 * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] * self.geodesic_t.DIST = distdata[i] * geod_pre(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -828,7 +691,7 @@ */ geod_pre((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":68 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":65 * self.geodesic_t.DIST = distdata[i] * geod_pre(&self.geodesic_t) * if pj_errno != 0: # <<<<<<<<<<<<<< @@ -838,27 +701,27 @@ __pyx_2 = (pj_errno != 0); if (__pyx_2) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":69 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":66 * geod_pre(&self.geodesic_t) * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< * geod_for(&self.geodesic_t) * if pj_errno != 0: */ - __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;} + __pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;} PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3); __pyx_3 = 0; - __pyx_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; __Pyx_Raise(__pyx_5, 0, 0); Py_DECREF(__pyx_5); __pyx_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L12; } __pyx_L12:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":70 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":67 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * geod_for(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -867,7 +730,7 @@ */ geod_for((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":71 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":68 * raise RuntimeError(pj_strerrno(pj_errno)) * geod_for(&self.geodesic_t) * if pj_errno != 0: # <<<<<<<<<<<<<< @@ -877,27 +740,27 @@ __pyx_1 = (pj_errno != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":72 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":69 * geod_for(&self.geodesic_t) * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< * if isnan(self.geodesic_t.ALPHA21): * raise ValueError('undefined forward geodesic (may be an equatorial arc)') */ - __pyx_3 = PyString_FromString(pj_strerrno(pj_errno)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} + __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_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_5)) {__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_5, 0, 0); Py_DECREF(__pyx_5); __pyx_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L13; } __pyx_L13:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":73 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":70 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * if isnan(self.geodesic_t.ALPHA21): # <<<<<<<<<<<<<< @@ -907,36 +770,36 @@ __pyx_8 = isnan(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA21); if (__pyx_8) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":74 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":71 * raise RuntimeError(pj_strerrno(pj_errno)) * if isnan(self.geodesic_t.ALPHA21): * raise ValueError('undefined forward geodesic (may be an equatorial arc)') # <<<<<<<<<<<<<< * if radians: * lonsdata[i] = self.geodesic_t.p2.v */ - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1;} - Py_INCREF(__pyx_k_8p); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k_8p); - __pyx_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1;} + Py_INCREF(__pyx_k_4p); + PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k_4p); + __pyx_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1;} goto __pyx_L14; } __pyx_L14:; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":75 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":72 * if isnan(self.geodesic_t.ALPHA21): * raise ValueError('undefined forward geodesic (may be an equatorial arc)') * if radians: # <<<<<<<<<<<<<< * lonsdata[i] = self.geodesic_t.p2.v * latsdata[i] = self.geodesic_t.p2.u */ - __pyx_2 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_2 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1;} if (__pyx_2) { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":76 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":73 * raise ValueError('undefined forward geodesic (may be an equatorial arc)') * if radians: * lonsdata[i] = self.geodesic_t.p2.v # <<<<<<<<<<<<<< @@ -945,7 +808,7 @@ */ (__pyx_v_lonsdata[__pyx_v_i]) = ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.v; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":77 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":74 * if radians: * lonsdata[i] = self.geodesic_t.p2.v * latsdata[i] = self.geodesic_t.p2.u # <<<<<<<<<<<<<< @@ -954,7 +817,7 @@ */ (__pyx_v_latsdata[__pyx_v_i]) = ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.u; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":78 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":75 * lonsdata[i] = self.geodesic_t.p2.v * latsdata[i] = self.geodesic_t.p2.u * azdata[i] = self.geodesic_t.ALPHA21 # <<<<<<<<<<<<<< @@ -966,51 +829,51 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":80 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":77 * azdata[i] = self.geodesic_t.ALPHA21 * else: * lonsdata[i] = _rad2dg*self.geodesic_t.p2.v # <<<<<<<<<<<<<< * latsdata[i] = _rad2dg*self.geodesic_t.p2.u * azdata[i] = _rad2dg*self.geodesic_t.ALPHA21 */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyFloat_FromDouble(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.v); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __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 = 80; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyFloat_FromDouble(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.v); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; (__pyx_v_lonsdata[__pyx_v_i]) = __pyx_7; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":81 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":78 * else: * lonsdata[i] = _rad2dg*self.geodesic_t.p2.v * latsdata[i] = _rad2dg*self.geodesic_t.p2.u # <<<<<<<<<<<<<< * azdata[i] = _rad2dg*self.geodesic_t.ALPHA21 * */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyFloat_FromDouble(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.u); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyFloat_FromDouble(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.u); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __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 = 78; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; (__pyx_v_latsdata[__pyx_v_i]) = __pyx_7; - /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geod.pyx":82 + /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":79 * lonsdata[i] = _rad2dg*self.geodesic_t.p2.v * latsdata[i] = _rad2dg*self.geodesic_t.p2.u * azdata[i] = _rad2dg*self.geodesic_t.ALPHA21 # <<<<<<<<<<<<<< * * def _inv(self, object lons1, object lats1, object lons2, object lats2, radians=False): */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1;} - __pyx_3 = PyFloat_FromDouble(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA21); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__rad2dg); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_3 = PyFloat_FromDouble(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA21); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __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 = 79; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_5); __pyx_5 = 0; Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1;} + __pyx_7 = __pyx_PyFloat_AsDouble(__pyx_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; (__pyx_v_azdata[__pyx_v_i]) = __pyx_7; } @@ -1029,7 +892,7 @@ return __pyx_r; } -/* "/Volumes/User/jwhitaker/matplotlib/... [truncated message content] |
From: <js...@us...> - 2008-06-05 01:19:02
|
Revision: 5392 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5392&view=rev Author: jswhit Date: 2008-06-04 18:18:55 -0700 (Wed, 04 Jun 2008) Log Message: ----------- change num2date/date2num default behavior so it is same as matplotlib's. Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-06-04 19:11:39 UTC (rev 5391) +++ trunk/toolkits/basemap/Changelog 2008-06-05 01:18:55 UTC (rev 5392) @@ -1,3 +1,5 @@ + * change default behaviour of num2date and date2num to be + the same as matplotlib counterparts. version 0.99 (svn revision 5344) * fix to warpimage method for API change in matplotlib 0.98.0. * updated pyproj to 1.8.6. Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-06-04 19:11:39 UTC (rev 5391) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-06-05 01:18:55 UTC (rev 5392) @@ -3263,7 +3263,7 @@ f = pupynere._LocalFile(file,maskandscale) return f -def num2date(times,units,calendar='standard'): +def num2date(times,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'): """ Return datetime objects given numeric time values. The units of the numeric time values are described by the units argument @@ -3271,10 +3271,9 @@ UTC with no time-zone offset, even if the specified units contain a time-zone offset. - Like the matplotlib num2date function, except that it allows - for different units and calendars. Behaves the same if - units = 'days since 001-01-01 00:00:00' and - calendar = 'proleptic_gregorian'. + Default behavior is the same as the matplotlib num2date function + but the reference time and calendar can be changed via the + 'units' and 'calendar' keywords. Arguments: @@ -3282,8 +3281,8 @@ units - a string of the form '<time units> since <reference time>' describing the time units. <time units> can be days, hours, minutes - or seconds. <reference time> is the time origin. A valid choice - would be units='hours since 1800-01-01 00:00:00 -6:00'. + or seconds. <reference time> is the time origin. + Default is 'days since 0001-01-01 00:00:00'. calendar - describes the calendar used in the time calculations. All the values currently defined in the CF metadata convention @@ -3291,7 +3290,7 @@ Valid calendars 'standard', 'gregorian', 'proleptic_gregorian' 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'. Default is 'standard'/'gregorian', which is a mixed - Julian/Gregorian calendar. + Julian/Gregorian calendar. Defalut 'proleptic_gregorian'. Returns a datetime instance, or an array of datetime instances. @@ -3306,7 +3305,7 @@ cdftime = netcdftime.utime(units,calendar=calendar) return cdftime.num2date(times) -def date2num(dates,units,calendar='standard'): +def date2num(dates,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'): """ Return numeric time values given datetime objects. The units of the numeric time values are described by the units argument @@ -3315,10 +3314,9 @@ time-zone offset in units, it will be applied to the returned numeric values. - Like the matplotlib date2num function, except that it allows - for different units and calendars. Behaves the same if - units = 'days since 0001-01-01 00:00:00' and - calendar = 'proleptic_gregorian'. + Default behavior is the same as the matplotlib date2num function + but the reference time and calendar can be changed via the + 'units' and 'calendar' keywords. Arguments: @@ -3327,8 +3325,8 @@ units - a string of the form '<time units> since <reference time>' describing the time units. <time units> can be days, hours, minutes - or seconds. <reference time> is the time origin. A valid choice - would be units='hours since 1800-01-01 00:00:00 -6:00'. + or seconds. <reference time> is the time origin. + Default is 'days since 0001-01-01 00:00:00'. calendar - describes the calendar used in the time calculations. All the values currently defined in the CF metadata convention @@ -3336,7 +3334,7 @@ Valid calendars 'standard', 'gregorian', 'proleptic_gregorian' 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'. Default is 'standard'/'gregorian', which is a mixed - Julian/Gregorian calendar. + Julian/Gregorian calendar. Default 'proleptic_gregorian'. Returns a numeric time value, or an array of numeric time values. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-06-09 18:10:42
|
Revision: 5438 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5438&view=rev Author: jswhit Date: 2008-06-09 11:10:36 -0700 (Mon, 09 Jun 2008) Log Message: ----------- add stub files for future sphinx docs. Added Paths: ----------- trunk/toolkits/basemap/doc/ trunk/toolkits/basemap/doc/README.txt trunk/toolkits/basemap/doc/api/ trunk/toolkits/basemap/doc/api/index.rst trunk/toolkits/basemap/doc/conf.py trunk/toolkits/basemap/doc/index.rst trunk/toolkits/basemap/doc/make.py trunk/toolkits/basemap/doc/users/ trunk/toolkits/basemap/doc/users/figures/ trunk/toolkits/basemap/doc/users/index.rst Added: trunk/toolkits/basemap/doc/README.txt =================================================================== --- trunk/toolkits/basemap/doc/README.txt (rev 0) +++ trunk/toolkits/basemap/doc/README.txt 2008-06-09 18:10:36 UTC (rev 5438) @@ -0,0 +1,2 @@ +* make _static and sphinxext symlinks here that point to the corresponding + directories in the matplotlib doc tree. Added: trunk/toolkits/basemap/doc/api/index.rst =================================================================== --- trunk/toolkits/basemap/doc/api/index.rst (rev 0) +++ trunk/toolkits/basemap/doc/api/index.rst 2008-06-09 18:10:36 UTC (rev 5438) @@ -0,0 +1,10 @@ +.. _api-index: + +#################################### + The Matplotlib Basemap Toolkit API +#################################### + +:Release: |version| +:Date: |today| + +.. toctree:: Added: trunk/toolkits/basemap/doc/conf.py =================================================================== --- trunk/toolkits/basemap/doc/conf.py (rev 0) +++ trunk/toolkits/basemap/doc/conf.py 2008-06-09 18:10:36 UTC (rev 5438) @@ -0,0 +1,165 @@ +# -*- coding: utf-8 -*- +# +# Basemap documentation build configuration file, created by +# sphinx-quickstart on Fri May 2 12:33:25 2008. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# The contents of this file are pickled, so don't put values in the namespace +# that aren't pickleable (module imports are okay, they're removed automatically). +# +# All configuration values have a default value; values that are commented out +# serve to show the default value. + +import sys, os + +# If your extensions are in another directory, add it here. If the directory +# is relative to the documentation root, use os.path.abspath to make it +# absolute, like shown here. +sys.path.append(os.path.abspath('sphinxext')) + +# Import support for ipython console session syntax highlighting (lives +# in the sphinxext directory defined above) +import ipython_console_highlighting + +# General configuration +# --------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['mathpng', 'sphinx.ext.autodoc'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General substitutions. +project = 'Basemap Basemap Toolkit' +copyright = '2008, Jeffrey Whitaker' + +# The default replacements for |version| and |release|, also used in various +# other places throughout the built documents. +# +# The short X.Y version. +version = '0.99' +# The full version, including alpha/beta/rc tags. +release = '0.99' + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +unused_docs = [] + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# Options for HTML output +# ----------------------- + +# The style sheet to use for HTML and HTML Help pages. A file of that name +# must exist either in Sphinx' static/ path, or in one of the custom paths +# given in html_static_path. +html_style = 'matplotlib.css' + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# The name of an image file (within the static path) to place at the top of +# the sidebar. +#html_logo = 'logo.png' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If nonempty, this is the file name suffix for generated HTML files. The +# default is ``".html"``. +#html_file_suffix = '.xhtml' + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_use_modindex = True + +# If true, the reST sources are included in the HTML build as _sources/<name>. +#html_copy_source = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. +html_use_opensearch = 'False' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'Basemapdoc' + + +# Options for LaTeX output +# ------------------------ + +# The paper size ('letter' or 'a4'). +latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +latex_font_size = '11pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, document class [howto/manual]). + +latex_documents = [ + ('index', 'Basemap.tex', 'Basemap', 'Jeffrey Whitaker', 'manual'), +] + + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +latex_logo = None + +# Additional stuff for the LaTeX preamble. +latex_preamble = '' + +# Documents to append as an appendix to all manuals. +latex_appendices = [] + +# If false, no module index is generated. +latex_use_modindex = True + +latex_use_parts = True + +# Show both class-level docstring and __init__ docstring in class +# documentation +autoclass_content = 'both' Added: trunk/toolkits/basemap/doc/index.rst =================================================================== --- trunk/toolkits/basemap/doc/index.rst (rev 0) +++ trunk/toolkits/basemap/doc/index.rst 2008-06-09 18:10:36 UTC (rev 5438) @@ -0,0 +1,19 @@ +.. basemap documentation master file + +Welcome to the Matplotlib Basemap Toolkit documentation! +======================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + users/index.rst + api/index.rst + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` Added: trunk/toolkits/basemap/doc/make.py =================================================================== --- trunk/toolkits/basemap/doc/make.py (rev 0) +++ trunk/toolkits/basemap/doc/make.py 2008-06-09 18:10:36 UTC (rev 5438) @@ -0,0 +1,72 @@ +#!/usr/bin/env python +import fileinput +import glob +import os +import shutil +import sys + +def check_build(): + build_dirs = ['build', 'build/doctrees', 'build/html', 'build/latex', + '_static', '_templates'] + for d in build_dirs: + try: + os.mkdir(d) + except OSError: + pass + +def figs(): + #os.system('cd users/figures/ && python make.py') + os.system('cd users/figures') + +def html(): + check_build() + figs() + os.system('sphinx-build -b html -d build/doctrees . build/html') + +def latex(): + check_build() + figs() + if sys.platform != 'win32': + # LaTeX format. + os.system('sphinx-build -b latex -d build/doctrees . build/latex') + + # Produce pdf. + os.chdir('build/latex') + + # Copying the makefile produced by sphinx... + os.system('pdflatex Basemap.tex') + os.system('pdflatex Basemap.tex') + os.system('makeindex -s python.ist Basemap.idx') + os.system('makeindex -s python.ist modBasemap.idx') + os.system('pdflatex Basemap.tex') + + os.chdir('../..') + else: + print 'latex build has not been tested on windows' + +def clean(): + shutil.rmtree('build') + +def all(): + figs() + html() + latex() + + +funcd = {'figs':figs, + 'html':html, + 'latex':latex, + 'clean':clean, + 'all':all, + } + + +if len(sys.argv)>1: + for arg in sys.argv[1:]: + func = funcd.get(arg) + if func is None: + raise SystemExit('Do not know how to handle %s; valid args are'%( + arg, funcd.keys())) + func() +else: + all() Property changes on: trunk/toolkits/basemap/doc/make.py ___________________________________________________________________ Name: svn:executable + * Added: trunk/toolkits/basemap/doc/users/index.rst =================================================================== --- trunk/toolkits/basemap/doc/users/index.rst (rev 0) +++ trunk/toolkits/basemap/doc/users/index.rst 2008-06-09 18:10:36 UTC (rev 5438) @@ -0,0 +1,10 @@ +.. _users-guide-index: + +############################################# + The Matplotlib Basemap Toolkit User's Guide +############################################# + +:Release: |version| +:Date: |today| + +.. toctree:: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-06-14 21:14:38
|
Revision: 5545 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5545&view=rev Author: jswhit Date: 2008-06-14 14:14:34 -0700 (Sat, 14 Jun 2008) Log Message: ----------- more docstring cleanups. don't use PyNIO in NetCDFFile. Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-06-14 16:35:55 UTC (rev 5544) +++ trunk/toolkits/basemap/Changelog 2008-06-14 21:14:34 UTC (rev 5545) @@ -1,3 +1,5 @@ + * don't try to use PyNIO in NetCDFFile (it was causing + too many suprises). * improved documentation using Sphinx/docutils. * change default behaviour of num2date and date2num to be the same as matplotlib counterparts. Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-06-14 16:35:55 UTC (rev 5544) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-06-14 21:14:34 UTC (rev 5545) @@ -161,7 +161,8 @@ (because either they are computed internally, or entire globe is always plotted). - For the cylindrical projections(``cyl``, ``merc`` and ``mill``), the default is to use + For the cylindrical projections (``cyl``, ``merc`` and ``mill``), + the default is to use llcrnrlon=-180,llcrnrlat=-90, urcrnrlon=180 and urcrnrlat=90). For all other projections except ``ortho`` and ``geos``, either the lat/lon values of the corners or width and height must be specified by the user. @@ -3192,42 +3193,51 @@ def interp(datain,xin,yin,xout,yout,checkbounds=False,masked=False,order=1): """ - dataout = interp(datain,xin,yin,xout,yout,order=1) + Interpolate data (``datain``) on a rectilinear grid (with x = ``xin`` + y = ``yin``) to a grid with x = ``xout``, y= ``yout``. - interpolate data (datain) on a rectilinear grid (with x=xin - y=yin) to a grid with x=xout, y=yout. + ============== ==================================================== + Arguments Description + ============== ==================================================== + datain a rank-2 array with 1st dimension corresponding to + y, 2nd dimension x. + xin, yin rank-1 arrays containing x and y of + datain grid in increasing order. + xout, yout rank-2 arrays containing x and y of desired output + grid. + ============== ==================================================== - datain is a rank-2 array with 1st dimension corresponding to y, - 2nd dimension x. + ============== ==================================================== + Keywords Description + ============== ==================================================== + checkbounds If True, values of xout and yout are checked to see + that they lie within the range specified by xin + and xin. + If False, and xout,yout are outside xin,yin, + interpolated values will be clipped to values on + boundary of input grid (xin,yin) + Default is False. + masked If True, points outside the range of xin and yin + are masked (in a masked array). + If masked is set to a number, then + points outside the range of xin and yin will be + set to that number. Default False. + order 0 for nearest-neighbor interpolation, 1 for + bilinear interpolation (default 1). + ============== ==================================================== - xin, yin are rank-1 arrays containing x and y of - datain grid in increasing order. + .. note:: + If datain is a masked array and order=1 (bilinear interpolation) is + used, elements of dataout will be masked if any of the four surrounding + points in datain are masked. To avoid this, do the interpolation in two + passes, first with order=1 (producing dataout1), then with order=0 + (producing dataout2). Then replace all the masked values in dataout1 + with the corresponding elements in dataout2 (using numpy.where). + This effectively uses nearest neighbor interpolation if any of the + four surrounding points in datain are masked, and bilinear interpolation + otherwise. - xout, yout are rank-2 arrays containing x and y of desired output grid. - - If checkbounds=True, values of xout and yout are checked to see that - they lie within the range specified by xin and xin. Default is False. - - If checkbounds=False, and xout,yout are outside xin,yin, interpolated - values will be clipped to values on boundary of input grid (xin,yin) - if masked=False. - - If masked=True, the return value will be a masked - array with those points masked. If masked is set to a number, then - points outside the range of xin and yin will be set to that number. - - The order keyword can be 0 for nearest-neighbor interpolation, - or 1 for bilinear interpolation (default 1). - - If datain is a masked array and order=1 (bilinear interpolation) is - used, elements of dataout will be masked if any of the four surrounding - points in datain are masked. To avoid this, do the interpolation in two - passes, first with order=1 (producing dataout1), then with order=0 - (producing dataout2). Then replace all the masked values in dataout1 - with the corresponding elements in dataout2 (using numpy.where). - This effectively uses nearest neighbor interpolation if any of the - four surrounding points in datain are masked, and bilinear interpolation - otherwise. + Returns ``dataout``, the interpolated data on the grid ``xout, yout``. """ # xin and yin must be monotonically increasing. if xin[-1]-xin[0] < 0 or yin[-1]-yin[0] < 0: @@ -3311,21 +3321,28 @@ def shiftgrid(lon0,datain,lonsin,start=True): """ - shift global lat/lon grid east or west. + Shift global lat/lon grid east or west. assumes wraparound (or cyclic point) is included. - lon0: starting longitude for shifted grid - (ending longitude if start=False). lon0 must be on - input grid (within the range of lonsin). + ============== ==================================================== + Arguments Description + ============== ==================================================== + lon0 starting longitude for shifted grid + (ending longitude if start=False). lon0 must be on + input grid (within the range of lonsin). + datain original data. + lonsin original longitudes. + ============== ==================================================== - datain: original data. + ============== ==================================================== + Keywords Description + ============== ==================================================== + start if True, lon0 represents the starting longitude + of the new grid. if False, lon0 is the ending + longitude. Default True. + ============== ==================================================== - lonsin: original longitudes. - - start[True]: if True, lon0 represents the starting longitude - of the new grid. if False, lon0 is the ending longitude. - - returns dataout,lonsout (data and longitudes on shifted grid). + returns ``dataout,lonsout`` (data and longitudes on shifted grid). """ if np.fabs(lonsin[-1]-lonsin[0]-360.) > 1.e-4: raise ValueError, 'cyclic point not included' @@ -3348,9 +3365,8 @@ def addcyclic(arrin,lonsin): """ - arrout, lonsout = addcyclic(arrin, lonsin) - - Add cyclic (wraparound) point in longitude. + ``arrout, lonsout = addcyclic(arrin, lonsin)`` + adds cyclic (wraparound) point in longitude to ``arrin`` and ``lonsin``. """ nlats = arrin.shape[0] nlons = arrin.shape[1] @@ -3383,85 +3399,71 @@ else: return corners -has_pynio = True -try: - from PyNGL import nio -except ImportError: - has_pynio = False - def NetCDFFile(file, maskandscale=True): """NetCDF File reader. API is the same as Scientific.IO.NetCDF. - If 'file' is a URL that starts with 'http', it is assumed + If ``file`` is a URL that starts with `http`, it is assumed to be a remote OPenDAP dataset, and the python dap client is used to retrieve the data. Only the OPenDAP Array and Grid data - types are recognized. If file does not start with 'http', it - is assumed to be a local file. If possible, the file will be read - with a pure python NetCDF reader, otherwise PyNIO - (http://www.pyngl.ucar.edu/Nio.shtml) will be used (if it is installed). - PyNIO supports NetCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS2 files. - Data read from OPenDAP and NetCDF version 3 datasets will + types are recognized. If file does not start with `http`, it + is assumed to be a local netCDF file. Data will automatically be converted to masked arrays if the variable has either - a 'missing_value' or '_FillValue' attribute, and some data points + a ``missing_value`` or ``_FillValue`` attribute, and some data points are equal to the value specified by that attribute. In addition, - variables stored as integers that have the 'scale_factor' and - 'add_offset' attribute will automatically be rescaled to floats when - read. If PyNIO is used, neither of the automatic conversions will - be performed. To suppress these automatic conversions, set the - maskandscale keyword to False. + variables stored as integers that have the ``scale_factor`` and + ``add_offset`` attribute will automatically be rescaled to floats when + read. To suppress these automatic conversions, set the + ``maskandscale`` keyword to False. """ if file.startswith('http'): return pupynere._RemoteFile(file,maskandscale) else: - # use pynio if it is installed and the file cannot - # be read with the pure python netCDF reader. This allows - # netCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS files - # to be read. - if has_pynio: - try: - f = pupynere._LocalFile(file,maskandscale) - except: - f = nio.open_file(file) - # otherwise, use the pupynere netCDF 3 pure python reader. - # (will fail if file is not a netCDF version 3 file). - else: - f = pupynere._LocalFile(file,maskandscale) - return f + return pupynere._LocalFile(file,maskandscale) def num2date(times,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'): """ Return datetime objects given numeric time values. The units - of the numeric time values are described by the units argument - and the calendar keyword. The returned datetime objects represent + of the numeric time values are described by the ``units`` argument + and the ``calendar`` keyword. The returned datetime objects represent UTC with no time-zone offset, even if the specified units contain a time-zone offset. - Default behavior is the same as the matplotlib num2date function + Default behavior is the same as the matplotlib.dates.num2date function but the reference time and calendar can be changed via the - 'units' and 'calendar' keywords. + ``units`` and ``calendar`` keywords. - Arguments: + ============== ==================================================== + Arguments Description + ============== ==================================================== + times numeric time values. Maximum resolution is 1 second. + ============== ==================================================== - times - numeric time values. Maximum resolution is 1 second. + ============== ==================================================== + Keywords Description + ============== ==================================================== + units a string of the form '<time units> since + <reference time>' describing the units and + origin of the time coordinate. + <time units> can be days, hours, minutes + or seconds. <reference time> is the time origin. + Default is 'days since 0001-01-01 00:00:00'. + calendar describes the calendar used in the time + calculations. All the values currently defined in + the CF metadata convention + (http://cf-pcmdi.llnl.gov/documents/cf-conventions/) + are supported. + Valid calendars ``standard``, ``gregorian``, + ``proleptic_gregorian``, ``noleap``, ``365_day``, + ``julian``, ``all_leap``, ``366_day``. + Default is ``proleptic_gregorian``. + ============== ==================================================== - units - a string of the form '<time units> since <reference time>' - describing the time units. <time units> can be days, hours, minutes - or seconds. <reference time> is the time origin. - Default is 'days since 0001-01-01 00:00:00'. - - calendar - describes the calendar used in the time calculations. - All the values currently defined in the CF metadata convention - (http://cf-pcmdi.llnl.gov/documents/cf-conventions/) are supported. - Valid calendars 'standard', 'gregorian', 'proleptic_gregorian' - 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'. - Default is 'standard'/'gregorian', which is a mixed - Julian/Gregorian calendar. Defalut 'proleptic_gregorian'. - Returns a datetime instance, or an array of datetime instances. The datetime instances returned are 'real' python datetime objects if the date falls in the Gregorian calendar (i.e. - calendar='proleptic_gregorian', or calendar = 'standard' or 'gregorian' - and the date is after 1582-10-15). Otherwise, they are 'phony' datetime + calendar=``proleptic_gregorian``, or calendar = ``standard`` + or ``gregorian`` and the date is after 1582-10-15). + Otherwise, they are 'phony' datetime objects which support some but not all the methods of 'real' python datetime objects. The datetime instances do not contain a time-zone offset, even if the specified units contains one. @@ -3472,34 +3474,44 @@ def date2num(dates,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'): """ Return numeric time values given datetime objects. The units - of the numeric time values are described by the units argument - and the calendar keyword. The datetime objects must + of the numeric time values are described by the ``units`` argument + and the ``calendar`` keyword. The datetime objects must be in UTC with no time-zone offset. If there is a time-zone offset in units, it will be applied to the returned numeric values. - Default behavior is the same as the matplotlib date2num function + Default behavior is the same as the matplotlib.dates.date2num function but the reference time and calendar can be changed via the - 'units' and 'calendar' keywords. + ``units`` and ``calendar`` keywords. - Arguments: + ============== ==================================================== + Arguments Description + ============== ==================================================== + dates A datetime object or a sequence of datetime objects. + The datetime objects should not include a + time-zone offset. + ============== ==================================================== - dates - A datetime object or a sequence of datetime objects. - The datetime objects should not include a time-zone offset. + ============== ==================================================== + Keywords Description + ============== ==================================================== + units a string of the form '<time units> since + <reference time>' describing the units and + origin of the time coordinate. + <time units> can be days, hours, minutes + or seconds. <reference time> is the time origin. + Default is 'days since 0001-01-01 00:00:00'. + calendar describes the calendar used in the time + calculations. All the values currently defined in + the CF metadata convention + (http://cf-pcmdi.llnl.gov/documents/cf-conventions/) + are supported. + Valid calendars ``standard``, ``gregorian``, + ``proleptic_gregorian``, ``noleap``, ``365_day``, + ``julian``, ``all_leap``, ``366_day``. + Default is ``proleptic_gregorian``. + ============== ==================================================== - units - a string of the form '<time units> since <reference time>' - describing the time units. <time units> can be days, hours, minutes - or seconds. <reference time> is the time origin. - Default is 'days since 0001-01-01 00:00:00'. - - calendar - describes the calendar used in the time calculations. - All the values currently defined in the CF metadata convention - (http://cf-pcmdi.llnl.gov/documents/cf-conventions/) are supported. - Valid calendars 'standard', 'gregorian', 'proleptic_gregorian' - 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'. - Default is 'standard'/'gregorian', which is a mixed - Julian/Gregorian calendar. Default 'proleptic_gregorian'. - Returns a numeric time value, or an array of numeric time values. The maximum resolution of the numeric time values is 1 second. Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py 2008-06-14 16:35:55 UTC (rev 5544) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py 2008-06-14 21:14:34 UTC (rev 5545) @@ -37,12 +37,6 @@ from dap.client import open as open_remote from dap.dtypes import ArrayType, GridType, typemap -has_pynio = True -try: - from PyNGL import nio -except ImportError: - has_pynio = False - ABSENT = '\x00' * 8 ZERO = '\x00' * 4 NC_BYTE = '\x00\x00\x00\x01' @@ -76,37 +70,19 @@ to be a remote OPenDAP dataset, and the python dap client is used to retrieve the data. Only the OPenDAP Array and Grid data types are recognized. If file does not start with 'http', it - is assumed to be a local file. If possible, the file will be read - with a pure python NetCDF reader, otherwise PyNIO - (http://www.pyngl.ucar.edu/Nio.shtml) will be used (if it is installed). - PyNIO supports NetCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS2 files. - Data read from OPenDAP and NetCDF version 3 datasets will + is assumed to be a local netCDF file. Data will automatically be converted to masked arrays if the variable has either a 'missing_value' or '_FillValue' attribute, and some data points are equal to the value specified by that attribute. In addition, variables stored as integers that have the 'scale_factor' and 'add_offset' attribute will automatically be rescaled to floats when - read. If PyNIO is used, neither of the automatic conversions will - be performed. To suppress these automatic conversions, set the + read. To suppress these automatic conversions, set the maskandscale keyword to False. """ if file.startswith('http'): return _RemoteFile(file,maskandscale) else: - # use pynio if it is installed and the file cannot - # be read with the pure python netCDF reader. This allows - # netCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS files - # to be read. - if has_pynio: - try: - f = _LocalFile(file,maskandscale) - except: - f = nio.open_file(file) - # otherwise, use the pupynere netCDF 3 pure python reader. - # (will fail if file is not a netCDF version 3 file). - else: - f = _LocalFile(file,maskandscale) - return f + return _LocalFile(file,maskandscale) def _maskandscale(var,datout): totalmask = zeros(datout.shape,numpy.bool) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-07-11 15:39:10
|
Revision: 5741 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5741&view=rev Author: jswhit Date: 2008-07-11 08:39:08 -0700 (Fri, 11 Jul 2008) Log Message: ----------- added tissot method. Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/examples/plot_tissot.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-07-11 15:05:09 UTC (rev 5740) +++ trunk/toolkits/basemap/Changelog 2008-07-11 15:39:08 UTC (rev 5741) @@ -1,3 +1,5 @@ + * added "tissot" method for generating Tissot's indicatrix + (see example plot_tissot.py). * fixed processing of coastlines for gnomonic projection. * don't try to use PyNIO in NetCDFFile (it was causing too many suprises). Modified: trunk/toolkits/basemap/examples/plot_tissot.py =================================================================== --- trunk/toolkits/basemap/examples/plot_tissot.py 2008-07-11 15:05:09 UTC (rev 5740) +++ trunk/toolkits/basemap/examples/plot_tissot.py 2008-07-11 15:39:08 UTC (rev 5741) @@ -12,43 +12,14 @@ # Tissot's indicatrix have all unit area, although their shapes and # orientations vary with location. -class Basemap2(Basemap): - def tissot(self,lon_0,lat_0,radius_deg,npts): - # create list of npts lon,lat pairs that are equidistant on the - # surface of the earth from central point lon_0,lat_0 - # and has radius along lon_0 of radius_deg degrees of latitude. - # points are transformed to map projection coordinates. - # The ellipse that list of points represents is a - # Tissot's indicatrix - # (http://en.wikipedia.org/wiki/Tissot%27s_Indicatrix), - # which when drawn on a map shows the distortion - # inherent in the map projection. - g = pyproj.Geod(a=self.rmajor,b=self.rminor) - az12,az21,dist = g.inv(lon_0,lat_0,lon_0,lat_0+radius_deg) - seg = [self(lon_0,lat_0+radius_deg)] - delaz = 360./npts - az = az12 - for n in range(npts): - az = az+delaz - # skip segments along equator (Geod can't handel equatorial arcs) - if np.allclose(0.,lat_0) and (np.allclose(90.,az) or np.allclose(270.,az)): - continue - else: - lon, lat, az21 = g.fwd(lon_0, lat_0, az, dist) - x,y = self(lon,lat) - # add segment if it is in the map projection region. - if x < 1.e20 and y < 1.e20: - seg.append((x,y)) - return seg - # create Basemap instances with several different projections -m1 = Basemap2(llcrnrlon=-180,llcrnrlat=-80,urcrnrlon=180,urcrnrlat=80, +m1 = Basemap(llcrnrlon=-180,llcrnrlat=-80,urcrnrlon=180,urcrnrlat=80, projection='cyl') -m2 = Basemap2(lon_0=-60,lat_0=45,projection='ortho') -m3 = Basemap2(llcrnrlon=-180,llcrnrlat=-70,urcrnrlon=180,urcrnrlat=70, +m2 = Basemap(lon_0=-60,lat_0=45,projection='ortho') +m3 = Basemap(llcrnrlon=-180,llcrnrlat=-70,urcrnrlon=180,urcrnrlat=70, projection='merc',lat_ts=20,rsphere=(6378137.0,6356752.3142)) -m4 = Basemap2(lon_0=270,lat_0=90,boundinglat=10,projection='npstere') -m5 = Basemap2(lon_0=270,lat_0=90,boundinglat=10,projection='nplaea') +m4 = Basemap(lon_0=270,lat_0=90,boundinglat=10,projection='npstere') +m5 = Basemap(lon_0=270,lat_0=90,boundinglat=10,projection='nplaea') for m in [m1,m2,m3,m4,m5]: # make a new figure. Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-11 15:05:09 UTC (rev 5740) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-11 15:39:08 UTC (rev 5741) @@ -2146,6 +2146,34 @@ if v == ([], []): del linecolls[k] return linecolls + def tissot(self,lon_0,lat_0,radius_deg,npts): + """ + create list of ``npts`` x,y pairs that are equidistant on the + surface of the earth from central point ``lon_0,lat_0`` and form + an ellipse with radius of ``radius_deg`` degrees of latitude along + longitude ``lon_0``. + The ellipse represents a Tissot's indicatrix + (http://en.wikipedia.org/wiki/Tissot%27s_Indicatrix), + which when drawn on a map shows the distortion + inherent in the map projection.""" + g = pyproj.Geod(a=self.rmajor,b=self.rminor) + az12,az21,dist = g.inv(lon_0,lat_0,lon_0,lat_0+radius_deg) + seg = [self(lon_0,lat_0+radius_deg)] + delaz = 360./npts + az = az12 + for n in range(npts): + az = az+delaz + # skip segments along equator (Geod can't handel equatorial arcs) + if np.allclose(0.,lat_0) and (np.allclose(90.,az) or np.allclose(270.,az)): + continue + else: + lon, lat, az21 = g.fwd(lon_0, lat_0, az, dist) + x,y = self(lon,lat) + # add segment if it is in the map projection region. + if x < 1.e20 and y < 1.e20: + seg.append((x,y)) + return seg + def gcpoints(self,lon1,lat1,lon2,lat2,npoints): """ compute ``points`` points along a great circle with endpoints This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-07-11 15:48:14
|
Revision: 5744 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5744&view=rev Author: jswhit Date: 2008-07-11 08:48:04 -0700 (Fri, 11 Jul 2008) Log Message: ----------- up version number to 0.99.1 Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py trunk/toolkits/basemap/setup.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-07-11 15:45:55 UTC (rev 5743) +++ trunk/toolkits/basemap/Changelog 2008-07-11 15:48:04 UTC (rev 5744) @@ -1,3 +1,4 @@ +version 0.99.1 (not yet released) * added "tissot" method for generating Tissot's indicatrix (see example plot_tissot.py). * fixed processing of coastlines for gnomonic projection. Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-11 15:45:55 UTC (rev 5743) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-11 15:48:04 UTC (rev 5744) @@ -41,7 +41,7 @@ # basemap data files now installed in lib/matplotlib/toolkits/basemap/data basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data']) -__version__ = '0.99' +__version__ = '0.99.1' # supported map projections. _projnames = {'cyl' : 'Cylindrical Equidistant', Modified: trunk/toolkits/basemap/setup.py =================================================================== --- trunk/toolkits/basemap/setup.py 2008-07-11 15:45:55 UTC (rev 5743) +++ trunk/toolkits/basemap/setup.py 2008-07-11 15:48:04 UTC (rev 5744) @@ -189,7 +189,7 @@ package_data = {'mpl_toolkits.basemap':pyproj_datafiles+basemap_datafiles} setup( name = "basemap", - version = "0.99", + version = "0.99.1", description = "Plot data on map projections with matplotlib", long_description = """ An add-on toolkit for matplotlib that lets you plot data This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2008-07-13 20:29:58
|
Revision: 5763 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5763&view=rev Author: jswhit Date: 2008-07-13 13:29:55 -0700 (Sun, 13 Jul 2008) Log Message: ----------- have tissot method do actual drawing. Modified Paths: -------------- trunk/toolkits/basemap/examples/plot_tissot.py trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/examples/plot_tissot.py =================================================================== --- trunk/toolkits/basemap/examples/plot_tissot.py 2008-07-13 13:27:33 UTC (rev 5762) +++ trunk/toolkits/basemap/examples/plot_tissot.py 2008-07-13 20:29:55 UTC (rev 5763) @@ -2,7 +2,6 @@ import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap from mpl_toolkits.basemap import __version__ as basemap_version -from matplotlib.patches import Polygon # Tissot's Indicatrix (http://en.wikipedia.org/wiki/Tissot's_Indicatrix). # These diagrams illustrate the distortion inherent in all map projections. @@ -29,13 +28,10 @@ for m in [m1,m2,m3,m4,m5]: # make a new figure. fig = plt.figure() - ax = plt.gca() # draw "circles" at specified longitudes and latitudes. for parallel in range(-60,61,30): for meridian in range(-165,166,30): - seg = m.tissot(meridian,parallel,6,100) - poly = Polygon(seg,facecolor='green',zorder=10,alpha=0.5) - ax.add_patch(poly) + poly = m.tissot(meridian,parallel,6,100,facecolor='green',zorder=10,alpha=0.5) # draw meridians and parallels. m.drawparallels(np.arange(-60,61,30)) m.drawmeridians(np.arange(-180,180,60)) Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-13 13:27:33 UTC (rev 5762) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-13 20:29:55 UTC (rev 5763) @@ -2146,16 +2146,30 @@ if v == ([], []): del linecolls[k] return linecolls - def tissot(self,lon_0,lat_0,radius_deg,npts): + def tissot(self,lon_0,lat_0,radius_deg,npts,ax=None,**kwargs): """ - create list of ``npts`` x,y pairs that are equidistant on the - surface of the earth from central point ``lon_0,lat_0`` and form - an ellipse with radius of ``radius_deg`` degrees of latitude along - longitude ``lon_0``. - The ellipse represents a Tissot's indicatrix + Draw a polygon centered at ``lon_0,lat_0``. The polygon + approximates a circle on the surface of the earth with radius + ``radius_deg`` degrees latitude along longitude ``lon_0``, + made up of ``npts`` vertices. + The polygon represents a Tissot's indicatrix (http://en.wikipedia.org/wiki/Tissot's_Indicatrix), which when drawn on a map shows the distortion - inherent in the map projection.""" + inherent in the map projection. + + Extra keyword ``ax`` can be used to override the default axis instance. + + Other \**kwargs passed on to matplotlib.patches.Polygon.""" + if not kwargs.has_key('ax') and self.ax is None: + try: + ax = plt.gca() + except: + import matplotlib.pyplot as plt + ax = plt.gca() + elif not kwargs.has_key('ax') and self.ax is not None: + ax = self.ax + else: + ax = kwargs.pop('ax') g = pyproj.Geod(a=self.rmajor,b=self.rminor) az12,az21,dist = g.inv(lon_0,lat_0,lon_0,lat_0+radius_deg) seg = [self(lon_0,lat_0+radius_deg)] @@ -2172,7 +2186,11 @@ # add segment if it is in the map projection region. if x < 1.e20 and y < 1.e20: seg.append((x,y)) - return seg + poly = Polygon(seg,**kwargs) + ax.add_patch(poly) + # set axes limits to fit map region. + self.set_axes_limits(ax=ax) + return poly def gcpoints(self,lon1,lat1,lon2,lat2,npoints): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |