You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
| 2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
| 2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
| 2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <md...@us...> - 2008-05-21 13:06:54
|
Revision: 5211
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5211&view=rev
Author: mdboom
Date: 2008-05-21 06:06:51 -0700 (Wed, 21 May 2008)
Log Message:
-----------
Backport TkAgg segfault fix.
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/src/_tkagg.cpp
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-05-21 13:03:36 UTC (rev 5210)
+++ branches/v0_91_maint/CHANGELOG 2008-05-21 13:06:51 UTC (rev 5211)
@@ -1,3 +1,5 @@
+2008-05-21 Fix segfault in TkAgg backend - MGD
+
2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM
2008-05-19 Fix crash when Windows can not access the registry to
Modified: branches/v0_91_maint/src/_tkagg.cpp
===================================================================
--- branches/v0_91_maint/src/_tkagg.cpp 2008-05-21 13:03:36 UTC (rev 5210)
+++ branches/v0_91_maint/src/_tkagg.cpp 2008-05-21 13:06:51 UTC (rev 5211)
@@ -50,6 +50,7 @@
agg::int8u *destbuffer;
double l,b,r,t;
int destx, desty, destwidth, destheight, deststride;
+ unsigned long aggl, bboxl;
long mode;
long nval;
@@ -71,7 +72,11 @@
return TCL_ERROR;
}
/* get array (or object that can be converted to array) pointer */
- aggo = (PyObject*)atol(argv[2]);
+ if (sscanf (argv[2],"%lu",&aggl) != 1) {
+ Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
+ return TCL_ERROR;
+ }
+ aggo = (PyObject*)aggl;
RendererAgg *aggRenderer = (RendererAgg *)aggo;
int srcheight = (int)aggRenderer->get_height();
@@ -85,7 +90,11 @@
}
/* check for bbox/blitting */
- bboxo = (PyObject*)atol(argv[4]);
+ if (sscanf(argv[4], "%lu", &bboxl) != 1) {
+ Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
+ return TCL_ERROR;
+ }
+ bboxo = (PyObject*)bboxl;
if (bboxo != Py_None) {
bbox = (Bbox*)bboxo;
l = bbox->ll_api()->x_api()->val();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-21 13:03:41
|
Revision: 5210
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5210&view=rev
Author: mdboom
Date: 2008-05-21 06:03:36 -0700 (Wed, 21 May 2008)
Log Message:
-----------
Be a little more pedantic about sscanf usage and check the return value.
Modified Paths:
--------------
trunk/matplotlib/src/_tkagg.cpp
Modified: trunk/matplotlib/src/_tkagg.cpp
===================================================================
--- trunk/matplotlib/src/_tkagg.cpp 2008-05-21 12:10:35 UTC (rev 5209)
+++ trunk/matplotlib/src/_tkagg.cpp 2008-05-21 13:03:36 UTC (rev 5210)
@@ -76,7 +76,10 @@
return TCL_ERROR;
}
/* get array (or object that can be converted to array) pointer */
- sscanf (argv[2],"%lu",&aggl);
+ if (sscanf (argv[2],"%lu",&aggl) != 1) {
+ Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
+ return TCL_ERROR;
+ }
aggo = (PyObject*)aggl;
//aggo = (PyObject*)atol(argv[2]);
@@ -97,7 +100,10 @@
}
/* check for bbox/blitting */
- sscanf (argv[4],"%lu",&bboxl);
+ if (sscanf (argv[4],"%lu",&bboxl) != 1) {
+ Tcl_AppendResult(interp, "error casting pointer", (char *) NULL);
+ return TCL_ERROR;
+ }
bboxo = (PyObject*)bboxl;
//bboxo = (PyObject*)atol(argv[4]);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-21 12:10:42
|
Revision: 5209
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5209&view=rev
Author: jswhit
Date: 2008-05-21 05:10:35 -0700 (Wed, 21 May 2008)
Log Message:
-----------
update pre-requisites
Modified Paths:
--------------
trunk/toolkits/basemap/README
Modified: trunk/toolkits/basemap/README
===================================================================
--- trunk/toolkits/basemap/README 2008-05-21 09:50:36 UTC (rev 5208)
+++ trunk/toolkits/basemap/README 2008-05-21 12:10:35 UTC (rev 5209)
@@ -5,11 +5,11 @@
**Requirements**
-python 2.3 (or higher)
+python 2.4 (or higher)
matplotlib 0.98 (or higher)
-numpy 1.0 (or higher)
+numpy 1.1 (or higher)
The GEOS (Geometry Engine - Open Source) library (version 2.2.3).
Source code is included in the geos-2.2.3 directory.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mme...@us...> - 2008-05-21 09:50:39
|
Revision: 5208
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5208&view=rev
Author: mmetz_bn
Date: 2008-05-21 02:50:36 -0700 (Wed, 21 May 2008)
Log Message:
-----------
Merged revisions 5206-5207 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r5207 | mmetz_bn | 2008-05-21 11:47:59 +0200 (Wed, 21 May 2008) | 1 line
Fixed bug in plotfile
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/pyplot.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5205
+ /branches/v0_91_maint:1-5207
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-21 09:47:59 UTC (rev 5207)
+++ trunk/matplotlib/CHANGELOG 2008-05-21 09:50:36 UTC (rev 5208)
@@ -1,3 +1,5 @@
+2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM
+
2008-05-19 Fix crash when Windows can not access the registry to
determine font path [Bug 1966974, thanks Patrik Simons] - MGD
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py 2008-05-21 09:47:59 UTC (rev 5207)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008-05-21 09:50:36 UTC (rev 5208)
@@ -40,7 +40,7 @@
def switch_backend(newbackend):
"""
- Swtich the default backend to newbackend. This feature is
+ Switch the default backend to newbackend. This feature is
EXPERIMENTAL, and is only expected to work switching to an image
backend. Eg, if you have a bunch of PS scripts that you want to
run from an interactive ipython session, you may want to switch to
@@ -1282,7 +1282,7 @@
xname, x = getname_val(cols[0])
if len(cols)==1:
- ax1 = fig.add_subplot(N,1,i)
+ ax1 = fig.add_subplot(1,1,1)
funcname = plotfuncs.get(cols[0], 'plot')
func = getattr(ax1, funcname)
func(x, **kwargs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mme...@us...> - 2008-05-21 09:48:04
|
Revision: 5207
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5207&view=rev
Author: mmetz_bn
Date: 2008-05-21 02:47:59 -0700 (Wed, 21 May 2008)
Log Message:
-----------
Fixed bug in plotfile
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/pyplot.py
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-05-20 21:05:49 UTC (rev 5206)
+++ branches/v0_91_maint/CHANGELOG 2008-05-21 09:47:59 UTC (rev 5207)
@@ -1,3 +1,5 @@
+2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM
+
2008-05-19 Fix crash when Windows can not access the registry to
determine font path [Bug 1966974, thanks Patrik Simons] - MGD
Modified: branches/v0_91_maint/lib/matplotlib/pyplot.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/pyplot.py 2008-05-20 21:05:49 UTC (rev 5206)
+++ branches/v0_91_maint/lib/matplotlib/pyplot.py 2008-05-21 09:47:59 UTC (rev 5207)
@@ -38,7 +38,7 @@
def switch_backend(newbackend):
"""
- Swtich the default backend to newbackend. This feature is
+ Switch the default backend to newbackend. This feature is
EXPERIMENTAL, and is only expected to work switching to an image
backend. Eg, if you have a bunch of PS scripts that you want to
run from an interactive ipython session, you may want to switch to
@@ -1225,7 +1225,7 @@
xname, x = getname_val(cols[0])
if len(cols)==1:
- ax1 = fig.add_subplot(N,1,i)
+ ax1 = fig.add_subplot(1,1,1)
funcname = plotfuncs.get(cols[0], 'plot')
func = getattr(ax1, funcname)
func(x, **kwargs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-20 21:05:56
|
Revision: 5206
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5206&view=rev
Author: jdh2358
Date: 2008-05-20 14:05:49 -0700 (Tue, 20 May 2008)
Log Message:
-----------
Merged revisions 5205 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r5205 | jdh2358 | 2008-05-20 16:02:08 -0500 (Tue, 20 May 2008) | 1 line
remove pesky date auto xlabel
........
Modified Paths:
--------------
trunk/matplotlib/CODING_GUIDE
trunk/matplotlib/lib/matplotlib/dates.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5193
+ /branches/v0_91_maint:1-5205
Modified: trunk/matplotlib/CODING_GUIDE
===================================================================
--- trunk/matplotlib/CODING_GUIDE 2008-05-20 21:02:08 UTC (rev 5205)
+++ trunk/matplotlib/CODING_GUIDE 2008-05-20 21:05:49 UTC (rev 5206)
@@ -46,7 +46,8 @@
keep them in sync. http://www.orcaware.com/svn/wiki/Svnmerge.py. The
basic procedure is:
- - install svnmerge.py in your PATH
+ - install svnmerge.py in your PATH:
+ wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/svnmerge/svnmerge.py
- get a svn copy of the branch (svn co
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint)
Modified: trunk/matplotlib/lib/matplotlib/dates.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/dates.py 2008-05-20 21:02:08 UTC (rev 5205)
+++ trunk/matplotlib/lib/matplotlib/dates.py 2008-05-20 21:05:49 UTC (rev 5206)
@@ -997,7 +997,7 @@
return units.AxisInfo(
majloc = majloc,
majfmt = majfmt,
- label='date',
+ label='',
)
else: return None
axisinfo = staticmethod(axisinfo)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-20 21:02:18
|
Revision: 5205
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5205&view=rev
Author: jdh2358
Date: 2008-05-20 14:02:08 -0700 (Tue, 20 May 2008)
Log Message:
-----------
remove pesky date auto xlabel
Modified Paths:
--------------
branches/v0_91_maint/CODING_GUIDE
branches/v0_91_maint/lib/matplotlib/dates.py
Modified: branches/v0_91_maint/CODING_GUIDE
===================================================================
--- branches/v0_91_maint/CODING_GUIDE 2008-05-20 16:00:21 UTC (rev 5204)
+++ branches/v0_91_maint/CODING_GUIDE 2008-05-20 21:02:08 UTC (rev 5205)
@@ -46,7 +46,8 @@
keep them in sync. http://www.orcaware.com/svn/wiki/Svnmerge.py. The
basic procedure is:
- - install svnmerge.py in your PATH
+ - install svnmerge.py in your PATH:
+ wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/svnmerge/svnmerge.py
- get a svn copy of the branch (svn co
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint)
Modified: branches/v0_91_maint/lib/matplotlib/dates.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/dates.py 2008-05-20 16:00:21 UTC (rev 5204)
+++ branches/v0_91_maint/lib/matplotlib/dates.py 2008-05-20 21:02:08 UTC (rev 5205)
@@ -1003,7 +1003,7 @@
return units.AxisInfo(
majloc = majloc,
majfmt = majfmt,
- label='date',
+ label='',
)
else: return None
axisinfo = staticmethod(axisinfo)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-20 16:01:49
|
Revision: 5204
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5204&view=rev
Author: jswhit
Date: 2008-05-20 09:00:21 -0700 (Tue, 20 May 2008)
Log Message:
-----------
don't need to import numpy
Modified Paths:
--------------
trunk/toolkits/basemap/src/_proj.c
trunk/toolkits/basemap/src/_proj.pyx
Modified: trunk/toolkits/basemap/src/_proj.c
===================================================================
--- trunk/toolkits/basemap/src/_proj.c 2008-05-20 15:57:58 UTC (rev 5203)
+++ trunk/toolkits/basemap/src/_proj.c 2008-05-20 16:00:21 UTC (rev 5204)
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.9.6.14 on Tue May 20 09:53:32 2008 */
+/* Generated by Cython 0.9.6.14 on Tue May 20 09:59:26 2008 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -134,7 +134,7 @@
/* Declarations */
-/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":13
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":12
* pj_set_searchpath(1, &searchpath)
*
* cdef class Proj: # <<<<<<<<<<<<<<
@@ -180,11 +180,10 @@
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":8
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":7
* c_numpy.import_array()
*
* def set_datapath(datapath): # <<<<<<<<<<<<<<
@@ -197,7 +196,7 @@
char *__pyx_v_searchpath;
PyObject *__pyx_r;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":10
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":9
* def set_datapath(datapath):
* cdef char *searchpath
* searchpath = PyString_AsString(datapath) # <<<<<<<<<<<<<<
@@ -206,7 +205,7 @@
*/
__pyx_v_searchpath = PyString_AsString(__pyx_v_datapath);
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":11
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":10
* cdef char *searchpath
* searchpath = PyString_AsString(datapath)
* pj_set_searchpath(1, &searchpath) # <<<<<<<<<<<<<<
@@ -219,7 +218,7 @@
return __pyx_r;
}
-/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":20
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":19
* cdef public object srs
*
* def __new__(self, projparams): # <<<<<<<<<<<<<<
@@ -232,17 +231,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_4[] = "+";
-static char __pyx_k_5[] = "=";
-static char __pyx_k_6[] = " ";
-static char __pyx_k_7[] = "";
+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) {
@@ -262,7 +261,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 = 20; __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 = 19; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
@@ -273,7 +272,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":21
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":20
*
* def __new__(self, projparams):
* self.projparams = projparams # <<<<<<<<<<<<<<
@@ -284,30 +283,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":23
+ /* "/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 = 23; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __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":24
+ /* "/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 = 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;}
+ __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 = 24; __pyx_clineno = __LINE__; goto __pyx_L1;} }
+ 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); }
@@ -332,65 +331,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 = 24; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __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 = 24; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __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 = 24; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __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 = 24; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ 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":25
+ /* "/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.pjinitstring = PyString_AsString(self.srs)
*/
- __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;}
+ __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 = 25; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __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 = 25; __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 = 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 = 25; __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 = 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_6p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __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 = 25; __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 = 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":26
+ /* "/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_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;}
+ __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 = 26; __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 = 25; __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":27
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":26
* pjargs.append('+'+key+"="+str(value)+' ')
* self.srs = ''.join(pjargs)
* self.pjinitstring = PyString_AsString(self.srs) # <<<<<<<<<<<<<<
@@ -399,7 +398,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":29
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":28
* self.pjinitstring = PyString_AsString(self.srs)
* # initialize projection
* self.projpj = pj_init_plus(self.pjinitstring) # <<<<<<<<<<<<<<
@@ -408,7 +407,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":30
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":29
* # initialize projection
* self.projpj = pj_init_plus(self.pjinitstring)
* if pj_errno != 0: # <<<<<<<<<<<<<<
@@ -418,34 +417,34 @@
__pyx_6 = (pj_errno != 0);
if (__pyx_6) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":31
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":30
* 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 = 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;}
+ __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 = 31; __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 = 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 = 31; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L6;
}
__pyx_L6:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":32
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":31
* 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 = 32; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __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;}
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;
@@ -466,7 +465,7 @@
return __pyx_r;
}
-/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":34
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":33
* self.proj_version = PJ_VERSION/100.
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -478,7 +477,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":36
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":35
* def __dealloc__(self):
* """destroy projection definition"""
* pj_free(self.projpj) # <<<<<<<<<<<<<<
@@ -489,7 +488,7 @@
}
-/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":38
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":37
* pj_free(self.projpj)
*
* def __reduce__(self): # <<<<<<<<<<<<<<
@@ -507,18 +506,18 @@
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":40
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":39
* 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 = 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;}
+ __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 = 40; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __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;
@@ -539,7 +538,7 @@
return __pyx_r;
}
-/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":42
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":41
* return (self.__class__,(self.projparams,))
*
* def _fwd(self, object lons, object lats, radians=False, errcheck=False): # <<<<<<<<<<<<<<
@@ -547,9 +546,9 @@
* forward transformation - lons,lats to x,y (done in place).
*/
-static PyObject *__pyx_k_8p;
+static PyObject *__pyx_k_7p;
-static char __pyx_k_8[] = "Buffer lengths not the same";
+static char __pyx_k_7[] = "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 ";
@@ -589,7 +588,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 = 42; __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 = 41; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
@@ -597,7 +596,7 @@
return NULL;
__pyx_L3:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":56
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":55
* cdef void *londata, *latdata
* # if buffer api is supported, get pointer to data buffers.
* if PyObject_AsWriteBuffer(lons, &londata, &buflenx) <> 0: # <<<<<<<<<<<<<<
@@ -607,7 +606,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":57
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":56
* # if buffer api is supported, get pointer to data buffers.
* if PyObject_AsWriteBuffer(lons, &londata, &buflenx) <> 0:
* raise RuntimeError # <<<<<<<<<<<<<<
@@ -615,12 +614,12 @@
* raise RuntimeError
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L4;
}
__pyx_L4:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":58
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":57
* if PyObject_AsWriteBuffer(lons, &londata, &buflenx) <> 0:
* raise RuntimeError
* if PyObject_AsWriteBuffer(lats, &latdata, &bufleny) <> 0: # <<<<<<<<<<<<<<
@@ -630,7 +629,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":59
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":58
* raise RuntimeError
* if PyObject_AsWriteBuffer(lats, &latdata, &bufleny) <> 0:
* raise RuntimeError # <<<<<<<<<<<<<<
@@ -638,12 +637,12 @@
* if buflenx != bufleny:
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L5;
}
__pyx_L5:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":61
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":60
* raise RuntimeError
* # process data in buffer
* if buflenx != bufleny: # <<<<<<<<<<<<<<
@@ -653,42 +652,42 @@
__pyx_1 = (__pyx_v_buflenx != __pyx_v_bufleny);
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":62
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":61
* # 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 = 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;}
+ __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;}
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 = 62; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L6;
}
__pyx_L6:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":63
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":62
* 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 = 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;}
+ __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;}
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 = 63; __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 = 62; __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":64
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":63
* raise RuntimeError("Buffer lengths not the same")
* ndim = buflenx/_doublesize
* lonsdata = <double *>londata # <<<<<<<<<<<<<<
@@ -697,7 +696,7 @@
*/
__pyx_v_lonsdata = ((double *)__pyx_v_londata);
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":65
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":64
* ndim = buflenx/_doublesize
* lonsdata = <double *>londata
* latsdata = <double *>latdata # <<<<<<<<<<<<<<
@@ -706,7 +705,7 @@
*/
__pyx_v_latsdata = ((double *)__pyx_v_latdata);
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":66
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":65
* lonsdata = <double *>londata
* latsdata = <double *>latdata
* for i from 0 <= i < ndim: # <<<<<<<<<<<<<<
@@ -715,17 +714,17 @@
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":67
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":66
* 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 = 67; __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":68
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":67
* for i from 0 <= i < ndim:
* if radians:
* projlonlatin.u = lonsdata[i] # <<<<<<<<<<<<<<
@@ -734,7 +733,7 @@
*/
__pyx_v_projlonlatin.u = (__pyx_v_lonsdata[__pyx_v_i]);
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":69
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":68
* if radians:
* projlonlatin.u = lonsdata[i]
* projlonlatin.v = latsdata[i] # <<<<<<<<<<<<<<
@@ -746,41 +745,41 @@
}
/*else*/ {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":71
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":70
* 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 = 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;}
+ __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;}
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 = 70; __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":72
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":71
* 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 = 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;}
+ __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;}
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 = 72; __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.v = __pyx_6;
}
__pyx_L9:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":73
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":72
* projlonlatin.u = _dg2rad*lonsdata[i]
* projlonlatin.v = _dg2rad*latsdata[i]
* projxyout = pj_fwd(projlonlatin,self.projpj) # <<<<<<<<<<<<<<
@@ -789,7 +788,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":74
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":73
* projlonlatin.v = _dg2rad*latsdata[i]
* projxyout = pj_fwd(projlonlatin,self.projpj)
* if errcheck and pj_errno != 0: # <<<<<<<<<<<<<<
@@ -798,36 +797,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 = 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 = 73; __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 = 74; __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 = 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 = 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 = 73; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":75
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":74
* 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 = 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;}
+ __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;}
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 = 75; __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 = 74; __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L10;
}
__pyx_L10:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":78
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":77
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
* if projxyout.u == HUGE_VAL: # <<<<<<<<<<<<<<
@@ -837,7 +836,7 @@
__pyx_1 = (__pyx_v_projxyout.u == HUGE_VAL);
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":79
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":78
* # change it to a real (but very large) number.
* if projxyout.u == HUGE_VAL:
* lonsdata[i] = 1.e30 # <<<<<<<<<<<<<<
@@ -849,7 +848,7 @@
}
/*else*/ {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":81
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":80
* lonsdata[i] = 1.e30
* else:
* lonsdata[i] = projxyout.u # <<<<<<<<<<<<<<
@@ -860,7 +859,7 @@
}
__pyx_L11:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":82
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":81
* else:
* lonsdata[i] = projxyout.u
* if projxyout.v == HUGE_VAL: # <<<<<<<<<<<<<<
@@ -870,7 +869,7 @@
__pyx_1 = (__pyx_v_projxyout.v == HUGE_VAL);
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":83
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":82
* lonsdata[i] = projxyout.u
* if projxyout.v == HUGE_VAL:
* latsdata[i] = 1.e30 # <<<<<<<<<<<<<<
@@ -882,7 +881,7 @@
}
/*else*/ {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":85
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":84
* latsdata[i] = 1.e30
* else:
* latsdata[i] = projxyout.v # <<<<<<<<<<<<<<
@@ -906,7 +905,7 @@
return __pyx_r;
}
-/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":87
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":86
* latsdata[i] = projxyout.v
*
* def _inv(self, object x, object y, radians=False, errcheck=False): # <<<<<<<<<<<<<<
@@ -914,9 +913,9 @@
* inverse transformation - x,y to lons,lats (done in place).
*/
-static PyObject *__pyx_k_9p;
+static PyObject *__pyx_k_8p;
-static char __pyx_k_9[] = "Buffer lengths not the same";
+static char __pyx_k_8[] = "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 ";
@@ -956,7 +955,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 = 87; __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L2;}
}
goto __pyx_L3;
__pyx_L2:;
@@ -964,7 +963,7 @@
return NULL;
__pyx_L3:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":101
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":100
* cdef double *xdatab, *ydatab
* # if buffer api is supported, get pointer to data buffers.
* if PyObject_AsWriteBuffer(x, &xdata, &buflenx) <> 0: # <<<<<<<<<<<<<<
@@ -974,7 +973,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":102
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":101
* # if buffer api is supported, get pointer to data buffers.
* if PyObject_AsWriteBuffer(x, &xdata, &buflenx) <> 0:
* raise RuntimeError # <<<<<<<<<<<<<<
@@ -982,12 +981,12 @@
* raise RuntimeError
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L4;
}
__pyx_L4:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":103
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":102
* if PyObject_AsWriteBuffer(x, &xdata, &buflenx) <> 0:
* raise RuntimeError
* if PyObject_AsWriteBuffer(y, &ydata, &bufleny) <> 0: # <<<<<<<<<<<<<<
@@ -997,7 +996,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":104
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":103
* raise RuntimeError
* if PyObject_AsWriteBuffer(y, &ydata, &bufleny) <> 0:
* raise RuntimeError # <<<<<<<<<<<<<<
@@ -1005,12 +1004,12 @@
* # (for numpy/regular python arrays).
*/
__Pyx_Raise(__pyx_builtin_RuntimeError, 0, 0);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L5;
}
__pyx_L5:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":107
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":106
* # process data in buffer
* # (for numpy/regular python arrays).
* if buflenx != bufleny: # <<<<<<<<<<<<<<
@@ -1020,42 +1019,42 @@
__pyx_1 = (__pyx_v_buflenx != __pyx_v_bufleny);
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":108
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":107
* # (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 = 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;}
+ __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;}
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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L6;
}
__pyx_L6:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":109
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":108
* 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 = 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;}
+ __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;}
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 = 109; __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 = 108; __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":110
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":109
* raise RuntimeError("Buffer lengths not the same")
* ndim = buflenx/_doublesize
* xdatab = <double *>xdata # <<<<<<<<<<<<<<
@@ -1064,7 +1063,7 @@
*/
__pyx_v_xdatab = ((double *)__pyx_v_xdata);
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":111
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":110
* ndim = buflenx/_doublesize
* xdatab = <double *>xdata
* ydatab = <double *>ydata # <<<<<<<<<<<<<<
@@ -1073,7 +1072,7 @@
*/
__pyx_v_ydatab = ((double *)__pyx_v_ydata);
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":112
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":111
* xdatab = <double *>xdata
* ydatab = <double *>ydata
* for i from 0 <= i < ndim: # <<<<<<<<<<<<<<
@@ -1082,7 +1081,7 @@
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":113
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":112
* ydatab = <double *>ydata
* for i from 0 <= i < ndim:
* projxyin.u = xdatab[i] # <<<<<<<<<<<<<<
@@ -1091,7 +1090,7 @@
*/
__pyx_v_projxyin.u = (__pyx_v_xdatab[__pyx_v_i]);
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":114
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":113
* for i from 0 <= i < ndim:
* projxyin.u = xdatab[i]
* projxyin.v = ydatab[i] # <<<<<<<<<<<<<<
@@ -1100,7 +1099,7 @@
*/
__pyx_v_projxyin.v = (__pyx_v_ydatab[__pyx_v_i]);
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":115
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":114
* projxyin.u = xdatab[i]
* projxyin.v = ydatab[i]
* projlonlatout = pj_inv(projxyin,self.projpj) # <<<<<<<<<<<<<<
@@ -1109,7 +1108,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":116
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":115
* projxyin.v = ydatab[i]
* projlonlatout = pj_inv(projxyin,self.projpj)
* if errcheck and pj_errno != 0: # <<<<<<<<<<<<<<
@@ -1118,36 +1117,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 = 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 = 115; __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 = 116; __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 = 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 = 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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":117
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":116
* 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 = 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;}
+ __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;}
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 = 117; __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 = 116; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
goto __pyx_L9;
}
__pyx_L9:;
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":120
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":119
* # since HUGE_VAL can be 'inf',
* # change it to a real (but very large) number.
* if projlonlatout.u == HUGE_VAL: # <<<<<<<<<<<<<<
@@ -1157,7 +1156,7 @@
__pyx_1 = (__pyx_v_projlonlatout.u == HUGE_VAL);
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":121
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":120
* # change it to a real (but very large) number.
* if projlonlatout.u == HUGE_VAL:
* xdatab[i] = 1.e30 # <<<<<<<<<<<<<<
@@ -1168,17 +1167,17 @@
goto __pyx_L10;
}
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":122
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":121
* 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 = 122; __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 = 121; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":123
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":122
* xdatab[i] = 1.e30
* elif radians:
* xdatab[i] = projlonlatout.u # <<<<<<<<<<<<<<
@@ -1190,25 +1189,25 @@
}
/*else*/ {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":125
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":124
* 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 = 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;}
+ __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;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
Py_DECREF(__pyx_4); __pyx_4 = 0;
- __pyx_6 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_6 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __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":126
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":125
* else:
* xdatab[i] = _rad2dg*projlonlatout.u
* if projlonlatout.v == HUGE_VAL: # <<<<<<<<<<<<<<
@@ -1218,7 +1217,7 @@
__pyx_1 = (__pyx_v_projlonlatout.v == HUGE_VAL);
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":127
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":126
* xdatab[i] = _rad2dg*projlonlatout.u
* if projlonlatout.v == HUGE_VAL:
* ydatab[i] = 1.e30 # <<<<<<<<<<<<<<
@@ -1229,17 +1228,17 @@
goto __pyx_L11;
}
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":128
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":127
* if projlonlatout.v == HUGE_VAL:
* ydatab[i] = 1.e30
* elif radians: # <<<<<<<<<<<<<<
* ydatab[i] = projlonlatout.v
* else:
*/
- __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (__pyx_1) {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":129
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":128
* ydatab[i] = 1.e30
* elif radians:
* ydatab[i] = projlonlatout.v # <<<<<<<<<<<<<<
@@ -1251,19 +1250,19 @@
}
/*else*/ {
- /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":131
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_proj.pyx":130
* ydatab[i] = projlonlatout.v
* else:
* ydatab[i] = _rad2dg*projlonlatout.v # <<<<<<<<<<<<<<
*
* def _fwdn(self, c_numpy.ndarray lonlat, radians=False, errcheck=False):...
[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-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:15:44
|
Revision: 5201
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5201&view=rev
Author: jswhit
Date: 2008-05-20 08:14:39 -0700 (Tue, 20 May 2008)
Log Message:
-----------
change variable name
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-05-20 15:08:21 UTC (rev 5200)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-05-20 15:14:39 UTC (rev 5201)
@@ -1193,7 +1193,7 @@
ax = self.ax
# get axis background color.
axisbgc = ax.get_axis_bgcolor()
- npt = 0
+ npoly = 0
for x,y in self.coastpolygons:
xa = np.array(x,np.float32)
ya = np.array(y,np.float32)
@@ -1213,7 +1213,7 @@
hasp3 = np.sum(test1*test4)
if not hasp1 or not hasp2 or not hasp3 or not hasp4:
xy = zip(xa.tolist(),ya.tolist())
- if self.coastpolygontypes[npt] not in [2,4]:
+ if self.coastpolygontypes[npoly] not in [2,4]:
poly = Polygon(xy,facecolor=color,edgecolor=color,linewidth=0)
else: # lakes filled with background color by default
if lake_color is None:
@@ -1223,7 +1223,7 @@
if zorder is not None:
poly.set_zorder(zorder)
ax.add_patch(poly)
- npt = npt + 1
+ npoly = npoly + 1
# set axes limits to fit map region.
self.set_axes_limits(ax=ax)
return poly
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:09:12
|
Revision: 5200
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5200&view=rev
Author: jswhit
Date: 2008-05-20 08:08:21 -0700 (Tue, 20 May 2008)
Log Message:
-----------
fix problems caused by change to "import numpy as np"
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-05-20 15:01:46 UTC (rev 5199)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-05-20 15:08:21 UTC (rev 5200)
@@ -1003,7 +1003,7 @@
yy = np.linspace(self.ymin, self.ymax, ny)[:-1]
x = len(yy)*[self.xmin]; y = yy.tolist()
# top (y = ymax, xmin <= x <= xmax)
- xx = np.np.linspace(self.xmin, self.xmax, nx)[:-1]
+ xx = np.linspace(self.xmin, self.xmax, nx)[:-1]
x = x + xx.tolist()
y = y + len(xx)*[self.ymax]
# right side (x = xmax, ymin <= y <= ymax)
@@ -1193,7 +1193,7 @@
ax = self.ax
# get axis background color.
axisbgc = ax.get_axis_bgcolor()
- np = 0
+ npt = 0
for x,y in self.coastpolygons:
xa = np.array(x,np.float32)
ya = np.array(y,np.float32)
@@ -1213,7 +1213,7 @@
hasp3 = np.sum(test1*test4)
if not hasp1 or not hasp2 or not hasp3 or not hasp4:
xy = zip(xa.tolist(),ya.tolist())
- if self.coastpolygontypes[np] not in [2,4]:
+ if self.coastpolygontypes[npt] not in [2,4]:
poly = Polygon(xy,facecolor=color,edgecolor=color,linewidth=0)
else: # lakes filled with background color by default
if lake_color is None:
@@ -1223,7 +1223,7 @@
if zorder is not None:
poly.set_zorder(zorder)
ax.add_patch(poly)
- np = np + 1
+ npt = npt + 1
# set axes limits to fit map region.
self.set_axes_limits(ax=ax)
return poly
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:02:10
|
Revision: 5199
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5199&view=rev
Author: jswhit
Date: 2008-05-20 08:01:46 -0700 (Tue, 20 May 2008)
Log Message:
-----------
convert to np/plt (from numpy, pylab)
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-05-20 12:24:54 UTC (rev 5198)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-05-20 15:01:46 UTC (rev 5199)
@@ -33,8 +33,8 @@
from matplotlib.transforms import Bbox
import pyproj, sys, os, math, dbflib
from proj import Proj
-import numpy as npy
-from numpy import linspace, squeeze, ma
+import numpy as np
+from numpy import ma
from shapelib import ShapeFile
import _geoslib, pupynere, netcdftime
@@ -504,7 +504,7 @@
self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
# FIXME: won't work for points exactly on equator??
- if npy.abs(lat_0) < 1.e-2: lat_0 = 1.e-2
+ if np.abs(lat_0) < 1.e-2: lat_0 = 1.e-2
projparams['lat_0'] = lat_0
elif projection == 'geos':
if lon_0 is None:
@@ -652,7 +652,7 @@
self.latmin = lats.min()
self.latmax = lats.max()
- # if ax == None, pylab.gca may be used.
+ # if ax == None, pyplot.gca may be used.
self.ax = ax
self.lsmask = None
@@ -685,13 +685,13 @@
for seg in self.coastsegs:
x, y = zip(*seg)
self.coastpolygons.append((x,y))
- x = npy.array(x,npy.float64); y = npy.array(y,npy.float64)
+ x = np.array(x,np.float64); y = np.array(y,np.float64)
xd = (x[1:]-x[0:-1])**2
yd = (y[1:]-y[0:-1])**2
- dist = npy.sqrt(xd+yd)
+ dist = np.sqrt(xd+yd)
split = dist > 5000000.
- if npy.sum(split) and self.projection not in ['merc','cyl','mill']:
- ind = (npy.compress(split,squeeze(split*npy.indices(xd.shape)))+1).tolist()
+ if np.sum(split) and self.projection not in ['merc','cyl','mill']:
+ ind = (np.compress(split,np.squeeze(split*np.indices(xd.shape)))+1).tolist()
iprev = 0
ind.append(len(xd))
for i in ind:
@@ -779,9 +779,9 @@
re = self.projparams['R']
# center of stereographic projection restricted to be
# nearest one of 6 points on the sphere (every 90 deg lat/lon).
- lon0 = 90.*(npy.around(lon_0/90.))
- lat0 = 90.*(npy.around(lat_0/90.))
- if npy.abs(int(lat0)) == 90: lon0=0.
+ lon0 = 90.*(np.around(lon_0/90.))
+ lat0 = 90.*(np.around(lat_0/90.))
+ if np.abs(int(lat0)) == 90: lon0=0.
maptran = pyproj.Proj(proj='stere',lon_0=lon0,lat_0=lat0,R=re)
# boundary polygon for orthographic projection
# in stereographic coorindates.
@@ -806,7 +806,7 @@
# numpy array (first column is lons, second is lats).
polystring = bdatfile.read(bytecount)
# binary data is little endian.
- b = npy.array(npy.fromstring(polystring,dtype='<f4'),'f8')
+ b = np.array(np.fromstring(polystring,dtype='<f4'),'f8')
b.shape = (npts,2)
b2 = b.copy()
# if map boundary polygon is a valid one in lat/lon
@@ -833,7 +833,7 @@
lats.insert(0,-90.)
lons.append(lonend)
lats.append(-90.)
- b = npy.empty((len(lons),2),npy.float64)
+ b = np.empty((len(lons),2),np.float64)
b[:,0] = lons; b[:,1] = lats
poly = _geoslib.Polygon(b)
antart = True
@@ -887,16 +887,16 @@
b[:,0], b[:,1] = maptran(b[:,0], b[:,1])
else:
b[:,0], b[:,1] = self(b[:,0], b[:,1])
- goodmask = npy.logical_and(b[:,0]<1.e20,b[:,1]<1.e20)
+ goodmask = np.logical_and(b[:,0]<1.e20,b[:,1]<1.e20)
# if less than two points are valid in
# map proj coords, skip this geometry.
- if npy.sum(goodmask) <= 1: continue
+ if np.sum(goodmask) <= 1: continue
if name != 'gshhs':
# if not a polygon,
# just remove parts of geometry that are undefined
# in this map projection.
- bx = npy.compress(goodmask, b[:,0])
- by = npy.compress(goodmask, b[:,1])
+ bx = np.compress(goodmask, b[:,0])
+ by = np.compress(goodmask, b[:,1])
# for orthographic projection, all points
# outside map projection region are eliminated
# with the above step, so we're done.
@@ -947,16 +947,16 @@
maptran = self
if self.projection in ['ortho','geos']:
# circular region.
- thetas = linspace(0.,2.*npy.pi,2*nx*ny)[:-1]
+ thetas = np.linspace(0.,2.*np.pi,2*nx*ny)[:-1]
if self.projection == 'ortho':
rminor = self.rmajor
rmajor = self.rmajor
else:
rminor = self._height
rmajor = self._width
- x = rmajor*npy.cos(thetas) + rmajor
- y = rminor*npy.sin(thetas) + rminor
- b = npy.empty((len(x),2),npy.float64)
+ x = rmajor*np.cos(thetas) + rmajor
+ y = rminor*np.sin(thetas) + rminor
+ b = np.empty((len(x),2),np.float64)
b[:,0]=x; b[:,1]=y
boundaryxy = _geoslib.Polygon(b)
# compute proj instance for full disk, if necessary.
@@ -981,41 +981,41 @@
# quasi-elliptical region.
lon_0 = self.projparams['lon_0']
# left side
- lats1 = linspace(-89.9,89.9,ny).tolist()
+ lats1 = np.linspace(-89.9,89.9,ny).tolist()
lons1 = len(lats1)*[lon_0-179.9]
# top.
- lons2 = linspace(lon_0-179.9,lon_0+179.9,nx).tolist()
+ lons2 = np.linspace(lon_0-179.9,lon_0+179.9,nx).tolist()
lats2 = len(lons2)*[89.9]
# right side
- lats3 = linspace(89.9,-89.9,ny).tolist()
+ lats3 = np.linspace(89.9,-89.9,ny).tolist()
lons3 = len(lats3)*[lon_0+179.9]
# bottom.
- lons4 = linspace(lon_0+179.9,lon_0-179.9,nx).tolist()
+ lons4 = np.linspace(lon_0+179.9,lon_0-179.9,nx).tolist()
lats4 = len(lons4)*[-89.9]
- lons = npy.array(lons1+lons2+lons3+lons4,npy.float64)
- lats = npy.array(lats1+lats2+lats3+lats4,npy.float64)
+ lons = np.array(lons1+lons2+lons3+lons4,np.float64)
+ lats = np.array(lats1+lats2+lats3+lats4,np.float64)
x, y = maptran(lons,lats)
- b = npy.empty((len(x),2),npy.float64)
+ b = np.empty((len(x),2),np.float64)
b[:,0]=x; b[:,1]=y
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]
+ yy = np.linspace(self.ymin, self.ymax, ny)[:-1]
x = len(yy)*[self.xmin]; y = yy.tolist()
# top (y = ymax, xmin <= x <= xmax)
- xx = npy.linspace(self.xmin, self.xmax, nx)[:-1]
+ xx = np.np.linspace(self.xmin, self.xmax, nx)[:-1]
x = x + xx.tolist()
y = y + len(xx)*[self.ymax]
# right side (x = xmax, ymin <= y <= ymax)
- yy = linspace(self.ymax, self.ymin, ny)[:-1]
+ yy = np.linspace(self.ymax, self.ymin, ny)[:-1]
x = x + len(yy)*[self.xmax]; y = y + yy.tolist()
# bottom (y = ymin, xmin <= x <= xmax)
- xx = linspace(self.xmax, self.xmin, nx)[:-1]
+ xx = np.linspace(self.xmax, self.xmin, nx)[:-1]
x = x + xx.tolist()
y = y + len(xx)*[self.ymin]
- x = npy.array(x,npy.float64)
- y = npy.array(y,npy.float64)
- b = npy.empty((4,2),npy.float64)
+ x = np.array(x,np.float64)
+ y = np.array(y,np.float64)
+ b = np.empty((4,2),np.float64)
b[:,0]=[self.xmin,self.xmin,self.xmax,self.xmax]
b[:,1]=[self.ymin,self.ymax,self.ymax,self.ymin]
boundaryxy = _geoslib.Polygon(b)
@@ -1032,7 +1032,7 @@
lons = [self.llcrnrlon, self.llcrnrlon, self.urcrnrlon, self.urcrnrlon]
lats = [llcrnrlat, urcrnrlat, urcrnrlat, llcrnrlat]
x, y = self(lons, lats)
- b = npy.empty((len(x),2),npy.float64)
+ b = np.empty((len(x),2),np.float64)
b[:,0]=x; b[:,1]=y
boundaryxy = _geoslib.Polygon(b)
else:
@@ -1042,7 +1042,7 @@
n = 1
lonprev = lons[0]
for lon,lat in zip(lons[1:],lats[1:]):
- if npy.abs(lon-lonprev) > 90.:
+ if np.abs(lon-lonprev) > 90.:
if lonprev < 0:
lon = lon - 360.
else:
@@ -1050,7 +1050,7 @@
lons[n] = lon
lonprev = lon
n = n + 1
- b = npy.empty((len(lons),2),npy.float64)
+ b = np.empty((len(lons),2),np.float64)
b[:,0]=lons; b[:,1]=lats
boundaryll = _geoslib.Polygon(b)
return boundaryll, boundaryxy
@@ -1075,10 +1075,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
limb = None
@@ -1104,19 +1104,19 @@
# quasi-elliptical region.
lon_0 = self.projparams['lon_0']
# left side
- lats1 = linspace(-89.9,89.9,ny).tolist()
+ lats1 = np.linspace(-89.9,89.9,ny).tolist()
lons1 = len(lats1)*[lon_0-179.9]
# top.
- lons2 = linspace(lon_0-179.9,lon_0+179.9,nx).tolist()
+ lons2 = np.linspace(lon_0-179.9,lon_0+179.9,nx).tolist()
lats2 = len(lons2)*[89.9]
# right side
- lats3 = linspace(89.9,-89.9,ny).tolist()
+ lats3 = np.linspace(89.9,-89.9,ny).tolist()
lons3 = len(lats3)*[lon_0+179.9]
# bottom.
- lons4 = linspace(lon_0+179.9,lon_0-179.9,nx).tolist()
+ lons4 = np.linspace(lon_0+179.9,lon_0-179.9,nx).tolist()
lats4 = len(lons4)*[-89.9]
- lons = npy.array(lons1+lons2+lons3+lons4,npy.float64)
- lats = npy.array(lats1+lats2+lats3+lats4,npy.float64)
+ lons = np.array(lons1+lons2+lons3+lons4,np.float64)
+ lats = np.array(lats1+lats2+lats3+lats4,np.float64)
x, y = self(lons,lats)
xy = zip(x,y)
limb = Polygon(xy,edgecolor=color,linewidth=linewidth)
@@ -1185,32 +1185,32 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
# get axis background color.
axisbgc = ax.get_axis_bgcolor()
np = 0
for x,y in self.coastpolygons:
- xa = npy.array(x,npy.float32)
- ya = npy.array(y,npy.float32)
+ xa = np.array(x,np.float32)
+ ya = np.array(y,np.float32)
# check to see if all four corners of domain in polygon (if so,
# don't draw since it will just fill in the whole map).
delx = 10; dely = 10
if self.projection in ['cyl']:
delx = 0.1
dely = 0.1
- test1 = npy.fabs(xa-self.urcrnrx) < delx
- test2 = npy.fabs(xa-self.llcrnrx) < delx
- test3 = npy.fabs(ya-self.urcrnry) < dely
- test4 = npy.fabs(ya-self.llcrnry) < dely
- hasp1 = npy.sum(test1*test3)
- hasp2 = npy.sum(test2*test3)
- hasp4 = npy.sum(test2*test4)
- hasp3 = npy.sum(test1*test4)
+ test1 = np.fabs(xa-self.urcrnrx) < delx
+ test2 = np.fabs(xa-self.llcrnrx) < delx
+ test3 = np.fabs(ya-self.urcrnry) < dely
+ test4 = np.fabs(ya-self.llcrnry) < dely
+ hasp1 = np.sum(test1*test3)
+ hasp2 = np.sum(test2*test3)
+ hasp4 = np.sum(test2*test4)
+ hasp3 = np.sum(test1*test4)
if not hasp1 or not hasp2 or not hasp3 or not hasp4:
xy = zip(xa.tolist(),ya.tolist())
if self.coastpolygontypes[np] not in [2,4]:
@@ -1245,10 +1245,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
coastlines = LineCollection(self.coastsegs,antialiaseds=(antialiased,))
@@ -1283,10 +1283,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
countries = LineCollection(self.cntrysegs,antialiaseds=(antialiased,))
@@ -1321,10 +1321,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
states = LineCollection(self.statesegs,antialiaseds=(antialiased,))
@@ -1359,10 +1359,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
rivers = LineCollection(self.riversegs,antialiaseds=(antialiased,))
@@ -1484,10 +1484,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
# make LineCollections for each polygon.
@@ -1537,7 +1537,7 @@
ax - axes instance (overrides default axes instance)
additional keyword arguments control text properties for labels (see
- pylab.text documentation)
+ plt.text documentation)
returns a dictionary whose keys are the parallels, and
whose values are tuples containing lists of the Line2D and Text instances
@@ -1546,10 +1546,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
# don't draw meridians past latmax, always draw parallel at latmax.
@@ -1565,13 +1565,13 @@
xoffset = (self.urcrnrx-self.llcrnrx)/100.
if self.projection in ['merc','cyl','mill','moll','robin','sinu']:
- lons = npy.arange(self.llcrnrlon,self.urcrnrlon+0.01,0.01)
+ lons = np.arange(self.llcrnrlon,self.urcrnrlon+0.01,0.01)
elif self.projection in ['tmerc']:
lon_0 = self.projparams['lon_0']
# tmerc only defined within +/- 90 degrees of lon_0
- lons = npy.arange(lon_0-90,lon_0+90.01,0.01)
+ lons = np.arange(lon_0-90,lon_0+90.01,0.01)
else:
- lons = npy.arange(0,360.01,0.01)
+ lons = np.arange(0,360.01,0.01)
# make sure latmax degree parallel is drawn if projection not merc or cyl or miller
try:
circlesl = circles.tolist()
@@ -1586,28 +1586,28 @@
ydelta = 0.01*(self.ymax-self.ymin)
linecolls = {}
for circ in circlesl:
- lats = circ*npy.ones(len(lons),npy.float32)
+ lats = circ*np.ones(len(lons),np.float32)
x,y = self(lons,lats)
# remove points outside domain.
# leave a little slop around edges (3*xdelta)
# don't really know why, but this appears to be needed to
# or lines sometimes don't reach edge of plot.
- testx = npy.logical_and(x>=self.xmin-3*xdelta,x<=self.xmax+3*xdelta)
- x = npy.compress(testx, x)
- y = npy.compress(testx, y)
- testy = npy.logical_and(y>=self.ymin-3*ydelta,y<=self.ymax+3*ydelta)
- x = npy.compress(testy, x)
- y = npy.compress(testy, y)
+ testx = np.logical_and(x>=self.xmin-3*xdelta,x<=self.xmax+3*xdelta)
+ x = np.compress(testx, x)
+ y = np.compress(testx, y)
+ testy = np.logical_and(y>=self.ymin-3*ydelta,y<=self.ymax+3*ydelta)
+ x = np.compress(testy, x)
+ y = np.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).
xd = (x[1:]-x[0:-1])**2
yd = (y[1:]-y[0:-1])**2
- dist = npy.sqrt(xd+yd)
+ dist = np.sqrt(xd+yd)
split = dist > 500000.
- if npy.sum(split) and self.projection not in ['merc','cyl','mill','moll','robin','sinu']:
- ind = (npy.compress(split,squeeze(split*npy.indices(xd.shape)))+1).tolist()
+ if np.sum(split) and self.projection not in ['merc','cyl','mill','moll','robin','sinu']:
+ ind = (np.compress(split,np.squeeze(split*np.indices(xd.shape)))+1).tolist()
xl = []
yl = []
iprev = 0
@@ -1650,15 +1650,15 @@
if self.projection in ['cyl','merc','mill','moll','robin','sinu'] and side in ['t','b']: continue
if side in ['l','r']:
nmax = int((self.ymax-self.ymin)/dy+1)
- yy = linspace(self.llcrnry,self.urcrnry,nmax)
+ yy = np.linspace(self.llcrnry,self.urcrnry,nmax)
# mollweide inverse transform undefined at South Pole
if self.projection == 'moll' and yy[0] < 1.e-4:
yy[0] = 1.e-4
if side == 'l':
- lons,lats = self(self.llcrnrx*npy.ones(yy.shape,npy.float32),yy,inverse=True)
+ lons,lats = self(self.llcrnrx*np.ones(yy.shape,np.float32),yy,inverse=True)
lons = lons.tolist(); lats = lats.tolist()
else:
- lons,lats = self(self.urcrnrx*npy.ones(yy.shape,npy.float32),yy,inverse=True)
+ lons,lats = self(self.urcrnrx*np.ones(yy.shape,np.float32),yy,inverse=True)
lons = lons.tolist(); lats = lats.tolist()
if max(lons) > 1.e20 or max(lats) > 1.e20:
raise ValueError,'inverse transformation undefined - please adjust the map projection region'
@@ -1666,12 +1666,12 @@
lons = [(lon+360) % 360 for lon in lons]
else:
nmax = int((self.xmax-self.xmin)/dx+1)
- xx = linspace(self.llcrnrx,self.urcrnrx,nmax)
+ xx = np.linspace(self.llcrnrx,self.urcrnrx,nmax)
if side == 'b':
- lons,lats = self(xx,self.llcrnry*npy.ones(xx.shape,npy.float32),inverse=True)
+ lons,lats = self(xx,self.llcrnry*np.ones(xx.shape,np.float32),inverse=True)
lons = lons.tolist(); lats = lats.tolist()
else:
- lons,lats = self(xx,self.urcrnry*npy.ones(xx.shape,npy.float32),inverse=True)
+ lons,lats = self(xx,self.urcrnry*np.ones(xx.shape,np.float32),inverse=True)
lons = lons.tolist(); lats = lats.tolist()
if max(lons) > 1.e20 or max(lats) > 1.e20:
raise ValueError,'inverse transformation undefined - please adjust the map projection region'
@@ -1697,7 +1697,7 @@
latlabstr = u'-%s\N{DEGREE SIGN}'%fmt
else:
latlabstr = u'%s\N{DEGREE SIGN}S'%fmt
- latlab = latlabstr%npy.fabs(lat)
+ latlab = latlabstr%np.fabs(lat)
elif lat>0:
if rcParams['text.usetex']:
if labelstyle=='+/-':
@@ -1779,7 +1779,7 @@
ax - axes instance (overrides default axes instance)
additional keyword arguments control text properties for labels (see
- pylab.text documentation)
+ plt.text documentation)
returns a dictionary whose keys are the meridians, and
whose values are tuples containing lists of the Line2D and Text instances
@@ -1788,10 +1788,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
# don't draw meridians past latmax, always draw parallel at latmax.
@@ -1807,35 +1807,35 @@
xoffset = (self.urcrnrx-self.llcrnrx)/100.
if self.projection not in ['merc','cyl','mill','moll','robin','sinu']:
- lats = npy.arange(-latmax,latmax+0.01,0.01)
+ lats = np.arange(-latmax,latmax+0.01,0.01)
else:
- lats = npy.arange(-90,90.01,0.01)
+ lats = np.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)
+ lons = merid*np.ones(len(lats),np.float32)
x,y = self(lons,lats)
# remove points outside domain.
# leave a little slop around edges (3*xdelta)
# don't really know why, but this appears to be needed to
# or lines sometimes don't reach edge of plot.
- testx = npy.logical_and(x>=self.xmin-3*xdelta,x<=self.xmax+3*xdelta)
- x = npy.compress(testx, x)
- y = npy.compress(testx, y)
- testy = npy.logical_and(y>=self.ymin-3*ydelta,y<=self.ymax+3*ydelta)
- x = npy.compress(testy, x)
- y = npy.compress(testy, y)
+ testx = np.logical_and(x>=self.xmin-3*xdelta,x<=self.xmax+3*xdelta)
+ x = np.compress(testx, x)
+ y = np.compress(testx, y)
+ testy = np.logical_and(y>=self.ymin-3*ydelta,y<=self.ymax+3*ydelta)
+ x = np.compress(testy, x)
+ y = np.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).
xd = (x[1:]-x[0:-1])**2
yd = (y[1:]-y[0:-1])**2
- dist = npy.sqrt(xd+yd)
+ dist = np.sqrt(xd+yd)
split = dist > 500000.
- if npy.sum(split) and self.projection not in ['merc','cyl','mill','moll','robin','sinu']:
- ind = (npy.compress(split,squeeze(split*npy.indices(xd.shape)))+1).tolist()
+ if np.sum(split) and self.projection not in ['merc','cyl','mill','moll','robin','sinu']:
+ ind = (np.compress(split,np.squeeze(split*np.indices(xd.shape)))+1).tolist()
xl = []
yl = []
iprev = 0
@@ -1884,12 +1884,12 @@
if self.projection in ['cyl','merc','mill','sinu','robin','moll'] and side in ['l','r']: continue
if side in ['l','r']:
nmax = int((self.ymax-self.ymin)/dy+1)
- yy = linspace(self.llcrnry,self.urcrnry,nmax)
+ yy = np.linspace(self.llcrnry,self.urcrnry,nmax)
if side == 'l':
- lons,lats = self(self.llcrnrx*npy.ones(yy.shape,npy.float32),yy,inverse=True)
+ lons,lats = self(self.llcrnrx*np.ones(yy.shape,np.float32),yy,inverse=True)
lons = lons.tolist(); lats = lats.tolist()
else:
- lons,lats = self(self.urcrnrx*npy.ones(yy.shape,npy.float32),yy,inverse=True)
+ lons,lats = self(self.urcrnrx*np.ones(yy.shape,np.float32),yy,inverse=True)
lons = lons.tolist(); lats = lats.tolist()
if max(lons) > 1.e20 or max(lats) > 1.e20:
raise ValueError,'inverse transformation undefined - please adjust the map projection region'
@@ -1897,12 +1897,12 @@
lons = [(lon+360) % 360 for lon in lons]
else:
nmax = int((self.xmax-self.xmin)/dx+1)
- xx = linspace(self.llcrnrx,self.urcrnrx,nmax)
+ xx = np.linspace(self.llcrnrx,self.urcrnrx,nmax)
if side == 'b':
- lons,lats = self(xx,self.llcrnry*npy.ones(xx.shape,npy.float32),inverse=True)
+ lons,lats = self(xx,self.llcrnry*np.ones(xx.shape,np.float32),inverse=True)
lons = lons.tolist(); lats = lats.tolist()
else:
- lons,lats = self(xx,self.urcrnry*npy.ones(xx.shape,npy.float32),inverse=True)
+ lons,lats = self(xx,self.urcrnry*np.ones(xx.shape,np.float32),inverse=True)
lons = lons.tolist(); lats = lats.tolist()
if max(lons) > 1.e20 or max(lats) > 1.e20:
raise ValueError,'inverse transformation undefined - please adjust the map projection region'
@@ -1930,7 +1930,7 @@
lonlabstr = u'-%s\N{DEGREE SIGN}'%fmt
else:
lonlabstr = u'%s\N{DEGREE SIGN}W'%fmt
- lonlab = lonlabstr%npy.fabs(lon2-360)
+ lonlab = lonlabstr%np.fabs(lon2-360)
elif lon2<180 and lon2 != 0:
if rcParams['text.usetex']:
if labelstyle=='+/-':
@@ -2002,7 +2002,7 @@
del_s - points on great circle computed every delta kilometers (default 100).
Other keyword arguments (**kwargs) control plotting of great circle line,
- see pylab.plot documentation for details.
+ see plt.plot documentation for details.
Note: cannot handle situations in which the great circle intersects
the edge of the map projection domain, and then re-enters the domain.
@@ -2055,8 +2055,8 @@
raise ValueError, 'lons and lats must be increasing!'
# check that lons in -180,180 for non-cylindrical projections.
if self.projection not in ['cyl','merc','mill']:
- lonsa = npy.array(lons)
- count = npy.sum(lonsa < -180.00001) + npy.sum(lonsa > 180.00001)
+ lonsa = np.array(lons)
+ count = np.sum(lonsa < -180.00001) + np.sum(lonsa > 180.00001)
if count > 1:
raise ValueError,'grid must be shifted so that lons are monotonically increasing and fit in range -180,+180 (see shiftgrid function)'
# allow for wraparound point to be outside.
@@ -2109,8 +2109,8 @@
raise ValueError, 'lons and lats must be increasing!'
# check that lons in -180,180 for non-cylindrical projections.
if self.projection not in ['cyl','merc','mill']:
- lonsa = npy.array(lons)
- count = npy.sum(lonsa < -180.00001) + npy.sum(lonsa > 180.00001)
+ lonsa = np.array(lons)
+ count = np.sum(lonsa < -180.00001) + np.sum(lonsa > 180.00001)
if count > 1:
raise ValueError,'grid must be shifted so that lons are monotonically increasing and fit in range -180,+180 (see shiftgrid function)'
# allow for wraparound point to be outside.
@@ -2127,10 +2127,10 @@
vin = vin.filled(1)
masked = True # override kwarg with reality
uvc = uin + 1j*vin
- uvmag = npy.abs(uvc)
+ uvmag = np.abs(uvc)
delta = 0.1 # increment in longitude
dlon = delta*uin/uvmag
- dlat = delta*(vin/uvmag)*npy.cos(latsout*npy.pi/180.0)
+ dlat = delta*(vin/uvmag)*np.cos(latsout*np.pi/180.0)
farnorth = latsout+dlat >= 90.0
somenorth = farnorth.any()
if somenorth:
@@ -2139,10 +2139,10 @@
lon1 = lonsout + dlon
lat1 = latsout + dlat
xn, yn = self(lon1, lat1)
- vecangle = npy.arctan2(yn-y, xn-x)
+ vecangle = np.arctan2(yn-y, xn-x)
if somenorth:
- vecangle[farnorth] += npy.pi
- uvcout = uvmag * npy.exp(1j*vecangle)
+ vecangle[farnorth] += np.pi
+ uvcout = uvmag * np.exp(1j*vecangle)
uout = uvcout.real
vout = uvcout.imag
if masked:
@@ -2184,10 +2184,10 @@
else:
masked = False
uvc = uin + 1j*vin
- uvmag = npy.abs(uvc)
+ uvmag = np.abs(uvc)
delta = 0.1 # increment in longitude
dlon = delta*uin/uvmag
- dlat = delta*(vin/uvmag)*npy.cos(lats*npy.pi/180.0)
+ dlat = delta*(vin/uvmag)*np.cos(lats*np.pi/180.0)
farnorth = lats+dlat >= 90.0
somenorth = farnorth.any()
if somenorth:
@@ -2196,10 +2196,10 @@
lon1 = lons + dlon
lat1 = lats + dlat
xn, yn = self(lon1, lat1)
- vecangle = npy.arctan2(yn-y, xn-x)
+ vecangle = np.arctan2(yn-y, xn-x)
if somenorth:
- vecangle[farnorth] += npy.pi
- uvcout = uvmag * npy.exp(1j*vecangle)
+ vecangle[farnorth] += np.pi
+ uvcout = uvmag * np.exp(1j*vecangle)
uout = uvcout.real
vout = uvcout.imag
if masked:
@@ -2218,10 +2218,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
# update data limits for map domain.
@@ -2250,15 +2250,15 @@
def scatter(self, *args, **kwargs):
"""
- Plot points with markers on the map (see pylab.scatter documentation).
+ Plot points with markers on the map (see plt.scatter documentation).
extra keyword 'ax' can be used to override the default axes instance.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif not kwargs.has_key('ax') and self.ax is not None:
ax = self.ax
else:
@@ -2271,7 +2271,7 @@
try:
ret = ax.scatter(*args, **kwargs)
try:
- pylab.draw_if_interactive()
+ plt.draw_if_interactive()
except:
pass
except:
@@ -2284,15 +2284,15 @@
def plot(self, *args, **kwargs):
"""
- Draw lines and/or markers on the map (see pylab.plot documentation).
+ Draw lines and/or markers on the map (see plt.plot documentation).
extra keyword 'ax' can be used to override the default axis instance.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif not kwargs.has_key('ax') and self.ax is not None:
ax = self.ax
else:
@@ -2305,7 +2305,7 @@
try:
ret = ax.plot(*args, **kwargs)
try:
- pylab.draw_if_interactive()
+ plt.draw_if_interactive()
except:
pass
except:
@@ -2318,17 +2318,17 @@
def imshow(self, *args, **kwargs):
"""
- Display an image over the map (see pylab.imshow documentation).
+ Display an image over the map (see plt.imshow documentation).
extent and origin keywords set automatically so image will be drawn
over map region.
extra keyword 'ax' can be used to override the default axis instance.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif not kwargs.has_key('ax') and self.ax is not None:
ax = self.ax
else:
@@ -2345,16 +2345,16 @@
try:
ret = ax.imshow(*args, **kwargs)
try:
- pylab.draw_if_interactive()
+ plt.draw_if_interactive()
except:
pass
except:
ax.hold(b)
raise
ax.hold(b)
- # reset current active image (only if pylab is imported).
+ # reset current active image (only if pyplot is imported).
try:
- pylab.gci._current = ret
+ plt.gci._current = ret
except:
pass
# set axes limits to fit map region.
@@ -2364,7 +2364,7 @@
def pcolor(self,x,y,data,**kwargs):
"""
Make a pseudo-color plot over the map.
- see pylab.pcolor documentation for definition of **kwargs
+ see plt.pcolor documentation for definition of **kwargs
If x or y are outside projection limb (i.e. they have values > 1.e20)
they will be convert to masked arrays with those values masked.
As a result, those values will not be plotted.
@@ -2372,18 +2372,18 @@
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ 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')
# make x,y masked arrays
# (masked where data is outside of projection limb)
- x = ma.masked_values(npy.where(x > 1.e20,1.e20,x), 1.e20)
- y = ma.masked_values(npy.where(y > 1.e20,1.e20,y), 1.e20)
+ x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20)
+ y = ma.masked_values(np.where(y > 1.e20,1.e20,y), 1.e20)
# allow callers to override the hold state by passing hold=True|False
b = ax.ishold()
h = kwargs.pop('hold',None)
@@ -2392,16 +2392,16 @@
try:
ret = ax.pcolor(x,y,data,**kwargs)
try:
- pylab.draw_if_interactive()
+ plt.draw_if_interactive()
except:
pass
except:
ax.hold(b)
raise
ax.hold(b)
- # reset current active image (only if pylab is imported).
+ # reset current active image (only if pyplot is imported).
try:
- pylab.gci._current = ret
+ plt.gci._current = ret
except:
pass
# set axes limits to fit map region.
@@ -2411,15 +2411,15 @@
def pcolormesh(self,x,y,data,**kwargs):
"""
Make a pseudo-color plot over the map.
- see pylab.pcolormesh documentation for definition of **kwargs
+ see plt.pcolormesh documentation for definition of **kwargs
extra keyword 'ax' can be used to override the default axis instance.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif not kwargs.has_key('ax') and self.ax is not None:
ax = self.ax
else:
@@ -2432,16 +2432,16 @@
try:
ret = ax.pcolormesh(x,y,data,**kwargs)
try:
- pylab.draw_if_interactive()
+ plt.draw_if_interactive()
except:
pass
except:
ax.hold(b)
raise
ax.hold(b)
- # reset current active image (only if pylab is imported).
+ # reset current active image (only if pyplot is imported).
try:
- pylab.gci._current = ret
+ plt.gci._current = ret
except:
pass
# set axes limits to fit map region.
@@ -2450,15 +2450,15 @@
def contour(self,x,y,data,*args,**kwargs):
"""
- Make a contour plot over the map (see pylab.contour documentation).
+ Make a contour plot over the map (see plt.contour documentation).
extra keyword 'ax' can be used to override the default axis instance.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif not kwargs.has_key('ax') and self.ax is not None:
ax = self.ax
else:
@@ -2482,10 +2482,10 @@
function to adjust the data to be consistent with the map projection
region (see examples/contour_demo.py).""")
# mask for points outside projection limb.
- xymask = npy.logical_or(npy.greater(x,1.e20),npy.greater(y,1.e20))
+ xymask = np.logical_or(np.greater(x,1.e20),np.greater(y,1.e20))
data = ma.asarray(data)
# combine with data mask.
- mask = npy.logical_or(ma.getmaskarray(data),xymask)
+ mask = np.logical_or(ma.getmaskarray(data),xymask)
data = ma.masked_array(data,mask=mask)
# allow callers to override the hold state by passing hold=True|False
b = ax.ishold()
@@ -2495,7 +2495,7 @@
try:
CS = ax.contour(x,y,data,*args,**kwargs)
try:
- pylab.draw_if_interactive()
+ plt.draw_if_interactive()
except:
pass
except:
@@ -2504,29 +2504,29 @@
ax.hold(b)
# set axes limits to fit map region.
self.set_axes_limits(ax=ax)
- # reset current active image (only if pylab is imported).
+ # reset current active image (only if pyplot is imported).
try:
try: # new contour.
- if CS._A is not None: pylab.gci._current = CS
+ if CS._A is not None: plt.gci._current = CS
except: # old contour.
- if CS[1].mappable is not None: pylab.gci._current = CS[1].mappable
+ if CS[1].mappable is not None: plt.gci._current = CS[1].mappable
except:
pass
return CS
def contourf(self,x,y,data,*args,**kwargs):
"""
- Make a filled contour plot over the map (see pylab.contourf documentation).
+ Make a filled contour plot over the map (see plt.contourf documentation).
If x or y are outside projection limb (i.e. they have values > 1.e20),
the corresponing data elements will be masked.
Extra keyword 'ax' can be used to override the default axis instance.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif not kwargs.has_key('ax') and self.ax is not None:
ax = self.ax
else:
@@ -2550,10 +2550,10 @@
function to adjust the data to be consistent with the map projection
region (see examples/contour_demo.py).""")
# mask for points outside projection limb.
- xymask = npy.logical_or(npy.greater(x,1.e20),npy.greater(y,1.e20))
+ xymask = np.logical_or(np.greater(x,1.e20),np.greater(y,1.e20))
data = ma.asarray(data)
# combine with data mask.
- mask = npy.logical_or(ma.getmaskarray(data),xymask)
+ mask = np.logical_or(ma.getmaskarray(data),xymask)
data = ma.masked_array(data,mask=mask)
# allow callers to override the hold state by passing hold=True|False
b = ax.ishold()
@@ -2563,7 +2563,7 @@
try:
CS = ax.contourf(x,y,data,*args,**kwargs)
try:
- pylab.draw_if_interactive()
+ plt.draw_if_interactive()
except:
pass
except:
@@ -2572,12 +2572,12 @@
ax.hold(b)
# set axes limits to fit map region.
self.set_axes_limits(ax=ax)
- # reset current active image (only if pylab is imported).
+ # reset current active image (only if pyplot is imported).
try:
try: # new contour.
- if CS._A is not None: pylab.gci._current = CS
+ if CS._A is not None: plt.gci._current = CS
except: # old contour.
- if CS[1].mappable is not None: pylab.gci._current = CS[1].mappable
+ if CS[1].mappable is not None: plt.gci._current = CS[1].mappable
except:
pass
return CS
@@ -2587,15 +2587,15 @@
Make a vector plot (u, v) with arrows on the map.
Extra arguments (*args and **kwargs) passed to quiver Axes method (see
- pylab.quiver documentation for details).
+ plt.quiver documentation for details).
extra keyword 'ax' can be used to override the default axis instance.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif not kwargs.has_key('ax') and self.ax is not None:
ax = self.ax
else:
@@ -2608,7 +2608,7 @@
try:
ret = ax.quiver(x,y,u,v,*args,**kwargs)
try:
- pylab.draw_if_interactive()
+ plt.draw_if_interactive()
except:
pass
except:
@@ -2656,13 +2656,13 @@
extra keyword 'ax' can be used to override the default axis instance.
"""
# look for axes instance (as keyword, an instance variable
- # or from pylab.gca().
+ # or from plt.gca().
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif not kwargs.has_key('ax') and self.ax is not None:
ax = self.ax
else:
@@ -2677,9 +2677,9 @@
lsmaskf = open(os.path.join(basemap_datadir,'5minmask.bin'),'rb')
nlons = 4320; nlats = nlons/2
delta = 360./float(nlons)
- lsmask_lons = npy.arange(-180+0.5*delta,180.,delta)
- lsmask_lats = npy.arange(-90.+0.5*delta,90.,delta)
- lsmask = npy.reshape(npy.fromstring(lsmaskf.read(),npy.uint8),(nlats,nlons))
+ lsmask_lons = np.arange(-180+0.5*delta,180.,delta)
+ lsmask_lats = np.arange(-90.+0.5*delta,90.,delta)
+ lsmask = np.reshape(np.fromstring(lsmaskf.read(),np.uint8),(nlats,nlons))
lsmaskf.close()
# instance variable lsmask is set on first invocation,
# it contains the land-sea mask interpolated to the native
@@ -2708,28 +2708,28 @@
lons, lats = self(x, y, inverse=True)
lon_0 = self.projparams['lon_0']
lats = lats[:,nx/2]
- lons1 = (lon_0+180.)*npy.ones(lons.shape[0],npy.float64)
- lons2 = (lon_0-180.)*npy.ones(lons.shape[0],npy.float64)
+ lons1 = (lon_0+180.)*np.ones(lons.shape[0],np.float64)
+ lons2 = (lon_0-180.)*np.ones(lons.shape[0],np.float64)
xmax,ytmp = self(lons1,lats)
xmin,ytmp = self(lons2,lats)
for j in range(lats.shape[0]):
xx = x[j,:]
- mask[j,:]=npy.where(npy.logical_or(xx<xmin[j],xx>xmax[j]),\
+ mask[j,:]=np.where(np.logical_or(xx<xmin[j],xx>xmax[j]),\
255,mask[j,:])
self.lsmask = mask
# optionally, set lakes to ocean color.
if lakes:
- mask = npy.where(self.lsmask==2,0,self.lsmask)
+ mask = np.where(self.lsmask==2,0,self.lsmask)
else:
mask = self.lsmask
ny, nx = mask.shape
- rgba = npy.ones((ny,nx,4),npy.uint8)
- rgba_land = npy.array(rgba_land,npy.uint8)
- rgba_ocean = npy.array(rgba_ocean,npy.uint8)
+ rgba = np.ones((ny,nx,4),np.uint8)
+ rgba_land = np.array(rgba_land,np.uint8)
+ rgba_ocean = np.array(rgba_ocean,np.uint8)
for k in range(4):
- rgba[:,:,k] = npy.where(mask,rgba_land[k],rgba_ocean[k])
+ rgba[:,:,k] = np.where(mask,rgba_land[k],rgba_ocean[k])
# make points outside projection limb transparent.
- rgba[:,:,3] = npy.where(mask==255,0,rgba[:,:,3])
+ rgba[:,:,3] = np.where(mask==255,0,rgba[:,:,3])
# plot mask as rgba image.
im = self.imshow(rgba,interpolation='nearest',ax=ax,**kwargs)
return im
@@ -2760,10 +2760,10 @@
from matplotlib.image import pil_to_array
if not kwargs.has_key('ax') and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif not kwargs.has_key('ax') and self.ax is not None:
ax = self.ax
else:
@@ -2786,12 +2786,12 @@
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(np.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)
+ self._bm_lons = np.arange(-180.+0.5*delta,180.,delta)
+ self._bm_lats = np.arange(-90.+0.5*delta,90.,delta)
if self.projection != 'cyl':
if newfile or not hasattr(self,'_bm_rgba_warped'):
@@ -2799,10 +2799,10 @@
# projection grid.
# nx and ny chosen to have roughly the
# same horizontal res as original image.
- dx = 2.*npy.pi*self.rmajor/float(nlons)
+ dx = 2.*np.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 = np.zeros((ny,nx,4),np.float64)
# interpolate rgba values from geographic coords (proj='cyl')
# to map projection coords.
# if masked=True, values outside of
@@ -2814,8 +2814,8 @@
# 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)
+ mask = ma.zeros((nx,ny,4),np.int8)
+ mask[:,:,0] = np.logical_or(lonsr>1.e20,latsr>1.e30)
for k in range(1,4):
mask[:,:,k] = mask[:,:,0]
self._bm_rgba_warped = \
@@ -2862,10 +2862,10 @@
# get current axes instance (if none specified).
if ax is None and self.ax is None:
try:
- ax = pylab.gca()
+ ax = plt.gca()
except:
- import pylab
- ax = pylab.gca()
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
elif ax is None and self.ax is not None:
ax = self.ax
# not valid for cylindrical projection
@@ -3091,8 +3091,8 @@
else:
# irregular (but still rectilinear) input grid.
xoutflat = xout.flatten(); youtflat = yout.flatten()
- ix = (npy.searchsorted(xin,xoutflat)-1).tolist()
- iy = (npy.searchsorted(yin,youtflat)-1).tolist()
+ ix = (np.searchsorted(xin,xoutflat)-1).tolist()
+ iy = (np.searchsorted(yin,youtflat)-1).tolist()
xoutflat = xoutflat.tolist(); xin = xin.tolist()
youtflat = youtflat.tolist(); yin = yin.tolist()
xcoords = []; ycoords = []
@@ -3110,33 +3110,33 @@
ycoords.append(len(yin)) # outside range on upper end
else:
ycoords.append(float(j)+(youtflat[m]-yin[j])/(yin[j+1]-yin[j]))
- xcoords = npy.reshape(xcoords,xout.shape)
- ycoords = npy.reshape(ycoords,yout.shape)
+ xcoords = np.reshape(xcoords,xout.shape)
+ ycoords = np.reshape(ycoords,yout.shape)
# data outside range xin,yin will be clipped to
# values on boundary.
if masked:
- xmask = npy.logical_or(npy.less(xcoords,0),npy.greater(xcoords,len(xin)-1))
- ymask = npy.logical_or(npy.less(ycoords,0),npy.greater(ycoords,len(yin)-1))
- xymask = npy.logical_or(xmask,ymask)
- xcoords = npy.clip(xcoords,0,len(xin)-1)
- ycoords = npy.clip(ycoords,0,len(yin)-1)
+ xmask = np.logical_or(np.less(xcoords,0),np.greater(xcoords,len(xin)-1))
+ ymask = np.logical_or(np.less(ycoords,0),np.greater(ycoords,len(yin)-1))
+ xymask = np.logical_or(xmask,ymask)
+ xcoords = np.clip(xcoords,0,len(xin)-1)
+ ycoords = np.clip(ycoords,0,len(yin)-1)
# interpolate to output grid using bilinear interpolation.
if order == 1:
- xi = xcoords.astype(npy.int32)
- yi = ycoords.astype(npy.int32)
+ xi = xcoords.astype(np.int32)
+ yi = ycoords.astype(np.int32)
xip1 = xi+1
yip1 = yi+1
- xip1 = npy.clip(xip1,0,len(xin)-1)
- yip1 = npy.clip(yip1,0,len(yin)-1)
- delx = xcoords-xi.astype(npy.float32)
- dely = ycoords-yi.astype(npy.float32)
+ xip1 = np.clip(xip1,0,len(xin)-1)
+ yip1 = np.clip(yip1,0,len(yin)-1)
+ delx = xcoords-xi.astype(np.float32)
+ dely = ycoords-yi.astype(np.float32)
dataout = (1.-delx)*(1.-dely)*datain[yi,xi] + \
delx*dely*datain[yip1,xip1] + \
(1.-delx)*dely*datain[yip1,xi] + \
delx*(1.-dely)*datain[yi,xip1]
elif order == 0:
- xcoordsi = npy.around(xcoords).astype(npy.int32)
- ycoordsi = npy.around(ycoords).astype(npy.int32)
+ xcoordsi = np.around(xcoords).astype(np.int32)
+ ycoordsi = np.around(ycoords).astype(np.int32)
dataout = datain[ycoordsi,xcoordsi]
else:
raise ValueError,'order keyword must be 0 or 1'
@@ -3145,7 +3145,7 @@
newmask = ma.mask_or(ma.getmask(dataout), xymask)
dataout = ma.masked_array(dataout,mask=newmask)
elif masked and is_scalar(masked):
- dataout = npy.where(xymask,masked,dataout)
+ dataout = np.where(xymask,masked,dataout)
return dataout
def shiftgrid(lon0,datain,lonsin,start=True):
@@ -3163,13 +3163,13 @@
returns dataout,lonsout (data and longitudes on shifted grid).
"""
- if npy.fabs(lonsin[-1]-lonsin[0]-360.) > 1.e-4:
+ if np.fabs(lonsin[-1]-lonsin[0]-360.) > 1.e-4:
raise ValueError, 'cyclic point not included'
if lon0 < lonsin[0] or lon0 > lonsin[-1]:
raise ValueError, 'lon0 outside of range of lonsin'
- i0 = npy.argmin(npy.fabs(lonsin-lon0))
- dataout = npy.zeros(datain.shape,datain.dtype)
- lonsout = npy.zeros(lonsin.shape,lonsin.dtype)
+ i0 = np.argmin(np.fabs(lonsin-lon0))
+ dataout = np.zeros(datain.shape,datain.dtype)
+ lonsout = np.zeros(lonsin.shape,lonsin.dtype)
if start:
lonsout[0:len(lonsin)-i0] = lonsin[i0:]
else:
@@ -3193,13 +3193,13 @@
if hasattr(arrin,'mask'):
arrout = ma.zeros((nlats,nlons+1),arrin.dtype)
else:
- arrout = npy.zeros((nlats,nlons+1),arrin.dtype)
+ arrout = np.zeros((nlats,nlons+1),arrin.dtype)
arrout[:,0:nlons] = arrin[:,:]
arrout[:,nlons] = arrin[:,0]
if hasattr(lonsin,'mask'):
lonsout = ma.zeros(nlons+1,lonsin.dtype)
else:
- lonsout = npy.zeros(nlons+1,lonsin.dtype)
+ lonsout = np.zeros(nlons+1,lonsin.dtype)
lonsout[0:nlons] = lonsin[:]
lonsout[nlons] = lonsin[-1] + lonsin[1]-lonsin[0]
return arrout,lonsout
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-20 12:24:56
|
Revision: 5198
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5198&view=rev
Author: jswhit
Date: 2008-05-20 05:24:54 -0700 (Tue, 20 May 2008)
Log Message:
-----------
more examples converted to numpy/pyplot namespace.
Modified Paths:
--------------
trunk/toolkits/basemap/examples/simpletest_oo.py
Modified: trunk/toolkits/basemap/examples/simpletest_oo.py
===================================================================
--- trunk/toolkits/basemap/examples/simpletest_oo.py 2008-05-20 12:22:09 UTC (rev 5197)
+++ trunk/toolkits/basemap/examples/simpletest_oo.py 2008-05-20 12:24:54 UTC (rev 5198)
@@ -7,15 +7,16 @@
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from mpl_toolkits.basemap import Basemap
from matplotlib.figure import Figure
-import numpy
+import numpy as np
+import matplotlib.mlab as mlab
import matplotlib.cm as cm
from matplotlib.mlab import load
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
-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 figure.
fig = Figure()
canvas = FigureCanvas(fig)
@@ -25,15 +26,15 @@
# set 'ax' keyword so pylab won't be imported.
m = Basemap(projection='robin',lon_0=0.5*(lons[0]+lons[-1]),ax=ax)
# make filled contour plot.
-x, y = m(*numpy.meshgrid(lons, lats))
+x, y = m(*np.meshgrid(lons, lats))
cs = m.contourf(x,y,etopo,30,cmap=cm.jet)
# draw coastlines.
m.drawcoastlines()
# draw a line around the map region.
m.drawmapboundary()
# draw parallels and meridians.
-m.drawparallels(numpy.arange(-60.,90.,30.),labels=[1,0,0,0],fontsize=10)
-m.drawmeridians(numpy.arange(0.,420.,60.),labels=[0,0,0,1],fontsize=10)
+m.drawparallels(np.arange(-60.,90.,30.),labels=[1,0,0,0],fontsize=10)
+m.drawmeridians(np.arange(0.,420.,60.),labels=[0,0,0,1],fontsize=10)
# add a title.
ax.set_title('Robinson Projection')
# add a colorbar.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-20 12:22:22
|
Revision: 5197
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5197&view=rev
Author: jswhit
Date: 2008-05-20 05:22:09 -0700 (Tue, 20 May 2008)
Log Message:
-----------
more examples updated to numpy/pyplot namespace
Modified Paths:
--------------
trunk/toolkits/basemap/examples/ccsm_popgrid.py
trunk/toolkits/basemap/examples/fillstates.py
trunk/toolkits/basemap/examples/garp.py
trunk/toolkits/basemap/examples/hurrtracks.py
trunk/toolkits/basemap/examples/panelplot.py
trunk/toolkits/basemap/examples/plot_tissot.py
trunk/toolkits/basemap/examples/plotprecip.py
trunk/toolkits/basemap/examples/plotsst.py
trunk/toolkits/basemap/examples/pnganim.py
trunk/toolkits/basemap/examples/polarmaps.py
trunk/toolkits/basemap/examples/setwh.py
trunk/toolkits/basemap/examples/show_colormaps.py
trunk/toolkits/basemap/examples/testgdal.py
Modified: trunk/toolkits/basemap/examples/ccsm_popgrid.py
===================================================================
--- trunk/toolkits/basemap/examples/ccsm_popgrid.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/ccsm_popgrid.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -20,10 +20,10 @@
POP grids are used extensively locally in oceanographic and ice models.
"""
-import pylab as pl
from matplotlib import rcParams
-from numpy import ma as MA
-import numpy as N
+from numpy import ma
+import numpy as np
+import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap, NetCDFFile
# read in data from netCDF file.
@@ -36,17 +36,17 @@
fpin.close()
# make longitudes monotonically increasing.
-tlon = N.where(N.greater_equal(tlon,min(tlon[:,0])),tlon-360,tlon)
+tlon = np.where(np.greater_equal(tlon,min(tlon[:,0])),tlon-360,tlon)
# stack grids side-by-side (in longitiudinal direction), so
# any range of longitudes may be plotted on a world map.
-tlon = N.concatenate((tlon,tlon+360),1)
-tlat = N.concatenate((tlat,tlat),1)
-temp = MA.concatenate((temp,temp),1)
+tlon = np.concatenate((tlon,tlon+360),1)
+tlat = np.concatenate((tlat,tlat),1)
+temp = ma.concatenate((temp,temp),1)
tlon = tlon-360.
-pl.figure(figsize=(6,8))
-pl.subplot(2,1,1)
+plt.figure(figsize=(6,8))
+plt.subplot(2,1,1)
# subplot 1 just shows POP grid cells.
map = Basemap(projection='merc', lat_ts=20, llcrnrlon=-180, \
urcrnrlon=180, llcrnrlat=-84, urcrnrlat=84, resolution='c')
@@ -55,22 +55,22 @@
map.fillcontinents(color='white')
x, y = map(tlon,tlat)
-im = map.pcolor(x,y,MA.masked_array(N.zeros(temp.shape,'f'), temp.mask),\
- shading='faceted',cmap=pl.cm.cool,vmin=0,vmax=0)
+im = map.pcolor(x,y,ma.masked_array(np.zeros(temp.shape,'f'), temp.mask),\
+ shading='faceted',cmap=plt.cm.cool,vmin=0,vmax=0)
# disclaimer: these are not really the grid cells because of the
# way pcolor interprets the x and y args.
-pl.title('(A) CCSM POP Grid Cells')
+plt.title('(A) CCSM POP Grid Cells')
# subplot 2 is a contour plot of surface temperature from the
# CCSM ocean model.
-pl.subplot(2,1,2)
+plt.subplot(2,1,2)
map.drawcoastlines()
map.fillcontinents(color='white')
CS1 = map.contourf(x,y,temp,15)
CS2 = map.contour(x,y,temp,15,colors='black',linewidths=0.5)
-pl.title('(B) Surface Temp contours on POP Grid')
+plt.title('(B) Surface Temp contours on POP Grid')
-pl.show()
-#pl.savefig('ccsm_popgrid.ps')
+plt.show()
+#plt.savefig('ccsm_popgrid.ps')
Modified: trunk/toolkits/basemap/examples/fillstates.py
===================================================================
--- trunk/toolkits/basemap/examples/fillstates.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/fillstates.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -1,5 +1,5 @@
-import pylab as p
-import numpy
+import numpy as np
+import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
from matplotlib.colors import rgb2hex
from matplotlib.patches import Polygon
@@ -68,7 +68,7 @@
# choose a color for each state based on population density.
colors={}
statenames=[]
-cmap = p.cm.hot # use 'hot' colormap
+cmap = plt.cm.hot # use 'hot' colormap
vmin = 0; vmax = 450 # set range.
print m.states_info[0].keys()
for shapedict in m.states_info:
@@ -79,10 +79,10 @@
# calling colormap with value between 0 and 1 returns
# rgba value. Invert color range (hot colors are high
# population), take sqrt root to spread out colors more.
- colors[statename] = cmap(1.-p.sqrt((pop-vmin)/(vmax-vmin)))[:3]
+ colors[statename] = cmap(1.-np.sqrt((pop-vmin)/(vmax-vmin)))[:3]
statenames.append(statename)
# cycle through state names, color each one.
-ax = p.gca() # get current axes instance
+ax = plt.gca() # get current axes instance
for nshape,seg in enumerate(m.states):
# skip DC and Puerto Rico.
if statenames[nshape] not in ['District of Columbia','Puerto Rico']:
@@ -90,7 +90,7 @@
poly = Polygon(seg,facecolor=color,edgecolor=color)
ax.add_patch(poly)
# draw meridians and parallels.
-m.drawparallels(numpy.arange(25,65,20),labels=[1,0,0,0])
-m.drawmeridians(numpy.arange(-120,-40,20),labels=[0,0,0,1])
-p.title('Filling State Polygons by Population Density')
-p.show()
+m.drawparallels(np.arange(25,65,20),labels=[1,0,0,0])
+m.drawmeridians(np.arange(-120,-40,20),labels=[0,0,0,1])
+plt.title('Filling State Polygons by Population Density')
+plt.show()
Modified: trunk/toolkits/basemap/examples/garp.py
===================================================================
--- trunk/toolkits/basemap/examples/garp.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/garp.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -1,5 +1,6 @@
from mpl_toolkits.basemap import Basemap
-from pylab import title, show, arange, pi
+import numpy as np
+import matplotlib.pyplot as plt
# the shortest route from the center of the map
# to any other point is a straight line in the azimuthal
@@ -30,11 +31,11 @@
m.drawcoastlines(linewidth=0.5)
m.fillcontinents(color='coral',lake_color='aqua')
# 20 degree graticule.
-m.drawparallels(arange(-80,81,20))
-m.drawmeridians(arange(-180,180,20))
+m.drawparallels(np.arange(-80,81,20))
+m.drawmeridians(np.arange(-180,180,20))
# draw a black dot at the center.
xpt, ypt = m(lon_0, lat_0)
m.plot([xpt],[ypt],'ko')
# draw the title.
-title('The World According to Garp in '+location)
-show()
+plt.title('The World According to Garp in '+location)
+plt.show()
Modified: trunk/toolkits/basemap/examples/hurrtracks.py
===================================================================
--- trunk/toolkits/basemap/examples/hurrtracks.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/hurrtracks.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -1,16 +1,17 @@
"""
draw Atlantic Hurricane Tracks for storms that reached Cat 4 or 5.
part of the track for which storm is cat 4 or 5 is shown red.
-ESRI shapefile data from http://www.nationalatlas.gov/atlasftp.html
+ESRI shapefile data from http://www.nationalatlas.gov/atlasftplt.html
"""
-import pylab as p
+import numpy as np
+import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
-# Lambert Conformal Conic map.
+# Lambert Conformal Conic maplt.
m = Basemap(llcrnrlon=-100.,llcrnrlat=0.,urcrnrlon=-20.,urcrnrlat=57.,
projection='lcc',lat_1=20.,lat_2=40.,lon_0=-60.,
resolution ='l',area_thresh=1000.)
# create figure.
-fig=p.figure()
+fig=plt.figure()
# read shapefile.
shp_info = m.readshapefile('huralll020','hurrtracks',drawbounds=False)
print shp_info
@@ -32,15 +33,15 @@
xx,yy = zip(*shape)
# show part of track where storm > Cat 4 as thick red.
if cat in ['H4','H5']:
- p.plot(xx,yy,linewidth=1.5,color='r')
+ plt.plot(xx,yy,linewidth=1.5,color='r')
elif cat in ['H1','H2','H3']:
- p.plot(xx,yy,color='k')
+ plt.plot(xx,yy,color='k')
# draw coastlines, meridians and parallels.
m.drawcoastlines()
m.drawcountries()
m.drawmapboundary(fill_color='#99ffff')
m.fillcontinents(color='#cc9966',lake_color='#99ffff')
-m.drawparallels(p.arange(10,70,20),labels=[1,1,0,0])
-m.drawmeridians(p.arange(-100,0,20),labels=[0,0,0,1])
-p.title('Atlantic Hurricane Tracks (Storms Reaching Category 4, 1851-2004)')
-p.show()
+m.drawparallels(np.arange(10,70,20),labels=[1,1,0,0])
+m.drawmeridians(np.arange(-100,0,20),labels=[0,0,0,1])
+plt.title('Atlantic Hurricane Tracks (Storms Reaching Category 4, 1851-2004)')
+plt.show()
Modified: trunk/toolkits/basemap/examples/panelplot.py
===================================================================
--- trunk/toolkits/basemap/examples/panelplot.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/panelplot.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -1,14 +1,16 @@
from mpl_toolkits.basemap import Basemap
from matplotlib import rcParams
from matplotlib.ticker import MultipleLocator
-import pylab as P
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.mlab as mlab
# read in data on lat/lon grid.
-hgt = P.load('500hgtdata.gz')
-lons = P.load('500hgtlons.gz')
-lats = P.load('500hgtlats.gz')
-lons, lats = P.meshgrid(lons, lats)
+hgt = mlab.load('500hgtdata.gz')
+lons = mlab.load('500hgtlons.gz')
+lats = mlab.load('500hgtlats.gz')
+lons, lats = np.meshgrid(lons, lats)
# Example to show how to make multi-panel plots.
@@ -18,29 +20,29 @@
rcParams['figure.subplot.wspace'] = 0.5 # more width between subplots
# create new figure
-fig=P.figure()
+fig=plt.figure()
# panel 1
mnh = Basemap(lon_0=-105,boundinglat=20.,
resolution='c',area_thresh=10000.,projection='nplaea')
xnh,ynh = mnh(lons,lats)
ax = fig.add_subplot(211)
CS = mnh.contour(xnh,ynh,hgt,15,linewidths=0.5,colors='k')
-CS = mnh.contourf(xnh,ynh,hgt,15,cmap=P.cm.Spectral)
+CS = mnh.contourf(xnh,ynh,hgt,15,cmap=plt.cm.Spectral)
# colorbar on bottom.
pos = ax.get_position()
l, b, w, h = pos.bounds
-cax = P.axes([l, b-0.05, w, 0.025]) # setup colorbar axes
-P.colorbar(cax=cax, orientation='horizontal',ticks=CS.levels[0::4]) # draw colorbar
-P.axes(ax) # make the original axes current again
+cax = plt.axes([l, b-0.05, w, 0.025]) # setup colorbar axes
+plt.colorbar(cax=cax, orientation='horizontal',ticks=CS.levels[0::4]) # draw colorbar
+plt.axes(ax) # make the original axes current again
mnh.drawcoastlines(linewidth=0.5)
delat = 30.
-circles = P.arange(0.,90.,delat).tolist()+\
- P.arange(-delat,-90,-delat).tolist()
+circles = np.arange(0.,90.,delat).tolist()+\
+ np.arange(-delat,-90,-delat).tolist()
mnh.drawparallels(circles,labels=[1,0,0,0])
delon = 45.
-meridians = P.arange(0,360,delon)
+meridians = np.arange(0,360,delon)
mnh.drawmeridians(meridians,labels=[1,0,0,1])
-P.title('NH 500 hPa Height (cm.Spectral)')
+plt.title('NH 500 hPa Height (cm.Spectral)')
# panel 2
msh = Basemap(lon_0=-105,boundinglat=-20.,
@@ -48,17 +50,17 @@
xsh,ysh = msh(lons,lats)
ax = fig.add_subplot(212)
CS = msh.contour(xsh,ysh,hgt,15,linewidths=0.5,colors='k')
-CS = msh.contourf(xsh,ysh,hgt,15,cmap=P.cm.Spectral)
+CS = msh.contourf(xsh,ysh,hgt,15,cmap=plt.cm.Spectral)
# colorbar on bottom.
pos = ax.get_position()
l, b, w, h = pos.bounds
-cax = P.axes([l, b-0.05, w, 0.025]) # setup colorbar axes
-P.colorbar(cax=cax,orientation='horizontal',ticks=MultipleLocator(320)) # draw colorbar
-P.axes(ax) # make the original axes current again
+cax = plt.axes([l, b-0.05, w, 0.025]) # setup colorbar axes
+plt.colorbar(cax=cax,orientation='horizontal',ticks=MultipleLocator(320)) # draw colorbar
+plt.axes(ax) # make the original axes current again
msh.drawcoastlines(linewidth=0.5)
msh.drawparallels(circles,labels=[1,0,0,0])
msh.drawmeridians(meridians,labels=[1,0,0,1])
-P.title('SH 500 hPa Height (cm.Spectral)')
+plt.title('SH 500 hPa Height (cm.Spectral)')
# 2-panel plot, oriented horizontally, colorbar on right.
@@ -68,33 +70,33 @@
rcParams['figure.subplot.top'] = 0.85
# panel 1
-fig = P.figure()
+fig = plt.figure()
ax = fig.add_subplot(121)
CS = mnh.contour(xnh,ynh,hgt,15,linewidths=0.5,colors='k')
-CS = mnh.contourf(xnh,ynh,hgt,15,cmap=P.cm.RdBu)
+CS = mnh.contourf(xnh,ynh,hgt,15,cmap=plt.cm.RdBu)
# colorbar on right
pos = ax.get_position()
l, b, w, h = pos.bounds
-cax = P.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
-P.colorbar(cax=cax, ticks=MultipleLocator(160), format='%4i') # draw colorbar
-P.axes(ax) # make the original axes current again
+cax = plt.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
+plt.colorbar(cax=cax, ticks=MultipleLocator(160), format='%4i') # draw colorbar
+plt.axes(ax) # make the original axes current again
mnh.drawcoastlines(linewidth=0.5)
mnh.drawparallels(circles,labels=[1,0,0,0])
mnh.drawmeridians(meridians,labels=[1,0,0,1])
-P.title('NH 500 hPa Height (cm.RdBu)')
+plt.title('NH 500 hPa Height (cm.RdBu)')
# panel 2
ax = fig.add_subplot(122)
CS = msh.contour(xsh,ysh,hgt,15,linewidths=0.5,colors='k')
-CS = msh.contourf(xsh,ysh,hgt,15,cmap=P.cm.RdBu)
+CS = msh.contourf(xsh,ysh,hgt,15,cmap=plt.cm.RdBu)
# colorbar on right.
pos = ax.get_position()
l, b, w, h = pos.bounds
-cax = P.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
-P.colorbar(cax=cax, ticks=MultipleLocator(160), format='%4i') # draw colorbar
-P.axes(ax) # make the original axes current again
+cax = plt.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
+plt.colorbar(cax=cax, ticks=MultipleLocator(160), format='%4i') # draw colorbar
+plt.axes(ax) # make the original axes current again
msh.drawcoastlines(linewidth=0.5)
msh.drawparallels(circles,labels=[1,0,0,0])
msh.drawmeridians(meridians,labels=[1,0,0,1])
-P.title('SH 500 hPa Height (cm.RdBu)')
-P.show()
+plt.title('SH 500 hPa Height (cm.RdBu)')
+plt.show()
Modified: trunk/toolkits/basemap/examples/plot_tissot.py
===================================================================
--- trunk/toolkits/basemap/examples/plot_tissot.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/plot_tissot.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -1,4 +1,5 @@
-import pylab as p
+import numpy as np
+import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
from matplotlib.patches import Polygon
@@ -13,44 +14,44 @@
# adapted from http://www.perrygeo.net/wordpress/?p=4
# create new figure
-fig=p.figure()
+fig=plt.figure()
m = Basemap(llcrnrlon=-180,llcrnrlat=-80,urcrnrlon=180,urcrnrlat=80,
projection='cyl')
shp_info = m.readshapefile('tissot','tissot',drawbounds=True)
-ax = p.gca()
+ax = plt.gca()
for nshape,seg in enumerate(m.tissot):
poly = Polygon(seg,facecolor='green',zorder=10)
ax.add_patch(poly)
# draw meridians and parallels.
-m.drawparallels(p.arange(-90,91,30),labels=[1,0,0,0])
-m.drawmeridians(p.arange(-180,180,60),labels=[0,0,0,1])
+m.drawparallels(np.arange(-90,91,30),labels=[1,0,0,0])
+m.drawmeridians(np.arange(-180,180,60),labels=[0,0,0,1])
m.drawcoastlines()
m.fillcontinents()
-p.title('Tissot Diagram - Cylindrical Equal Area')
+plt.title('Tissot Diagram - Cylindrical Equal Area')
print 'plot Cylindrical Equidistant Equal Area Tissot diagram ...'
# create new figure
-fig=p.figure()
+fig=plt.figure()
m = Basemap(llcrnrlon=-180,llcrnrlat=-70,urcrnrlon=180,urcrnrlat=70,
projection='merc',lat_ts=20)
shp_info = m.readshapefile('tissot','tissot',drawbounds=True)
-ax = p.gca()
+ax = plt.gca()
for nshape,seg in enumerate(m.tissot):
poly = Polygon(seg,facecolor='green',zorder=10)
ax.add_patch(poly)
# draw meridians and parallels.
-m.drawparallels(p.arange(-90,91,30),labels=[1,0,0,0])
-m.drawmeridians(p.arange(-180,180,60),labels=[0,0,0,1])
+m.drawparallels(np.arange(-90,91,30),labels=[1,0,0,0])
+m.drawmeridians(np.arange(-180,180,60),labels=[0,0,0,1])
m.drawcoastlines()
m.fillcontinents()
-p.title('Tissot Diagram - Mercator Conformal')
+plt.title('Tissot Diagram - Mercator Conformal')
print 'plot Mercator Conformal Tissot diagram ...'
# create new figure
-fig=p.figure()
+fig=plt.figure()
m = Basemap(lon_0=-60,lat_0=45,projection='ortho')
shp_info = m.readshapefile('tissot','tissot',drawbounds=False)
-ax = p.gca()
+ax = plt.gca()
for nshape,seg in enumerate(m.tissot):
xx,yy = zip(*seg)
if max(xx) < 1.e20 and max(yy) < 1.e20:
@@ -58,42 +59,42 @@
ax.add_patch(poly)
m.drawcoastlines()
m.fillcontinents()
-m.drawparallels(p.arange(-90,91,30))
-m.drawmeridians(p.arange(-180,180,30))
-p.title('Tissot Diagram - Orthographic')
+m.drawparallels(np.arange(-90,91,30))
+m.drawmeridians(np.arange(-180,180,30))
+plt.title('Tissot Diagram - Orthographic')
m.drawmapboundary()
-p.gca().set_frame_on(True)
+plt.gca().set_frame_on(True)
print 'plot Orthographic Tissot diagram ...'
# create new figure
-fig=p.figure()
+fig=plt.figure()
m = Basemap(lon_0=270,lat_0=90,boundinglat=10,projection='npstere')
shp_info = m.readshapefile('tissot','tissot',drawbounds=True)
-ax = p.gca()
+ax = plt.gca()
for nshape,seg in enumerate(m.tissot):
poly = Polygon(seg,facecolor='green',zorder=10)
ax.add_patch(poly)
# draw meridians and parallels.
-m.drawparallels(p.arange(-90,91,30),labels=[1,0,0,0])
-m.drawmeridians(p.arange(-180,180,30),labels=[0,0,0,1])
+m.drawparallels(np.arange(-90,91,30),labels=[1,0,0,0])
+m.drawmeridians(np.arange(-180,180,30),labels=[0,0,0,1])
m.drawcoastlines()
m.fillcontinents()
-p.title('Tissot Diagram - North Polar Stereographic Conformal')
+plt.title('Tissot Diagram - North Polar Stereographic Conformal')
print 'plot North Polar Stereographic Conformal Tissot diagram ...'
# create new figure
-fig=p.figure()
+fig=plt.figure()
m = Basemap(lon_0=270,lat_0=90,boundinglat=10,projection='nplaea')
shp_info = m.readshapefile('tissot','tissot',drawbounds=True)
-ax = p.gca()
+ax = plt.gca()
for nshape,seg in enumerate(m.tissot):
poly = Polygon(seg,facecolor='green',zorder=10)
ax.add_patch(poly)
# draw meridians and parallels.
-m.drawparallels(p.arange(-90,91,30),labels=[1,0,0,0])
-m.drawmeridians(p.arange(-180,180,30),labels=[0,0,0,1])
+m.drawparallels(np.arange(-90,91,30),labels=[1,0,0,0])
+m.drawmeridians(np.arange(-180,180,30),labels=[0,0,0,1])
m.drawcoastlines()
m.fillcontinents()
-p.title('Tissot Diagram - North Polar Lambert Azimuthal Equal Area')
+plt.title('Tissot Diagram - North Polar Lambert Azimuthal Equal Area')
print 'plot North Polar Lambert Azimuthal Equal Area Tissot diagram ...'
-p.show()
+plt.show()
Modified: trunk/toolkits/basemap/examples/plotprecip.py
===================================================================
--- trunk/toolkits/basemap/examples/plotprecip.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/plotprecip.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -1,5 +1,7 @@
from mpl_toolkits.basemap import Basemap, cm, NetCDFFile
-import pylab, copy
+import numpy as np
+import matplotlib.pyplot as plt
+import copy
from matplotlib import rcParams
# make tick labels smaller
@@ -29,20 +31,20 @@
llcrnrlon=loncorners[0],urcrnrlon=loncorners[2],\
rsphere=6371200.,resolution='l',area_thresh=10000)
# create figure
-fig = pylab.figure(figsize=(6,8.5))
-pylab.subplot(211)
-ax = pylab.gca()
+fig = plt.figure(figsize=(6,8.5))
+plt.subplot(211)
+ax = plt.gca()
# draw coastlines, state and country boundaries, edge of map.
m.drawcoastlines()
m.drawstates()
m.drawcountries()
# draw parallels.
delat = 10.0
-parallels = pylab.arange(0.,90,delat)
+parallels = np.arange(0.,90,delat)
m.drawparallels(parallels,labels=[1,0,0,0],fontsize=10)
# draw meridians
delon = 10.
-meridians = pylab.arange(180.,360.,delon)
+meridians = np.arange(180.,360.,delon)
m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=10)
ny = data.shape[0]; nx = data.shape[1]
lons, lats = m.makegrid(nx, ny) # get lat/lons of ny by nx evenly space grid.
@@ -53,15 +55,15 @@
# new axis for colorbar.
pos = ax.get_position()
l, b, w, h = pos.bounds
-cax = pylab.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
+cax = plt.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
# draw colorbar.
-pylab.colorbar(cs, cax, format='%g', ticks=clevs, drawedges=False)
-pylab.axes(ax) # make the original axes current again
+plt.colorbar(cs, cax, format='%g', ticks=clevs, drawedges=False)
+plt.axes(ax) # make the original axes current again
# plot title
-pylab.title(plottitle+'- contourf',fontsize=10)
+plt.title(plottitle+'- contourf',fontsize=10)
-pylab.subplot(212)
-ax = pylab.gca()
+plt.subplot(212)
+ax = plt.gca()
# draw coastlines, state and country boundaries, edge of map.
m.drawcoastlines()
m.drawstates()
@@ -79,15 +81,15 @@
# new axis for colorbar.
pos = ax.get_position()
l, b, w, h = pos.bounds
-cax = pylab.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
+cax = plt.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
# using im2, not im (hack to prevent colors from being
# too compressed at the low end on the colorbar - results
# from highly nonuniform colormap)
-pylab.colorbar(im2, cax, format='%d') # draw colorbar
-pylab.axes(ax) # make the original axes current again
+plt.colorbar(im2, cax, format='%d') # draw colorbar
+plt.axes(ax) # make the original axes current again
# reset colorbar tick labels (hack to get
-cax.set_yticks(pylab.linspace(0,1,len(clevs)))
+cax.set_yticks(np.linspace(0,1,len(clevs)))
cax.set_yticklabels(['%g' % clev for clev in clevs])
# plot title
-pylab.title(plottitle+' - imshow',fontsize=10)
-pylab.show() # display onscreen.
+plt.title(plottitle+' - imshow',fontsize=10)
+plt.show() # display onscreen.
Modified: trunk/toolkits/basemap/examples/plotsst.py
===================================================================
--- trunk/toolkits/basemap/examples/plotsst.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/plotsst.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -1,5 +1,7 @@
from mpl_toolkits.basemap import Basemap, NetCDFFile
-import pylab, numpy, sys
+import numpy as np
+import matplotlib.pyplot as plt
+import sys
# read in sea-surface temperature and ice data
# can be a local file, a URL for a remote opendap dataset,
# or (if PyNIO is installed) a GRIB or HDF file.
@@ -25,29 +27,29 @@
delat = lats[1]-lats[0]
lons = (lons - 0.5*delon).tolist()
lons.append(lons[-1]+delon)
-lons = numpy.array(lons,numpy.float64)
+lons = np.array(lons,np.float64)
lats = (lats - 0.5*delat).tolist()
lats.append(lats[-1]+delat)
-lats = numpy.array(lats,numpy.float64)
+lats = np.array(lats,np.float64)
# create Basemap instance for mollweide projection.
# coastlines not used, so resolution set to None to skip
# continent processing (this speeds things up a bit)
#m = Basemap(projection='ortho',lon_0=-110,lat_0=20,resolution=None)
m = Basemap(projection='moll',lon_0=lons.mean(),lat_0=0,resolution=None)
# compute map projection coordinates of grid.
-x, y = m(*numpy.meshgrid(lons, lats))
+x, y = m(*np.meshgrid(lons, lats))
# draw line around map projection limb.
# color background of map projection region.
# missing values over land will show up this color.
m.drawmapboundary(fill_color='0.3')
# plot ice, then with pcolor
-im1 = m.pcolor(x,y,sst,shading='flat',cmap=pylab.cm.jet)
-im2 = m.pcolor(x,y,ice,shading='flat',cmap=pylab.cm.gist_gray)
+im1 = m.pcolor(x,y,sst,shading='flat',cmap=plt.cm.jet)
+im2 = m.pcolor(x,y,ice,shading='flat',cmap=plt.cm.gist_gray)
# draw parallels and meridians, but don't bother labelling them.
-m.drawparallels(numpy.arange(-90.,120.,30.))
-m.drawmeridians(numpy.arange(0.,420.,60.))
+m.drawparallels(np.arange(-90.,120.,30.))
+m.drawmeridians(np.arange(0.,420.,60.))
# draw horizontal colorbar.
-pylab.colorbar(im1,orientation='horizontal')
+plt.colorbar(im1,orientation='horizontal')
# display the plot with a title.
-pylab.title('SST and ICE analysis for %s'%date)
-pylab.show()
+plt.title('SST and ICE analysis for %s'%date)
+plt.show()
Modified: trunk/toolkits/basemap/examples/pnganim.py
===================================================================
--- trunk/toolkits/basemap/examples/pnganim.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/pnganim.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -4,8 +4,9 @@
# reads data over http - needs an active internet connection.
-import numpy
-import pylab
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.mlab as mlab
from numpy import ma
import datetime, sys, time, subprocess
from mpl_toolkits.basemap import Basemap, shiftgrid, NetCDFFile, num2date
@@ -62,40 +63,40 @@
vin = vdata[ntime1:ntime2+1,0,:,:]
datelabels = dates[ntime1:ntime2+1]
# add cyclic points
-slp = numpy.zeros((slpin.shape[0],slpin.shape[1],slpin.shape[2]+1),numpy.float64)
+slp = np.zeros((slpin.shape[0],slpin.shape[1],slpin.shape[2]+1),np.float64)
slp[:,:,0:-1] = slpin; slp[:,:,-1] = slpin[:,:,0]
-u = numpy.zeros((uin.shape[0],uin.shape[1],uin.shape[2]+1),numpy.float64)
+u = np.zeros((uin.shape[0],uin.shape[1],uin.shape[2]+1),np.float64)
u[:,:,0:-1] = uin; u[:,:,-1] = uin[:,:,0]
-v = numpy.zeros((vin.shape[0],vin.shape[1],vin.shape[2]+1),numpy.float64)
+v = np.zeros((vin.shape[0],vin.shape[1],vin.shape[2]+1),np.float64)
v[:,:,0:-1] = vin; v[:,:,-1] = vin[:,:,0]
-longitudes.append(360.); longitudes = numpy.array(longitudes)
+longitudes.append(360.); longitudes = np.array(longitudes)
# make 2-d grid of lons, lats
-lons, lats = numpy.meshgrid(longitudes,latitudes)
+lons, lats = np.meshgrid(longitudes,latitudes)
print 'min/max slp,u,v'
print slp.min(), slp.max()
print uin.min(), uin.max()
print vin.min(), vin.max()
print 'dates'
print datelabels
-# make orthographic basemapylab.
+# make orthographic basemaplt.
m = Basemap(resolution='c',projection='ortho',lat_0=60.,lon_0=-60.)
-pylab.ion() # interactive mode on.
+plt.ion() # interactive mode on.
uin = udata[ntime1:ntime2+1,0,:,:]
vin = vdata[ntime1:ntime2+1,0,:,:]
datelabels = dates[ntime1:ntime2+1]
-# make orthographic basemapylab.
+# make orthographic basemaplt.
m = Basemap(resolution='c',projection='ortho',lat_0=60.,lon_0=-60.)
-pylab.ion() # interactive mode on.
+plt.ion() # interactive mode on.
# create figure, add axes (leaving room for colorbar on right)
-fig = pylab.figure()
+fig = plt.figure()
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# set desired contour levels.
-clevs = numpy.arange(960,1061,5)
+clevs = np.arange(960,1061,5)
# compute native x,y coordinates of grid.
x, y = m(lons, lats)
# define parallels and meridians to draw.
-parallels = numpy.arange(-80.,90,20.)
-meridians = numpy.arange(0.,360.,20.)
+parallels = np.arange(-80.,90,20.)
+meridians = np.arange(0.,360.,20.)
# number of repeated frames at beginning and end is n1.
nframe = 0; n1 = 10
pos = ax.get_position()
@@ -104,42 +105,42 @@
# parallels, meridians and title.
for nt,date in enumerate(datelabels[1:]):
CS = m.contour(x,y,slp[nt,:,:],clevs,linewidths=0.5,colors='k',animated=True)
- CS = m.contourf(x,y,slp[nt,:,:],clevs,cmap=pylab.cm.RdBu_r,animated=True)
+ CS = m.contourf(x,y,slp[nt,:,:],clevs,cmap=plt.cm.RdBu_r,animated=True)
# plot wind vectors on lat/lon grid.
# rotate wind vectors to map projection coordinates.
#urot,vrot = m.rotate_vector(u[nt,:,:],v[nt,:,:],lons,lats)
- # plot wind vectors over mapylab.
+ # plot wind vectors over maplt.
#Q = m.quiver(x,y,urot,vrot,scale=500)
# plot wind vectors on projection grid (looks better).
# first, shift grid so it goes from -180 to 180 (instead of 0 to 360
- # in longitude). Otherwise, interpolation is messed upylab.
+ # in longitude). Otherwise, interpolation is messed uplt.
ugrid,newlons = shiftgrid(180.,u[nt,:,:],longitudes,start=False)
vgrid,newlons = shiftgrid(180.,v[nt,:,:],longitudes,start=False)
# transform vectors to projection grid.
urot,vrot,xx,yy = m.transform_vector(ugrid,vgrid,newlons,latitudes,51,51,returnxy=True,masked=True)
- # plot wind vectors over mapylab.
+ # plot wind vectors over maplt.
Q = m.quiver(xx,yy,urot,vrot,scale=500)
# make quiver key.
- qk = pylab.quiverkey(Q, 0.1, 0.1, 20, '20 m/s', labelpos='W')
+ qk = plt.quiverkey(Q, 0.1, 0.1, 20, '20 m/s', labelpos='W')
# draw coastlines, parallels, meridians, title.
m.drawcoastlines(linewidth=1.5)
m.drawparallels(parallels)
m.drawmeridians(meridians)
- pylab.title('SLP and Wind Vectors '+date)
+ plt.title('SLP and Wind Vectors '+date)
if nt == 0: # plot colorbar on a separate axes (only for first frame)
- cax = pylab.axes([l+w-0.05, b, 0.03, h]) # setup colorbar axes
+ cax = plt.axes([l+w-0.05, b, 0.03, h]) # setup colorbar axes
fig.colorbar(CS,drawedges=True, cax=cax) # draw colorbar
cax.text(0.0,-0.05,'mb')
- pylab.axes(ax) # reset current axes
- pylab.draw() # draw the plot
+ plt.axes(ax) # reset current axes
+ plt.draw() # draw the plot
# save first and last frame n1 times
# (so gif animation pauses at beginning and end)
if nframe == 0 or nt == slp.shape[0]-1:
for n in range(n1):
- pylab.savefig('anim%03i'%nframe+'.png')
+ plt.savefig('anim%03i'%nframe+'.png')
nframe = nframe + 1
else:
- pylab.savefig('anim%03i'%nframe+'.png')
+ plt.savefig('anim%03i'%nframe+'.png')
nframe = nframe + 1
ax.clear() # clear the axes for the next plot.
Modified: trunk/toolkits/basemap/examples/polarmaps.py
===================================================================
--- trunk/toolkits/basemap/examples/polarmaps.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/polarmaps.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -6,17 +6,18 @@
# illustrates special-case polar-centric projections.
from mpl_toolkits.basemap import Basemap
-from pylab import title, colorbar, show, axes, cm, load, arange, \
- figure, ravel, meshgrid
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.mlab as mlab
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
-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')
print 'min/max etopo20 data:'
-print min(ravel(etopo)),max(ravel(etopo))
+print etopo.min(),etopo.max()
# these are the 4 polar projections
projs = ['laea','stere','aeqd','ortho'] # short names
@@ -36,7 +37,7 @@
lat_0 = 90.
bounding_lat = 20.
# loop over projections, one for each panel of the figure.
- fig = figure(figsize=(8,8))
+ fig = plt.figure(figsize=(8,8))
npanel = 0
for proj,projname in zip(projs,projnames):
npanel = npanel + 1
@@ -53,18 +54,18 @@
m = Basemap(boundinglat=bounding_lat,lon_0=lon_0,\
resolution='c',area_thresh=10000.,projection=projection)
# compute native map projection coordinates for lat/lon grid.
- x,y = m(*meshgrid(lons,lats))
+ x,y = m(*np.meshgrid(lons,lats))
ax = fig.add_subplot(2,2,npanel)
# make filled contour plot.
- cs = m.contourf(x,y,etopo,20,cmap=cm.jet)
+ cs = m.contourf(x,y,etopo,20,cmap=plt.cm.jet)
# draw coastlines.
m.drawcoastlines()
# draw parallels and meridians.
- m.drawparallels(arange(-80.,90,20.))
- m.drawmeridians(arange(0.,360.,60.))
+ m.drawparallels(np.arange(-80.,90,20.))
+ m.drawmeridians(np.arange(0.,360.,60.))
# draw boundary around map region.
m.drawmapboundary()
# draw title.
- title(hem+' Polar '+projname,y=1.05,fontsize=12)
+ plt.title(hem+' Polar '+projname,y=1.05,fontsize=12)
print 'plotting '+hem+' Polar '+projname+' basemap ...'
-show()
+plt.show()
Modified: trunk/toolkits/basemap/examples/setwh.py
===================================================================
--- trunk/toolkits/basemap/examples/setwh.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/setwh.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -2,7 +2,8 @@
# to the Basemap constructor.
from mpl_toolkits.basemap import Basemap
-from pylab import arange, show, title, figure
+import numpy as np
+import matplotlib.pyplot as plt
# setup projection parameters
lat_0 = 40.
@@ -10,14 +11,14 @@
width = 6000000.
height = 2.*width/3.
delat = 25.
-circles = arange(0.,90.+delat,delat).tolist()+\
- arange(-delat,-90.-delat,-delat).tolist()
+circles = np.arange(0.,90.+delat,delat).tolist()+\
+ np.arange(-delat,-90.-delat,-delat).tolist()
delon = 30.
-meridians = arange(10.,360.,delon)
+meridians = np.arange(10.,360.,delon)
npanel = 0
# plots of the US.
projs = ['lcc','aeqd','aea','laea','eqdc','stere']
-fig = figure(figsize=(7,7))
+fig = plt.figure(figsize=(7,7))
for proj in projs:
m = Basemap(width=width,height=height,
resolution='c',projection=proj,\
@@ -30,6 +31,6 @@
m.drawstates()
m.drawparallels(circles)
m.drawmeridians(meridians)
- title('proj = '+proj+' centered on %sW, %sN' % (lon_0,lat_0),fontsize=10)
+ plt.title('proj = '+proj+' centered on %sW, %sN' % (lon_0,lat_0),fontsize=10)
-show()
+plt.show()
Modified: trunk/toolkits/basemap/examples/show_colormaps.py
===================================================================
--- trunk/toolkits/basemap/examples/show_colormaps.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/show_colormaps.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -1,16 +1,17 @@
-import numpy, pylab
+import numpy as np
+import matplotlib.pyplot as plt
from mpl_toolkits.basemap import cm
-a=numpy.outer(numpy.arange(0,1,0.01),numpy.ones(10))
-pylab.figure(figsize=(10,7))
-pylab.subplots_adjust(top=0.8,bottom=0.05,left=0.01,right=0.99)
+a=np.outer(np.arange(0,1,0.01),np.ones(10))
+plt.figure(figsize=(10,7))
+plt.subplots_adjust(top=0.8,bottom=0.05,left=0.01,right=0.99)
maps=[m for m in cm.datad.keys() if not m.endswith("_r")]
maps.sort()
l=len(maps)+1
i=1
for m in maps:
- pylab.subplot(1,l,i)
- pylab.axis("off")
- pylab.imshow(a,aspect='auto',cmap=cm.__dict__[m],origin="lower")
- pylab.title(m,rotation=90,fontsize=10)
+ plt.subplot(1,l,i)
+ plt.axis("off")
+ plt.imshow(a,aspect='auto',cmap=cm.__dict__[m],origin="lower")
+ plt.title(m,rotation=90,fontsize=10)
i=i+1
-pylab.show()
+plt.show()
Modified: trunk/toolkits/basemap/examples/testgdal.py
===================================================================
--- trunk/toolkits/basemap/examples/testgdal.py 2008-05-20 11:52:12 UTC (rev 5196)
+++ trunk/toolkits/basemap/examples/testgdal.py 2008-05-20 12:22:09 UTC (rev 5197)
@@ -3,13 +3,14 @@
gdal (http://gdal.maptools.org).
Data files must be downloaded manually from USGS:
-http://edcftp.cr.usgs.gov/pub/data/DEM/250/D/denver-w.gz
-http://edcftp.cr.usgs.gov/pub/data/nationalatlas/countyp020.tar.gz
+http://edcftplt.cr.usgs.gov/pub/data/DEM/250/D/denver-w.gz
+http://edcftplt.cr.usgs.gov/pub/data/nationalatlas/countyp020.tar.gz
"""
import gdal
from mpl_toolkits.basemap import Basemap
from gdalconst import *
-import pylab as p
+import numpy as np
+import matplotlib.pyplot as plt
# download from
# http://edcftp.cr.usgs.gov/pub/data/DEM/250/D/denver-w.gz
@@ -26,17 +27,17 @@
m = Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,projection='cyl')
# create a figure, add an axes
# (leaving room for a colorbar).
-fig = p.figure()
+fig = plt.figure()
ax = fig.add_axes([0.1,0.1,0.75,0.75])
# plot image from DEM over map.
im = m.imshow(array,origin='upper')
# make a colorbar.
-cax = p.axes([0.875, 0.1, 0.05, 0.75]) # setup colorbar axes.
-p.colorbar(cax=cax) # draw colorbar
-p.axes(ax) # make the original axes current again
+cax = plt.axes([0.875, 0.1, 0.05, 0.75]) # setup colorbar axes.
+plt.colorbar(cax=cax) # draw colorbar
+plt.axes(ax) # make the original axes current again
# draw meridians and parallels.
-m.drawmeridians(p.linspace(llcrnrlon+0.1,urcrnrlon-0.1,5),labels=[0,0,0,1],fmt='%4.2f')
-m.drawparallels(p.linspace(llcrnrlat+0.1,urcrnrlat-0.1,5),labels=[1,0,0,0],fmt='%4.2f')
+m.drawmeridians(np.linspace(llcrnrlon+0.1,urcrnrlon-0.1,5),labels=[0,0,0,1],fmt='%4.2f')
+m.drawparallels(np.linspace(llcrnrlat+0.1,urcrnrlat-0.1,5),labels=[1,0,0,0],fmt='%4.2f')
# plot county boundaries from
# http://edcftp.cr.usgs.gov/pub/data/nationalatlas/countyp020.tar.gz
shp_info = m.readshapefile('countyp020','counties',drawbounds=True,linewidth=1.0)
@@ -46,6 +47,6 @@
x,y = m(lons,lats)
m.plot(x,y,'ko')
for name,xx,yy in zip(names,x,y):
- p.text(xx+0.01,yy+0.01,name)
-p.title(gd.GetDescription()+' USGS DEM with county boundaries')
-p.show()
+ plt.text(xx+0.01,yy+0.01,name)
+plt.title(gd.GetDescription()+' USGS DEM with county boundaries')
+plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-20 11:52:18
|
Revision: 5196
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5196&view=rev
Author: jswhit
Date: 2008-05-20 04:52:12 -0700 (Tue, 20 May 2008)
Log Message:
-----------
convert more examples to numpy/pyplot namespace
Modified Paths:
--------------
trunk/toolkits/basemap/examples/README
trunk/toolkits/basemap/examples/customticks.py
trunk/toolkits/basemap/examples/fcstmaps.py
trunk/toolkits/basemap/examples/geos_demo.py
trunk/toolkits/basemap/examples/geos_demo_2.py
trunk/toolkits/basemap/examples/geos_demo_3.py
trunk/toolkits/basemap/examples/hires.py
trunk/toolkits/basemap/examples/nytolondon.py
trunk/toolkits/basemap/examples/ortho_demo.py
trunk/toolkits/basemap/examples/plotcities.py
trunk/toolkits/basemap/examples/quiver_demo.py
trunk/toolkits/basemap/examples/randompoints.py
Modified: trunk/toolkits/basemap/examples/README
===================================================================
--- trunk/toolkits/basemap/examples/README 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/README 2008-05-20 11:52:12 UTC (rev 5196)
@@ -52,6 +52,9 @@
from a jpeg file, then plot only a portion of the full earth (contributed
by Scott Sinclair, requires PIL).
+geos_demo_3.py shows how to make a regional geostationary or orthographic
+plot, where part of the region is outside the projection limb.
+
fcstmaps.py is a sample multi-panel plot that accesses
data over http using the dap module. An internet connection is required.
Modified: trunk/toolkits/basemap/examples/customticks.py
===================================================================
--- trunk/toolkits/basemap/examples/customticks.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/customticks.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,37 +1,38 @@
from mpl_toolkits.basemap import Basemap
-import pylab, numpy
+import numpy as np
+import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
# example showing how to create custom tick labels for a cylindrical
# projection.
def lat2str(deg):
- min = 60 * (deg - numpy.floor(deg))
- deg = numpy.floor(deg)
+ min = 60 * (deg - np.floor(deg))
+ deg = np.floor(deg)
dir = 'N'
if deg < 0:
if min != 0.0:
deg += 1.0
min -= 60.0
dir = 'S'
- return (u"%d\N{DEGREE SIGN} %g' %s") % (numpy.abs(deg),numpy.abs(min),dir)
+ return (u"%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
def lon2str(deg):
- min = 60 * (deg - numpy.floor(deg))
- deg = numpy.floor(deg)
+ min = 60 * (deg - np.floor(deg))
+ deg = np.floor(deg)
dir = 'E'
if deg < 0:
if min != 0.0:
deg += 1.0
min -= 60.0
dir = 'W'
- return (u"%d\N{DEGREE SIGN} %g' %s") % (numpy.abs(deg),numpy.abs(min),dir)
+ return (u"%d\N{DEGREE SIGN} %g' %s") % (np.abs(deg),np.abs(min),dir)
# (1) use matplotlib custom tick formatter
# instead of Basemap labelling methods.
# create figure.
-fig=pylab.figure()
+fig=plt.figure()
# create Basemap instance (regular lat/lon projection).
# suppress_ticks=False allows custom axes ticks to be used
# Ticks are suppressed by default, so Basemap methods
@@ -44,7 +45,7 @@
# background color will be used for oceans.
m.drawmapboundary(fill_color='aqua')
# get axes instance.
-ax = pylab.gca()
+ax = plt.gca()
# add custom ticks.
# This only works for projection='cyl'.
def xformat(x, pos=None): return lon2str(x)
@@ -62,7 +63,7 @@
# custom formatting function with the 'fmt' keyword.
# create figure.
-fig = pylab.figure()
+fig = plt.figure()
# create Basemap instance.
m = Basemap(llcrnrlon=-156.5,llcrnrlat=18.75,urcrnrlon=-154.5,urcrnrlat=20.5,
resolution='h',projection='cyl')
@@ -73,8 +74,8 @@
m.drawmapboundary(fill_color='aqua')
# label meridians and parallels, passing string formatting function
# with 'fmt' keyword.
-m.drawparallels(numpy.linspace(18,21,7),labels=[1,0,0,0],fmt=lat2str,dashes=[2,2])
-m.drawmeridians(numpy.linspace(-157,-154,7),labels=[0,0,0,1],fmt=lon2str,dashes=[2,2])
-pylab.title('Hawaii')
+m.drawparallels(np.linspace(18,21,7),labels=[1,0,0,0],fmt=lat2str,dashes=[2,2])
+m.drawmeridians(np.linspace(-157,-154,7),labels=[0,0,0,1],fmt=lon2str,dashes=[2,2])
+plt.title('Hawaii')
-pylab.show()
+plt.show()
Modified: trunk/toolkits/basemap/examples/fcstmaps.py
===================================================================
--- trunk/toolkits/basemap/examples/fcstmaps.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/fcstmaps.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,8 +1,7 @@
# this example reads today's numerical weather forecasts
# from the NOAA OpenDAP servers and makes a multi-panel plot.
-from pylab import title, show, figure, cm, figtext, \
- meshgrid, axes, colorbar
-import numpy
+import numpy as np
+import matplotlib.pyplot as plt
import sys
from numpy import ma
import datetime
@@ -57,7 +56,7 @@
t2mvar = data.variables['tmp2m']
t2min = t2mvar[0:ntimes,:,:]
-t2m = numpy.zeros((ntimes,nlats,nlons+1),t2min.dtype)
+t2m = np.zeros((ntimes,nlats,nlons+1),t2min.dtype)
# create Basemap instance for Orthographic projection.
m = Basemap(lon_0=-90,lat_0=60,projection='ortho')
# add wrap-around point in longitude.
@@ -66,25 +65,26 @@
# convert to celsius.
t2m = t2m-273.15
# contour levels
-clevs = numpy.arange(-30,30.1,2.)
-lons, lats = meshgrid(lons, lats)
+clevs = np.arange(-30,30.1,2.)
+lons, lats = np.meshgrid(lons, lats)
x, y = m(lons, lats)
# create figure.
-fig=figure(figsize=(6,8))
+fig=plt.figure(figsize=(6,8))
# make subplots.
for nt,fcsthr in enumerate(fcsthrs):
ax = fig.add_subplot(321+nt)
- cs = m.contourf(x,y,t2m[nt,:,:],clevs,cmap=cm.jet,extend='both')
+ cs = m.contourf(x,y,t2m[nt,:,:],clevs,cmap=plt.cm.jet,extend='both')
m.drawcoastlines(linewidth=0.5)
m.drawcountries()
- m.drawparallels(numpy.arange(-80,81,20))
- m.drawmeridians(numpy.arange(0,360,20))
+ m.drawparallels(np.arange(-80,81,20))
+ m.drawmeridians(np.arange(0,360,20))
# panel title
- title('%d-h forecast valid '%fcsthr+verifdates[nt],fontsize=9)
+ plt.title('%d-h forecast valid '%fcsthr+verifdates[nt],fontsize=9)
# figure title
-figtext(0.5,0.95,u"2-m temp (\N{DEGREE SIGN}C) forecasts from %s"%verifdates[0],
- horizontalalignment='center',fontsize=14)
+plt.figtext(0.5,0.95,
+ u"2-m temp (\N{DEGREE SIGN}C) forecasts from %s"%verifdates[0],
+ horizontalalignment='center',fontsize=14)
# a single colorbar.
-cax = axes([0.1, 0.03, 0.8, 0.025])
-colorbar(cax=cax, orientation='horizontal')
-show()
+cax = plt.axes([0.1, 0.03, 0.8, 0.025])
+plt.colorbar(cax=cax, orientation='horizontal')
+plt.show()
Modified: trunk/toolkits/basemap/examples/geos_demo.py
===================================================================
--- trunk/toolkits/basemap/examples/geos_demo.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/geos_demo.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,11 +1,12 @@
from mpl_toolkits.basemap import Basemap
-from pylab import title, show, arange, figure
+import numpy as np
+import matplotlib.pyplot as plt
# create Basemap instance for Geostationary (satellite view) projection.
lon_0 = float(raw_input('enter reference longitude (lon_0):'))
# map with land/sea mask plotted
-fig=figure()
+fig=plt.figure()
m = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution=None)
# plot land-sea mask.
rgba_land = (0,255,0,255) # land green.
@@ -13,21 +14,21 @@
# lakes=True means plot inland lakes with ocean color.
m.drawlsmask(rgba_land, rgba_ocean, lakes=True)
# draw parallels and meridians.
-m.drawparallels(arange(-90.,120.,30.))
-m.drawmeridians(arange(0.,420.,60.))
+m.drawparallels(np.arange(-90.,120.,30.))
+m.drawmeridians(np.arange(0.,420.,60.))
m.drawmapboundary()
-title('Geostationary Map Centered on Lon=%s' % (lon_0))
+plt.title('Geostationary Map Centered on Lon=%s' % (lon_0))
# map with continents drawn and filled.
-fig = figure()
+fig = plt.figure()
m = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution='l')
m.drawcoastlines()
m.drawmapboundary(fill_color='aqua')
m.fillcontinents(color='coral',lake_color='aqua')
m.drawcountries()
# draw parallels and meridians.
-m.drawparallels(arange(-90.,120.,30.))
-m.drawmeridians(arange(0.,420.,60.))
+m.drawparallels(np.arange(-90.,120.,30.))
+m.drawmeridians(np.arange(0.,420.,60.))
m.drawmapboundary()
-title('Geostationary Map Centered on Lon=%s' % (lon_0))
-show()
+plt.title('Geostationary Map Centered on Lon=%s' % (lon_0))
+plt.show()
Modified: trunk/toolkits/basemap/examples/geos_demo_2.py
===================================================================
--- trunk/toolkits/basemap/examples/geos_demo_2.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/geos_demo_2.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -10,7 +10,8 @@
"""
from PIL import Image
from mpl_toolkits.basemap import Basemap
-from pylab import figure, cm, arange, colorbar, text, savefig, gcf, clim, title, show
+import numpy as np
+import matplotlib.pyplot as plt
from matplotlib.image import pil_to_array
plot_name = 'geos_demo.png'
@@ -30,25 +31,25 @@
lon_0 = 0.0
satellite_height = 35785831.0
-fig = figure(figsize=(7,7))
+fig = plt.figure(figsize=(7,7))
ax = fig.add_axes((0.1,0.1,0.8,0.8))
# create Basemap instance for a Geostationary projection.
m = Basemap(projection='geos', lon_0=lon_0, satellite_height=satellite_height,
resolution='l', llcrnrlon=ll_lon, llcrnrlat=ll_lat, urcrnrlon=ur_lon, urcrnrlat=ur_lat)
# add data
-m.imshow(data, cmap=cm.gray, interpolation='nearest')
-clim(0, 255)
+m.imshow(data, cmap=plt.cm.gray, interpolation='nearest')
+plt.clim(0, 255)
# draw coastlines.
m.drawcoastlines(linewidth=0.5, color=overlay_color)
m.drawcountries(linewidth=0.5, color=overlay_color)
# can't label meridians on bottom, because labels would
# be outside map projection region.
-m.drawmeridians(arange(10,76,5), labels=[0,0,1,0], color=overlay_color)
-m.drawparallels(arange(-90,90,5), labels=[1,0,0,0], color=overlay_color)
+m.drawmeridians(np.arange(10,76,5), labels=[0,0,1,0], color=overlay_color)
+m.drawparallels(np.arange(-90,90,5), labels=[1,0,0,0], color=overlay_color)
# add a colobar
-#colorbar()
+#plt.colorbar()
# add timestamp and save
-fig = gcf()
+fig = plt.gcf()
fig.text(x=0.275, y=0.025, s=u'Meteosat-9 VIS 0.6 channel - 12:00 UTC 04/06/2007\n \N{COPYRIGHT SIGN} EUMETSAT 2007',
horizontalalignment='left',
verticalalignment='bottom',
@@ -56,8 +57,8 @@
fontweight='bold',
bbox=dict(facecolor='gray', alpha=0.25, pad=15))
fig.set_size_inches((8, 6))
-title('Meteosat Geostationary Satellite Image - Portion of Full Earth',y=1.05,fontsize=12)
+plt.title('Meteosat Geostationary Satellite Image - Portion of Full Earth',y=1.05,fontsize=12)
-show()
+plt.show()
#fig.savefig(plot_name)
#print 'Plot saved to %s' % (plot_name)
Modified: trunk/toolkits/basemap/examples/geos_demo_3.py
===================================================================
--- trunk/toolkits/basemap/examples/geos_demo_3.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/geos_demo_3.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,7 +1,8 @@
from mpl_toolkits.basemap import Basemap
-from pylab import title, show, arange, figure
+import numpy as np
+import matplotlib.pyplot as plt
-fig = figure()
+fig = plt.figure()
lon_0=57
# global geos map
m1 = Basemap(projection='geos',lon_0=lon_0,rsphere=(6378137.00,6356752.3142),resolution=None)
@@ -13,12 +14,12 @@
m.fillcontinents(color='coral',lake_color='aqua')
m.drawcountries()
# draw parallels and meridians.
-m.drawparallels(arange(-90.,120.,30.))
-m.drawmeridians(arange(0.,420.,60.))
+m.drawparallels(np.arange(-90.,120.,30.))
+m.drawmeridians(np.arange(0.,420.,60.))
m.drawmapboundary()
-title('Geostationary Map Centered on Lon=%s' % lon_0)
+plt.title('Geostationary Map Centered on Lon=%s' % lon_0)
-fig = figure()
+fig = plt.figure()
# global ortho map
lat_0=10.
m1 = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution=None)
@@ -30,9 +31,9 @@
m.fillcontinents(color='coral',lake_color='aqua')
m.drawcountries()
# draw parallels and meridians.
-m.drawparallels(arange(-90.,120.,30.))
-m.drawmeridians(arange(0.,420.,60.))
+m.drawparallels(np.arange(-90.,120.,30.))
+m.drawmeridians(np.arange(0.,420.,60.))
m.drawmapboundary()
-title('Orthographic Map Centered on Lon=%s, Lat=%s' % (lon_0,lat_0))
+plt.title('Orthographic Map Centered on Lon=%s, Lat=%s' % (lon_0,lat_0))
-show()
+plt.show()
Modified: trunk/toolkits/basemap/examples/hires.py
===================================================================
--- trunk/toolkits/basemap/examples/hires.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/hires.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,16 +1,17 @@
from mpl_toolkits.basemap import Basemap
-from pylab import show, title, arange, figure, clf
+import numpy as np
+import matplotlib.pyplot as plt
import cPickle, time
# create figure with aqua background (will be oceans)
-fig = figure()
+fig = plt.figure()
# create Basemap instance. Use 'high' resolution coastlines.
t1 = time.clock()
#m = Basemap(llcrnrlon=-10.5,llcrnrlat=49.5,urcrnrlon=3.5,urcrnrlat=59.5,
# resolution='h',projection='tmerc',lon_0=-4,lat_0=0)
m = Basemap(width=920000,height=1100000,
- resolution='h',projection='tmerc',lon_0=-4.2,lat_0=54.6)
+ resolution='f',projection='tmerc',lon_0=-4.2,lat_0=54.6)
# make sure countries and rivers are loaded
m.drawcountries()
m.drawrivers()
@@ -20,7 +21,7 @@
cPickle.dump(m,open('map.pickle','wb'),-1)
# clear the figure
-clf()
+plt.clf()
# read cPickle back in and plot it again (should be much faster).
t1 = time.clock()
m2 = cPickle.load(open('map.pickle','rb'))
@@ -37,10 +38,10 @@
m.drawrivers(color='b')
print time.clock()-t1,' secs to plot using using a pickled Basemap instance'
# draw parallels
-circles = arange(48,65,2).tolist()
+circles = np.arange(48,65,2).tolist()
m.drawparallels(circles,labels=[1,1,0,0])
# draw meridians
-meridians = arange(-12,13,2)
+meridians = np.arange(-12,13,2)
m.drawmeridians(meridians,labels=[0,0,1,1])
-title("High-Res British Isles",y=1.04)
-show()
+plt.title("High-Res British Isles",y=1.04)
+plt.show()
Modified: trunk/toolkits/basemap/examples/nytolondon.py
===================================================================
--- trunk/toolkits/basemap/examples/nytolondon.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/nytolondon.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,10 +1,11 @@
# example demonstrating how to draw a great circle on a map.
from mpl_toolkits.basemap import Basemap
-from pylab import title, arange, show, figure
+import numpy as np
+import matplotlib.pyplot as plt
# setup lambert azimuthal map projection.
# create new figure
-fig=figure()
+fig=plt.figure()
m = Basemap(llcrnrlon=-100.,llcrnrlat=20.,urcrnrlon=20.,urcrnrlat=60.,\
rsphere=(6378137.00,6356752.3142),\
resolution='c',area_thresh=10000.,projection='merc',\
@@ -24,16 +25,16 @@
m.drawcoastlines()
m.fillcontinents()
# draw parallels
-circles = arange(10,90,20)
+circles = np.arange(10,90,20)
m.drawparallels(circles,labels=[1,1,0,1])
# draw meridians
-meridians = arange(-180,180,30)
+meridians = np.arange(-180,180,30)
m.drawmeridians(meridians,labels=[1,1,0,1])
-title('Great Circle from New York to London (Mercator)')
+plt.title('Great Circle from New York to London (Mercator)')
print 'plotting Great Circle from New York to London (Mercator)'
# create new figure
-fig=figure()
+fig=plt.figure()
# setup a gnomonic projection.
m = Basemap(llcrnrlon=-100.,llcrnrlat=20.,urcrnrlon=20.,urcrnrlat=60.,\
resolution='c',area_thresh=10000.,projection='gnom',\
@@ -53,11 +54,11 @@
m.drawcoastlines()
m.fillcontinents()
# draw parallels
-circles = arange(10,90,20)
+circles = np.arange(10,90,20)
m.drawparallels(circles,labels=[0,1,0,0])
# draw meridians
-meridians = arange(-180,180,30)
+meridians = np.arange(-180,180,30)
m.drawmeridians(meridians,labels=[1,1,0,1])
-title('Great Circle from New York to London (Gnomonic)')
+plt.title('Great Circle from New York to London (Gnomonic)')
print 'plotting Great Circle from New York to London (Gnomonic)'
-show()
+plt.show()
Modified: trunk/toolkits/basemap/examples/ortho_demo.py
===================================================================
--- trunk/toolkits/basemap/examples/ortho_demo.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/ortho_demo.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,12 +1,13 @@
from mpl_toolkits.basemap import Basemap
-from pylab import title, show, arange, figure
+import numpy as np
+import matplotlib.pyplot as plt
# create Basemap instance for Orthographic (satellite view) projection.
lon_0 = float(raw_input('enter reference longitude (lon_0):'))
lat_0 = float(raw_input('enter reference latitude (lat_0):'))
# map with land/sea mask plotted
-fig = figure()
+fig = plt.figure()
m = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution=None)
# plot land-sea mask.
rgba_land = (0,255,0,255) # land green.
@@ -14,20 +15,20 @@
# lakes=True means plot inland lakes with ocean color.
m.drawlsmask(rgba_land, rgba_ocean, lakes=True)
# draw parallels and meridians.
-m.drawparallels(arange(-90.,120.,30.))
-m.drawmeridians(arange(0.,420.,60.))
+m.drawparallels(np.arange(-90.,120.,30.))
+m.drawmeridians(np.arange(0.,420.,60.))
m.drawmapboundary()
-title('Orthographic Map Centered on Lon=%s, Lat=%s' % (lon_0,lat_0))
+plt.title('Orthographic Map Centered on Lon=%s, Lat=%s' % (lon_0,lat_0))
# map with continents drawn and filled.
-fig = figure()
+fig = plt.figure()
m = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution='l')
m.drawcoastlines()
m.fillcontinents(color='coral',lake_color='aqua')
m.drawcountries()
# draw parallels and meridians.
-m.drawparallels(arange(-90.,120.,30.))
-m.drawmeridians(arange(0.,420.,60.))
+m.drawparallels(np.arange(-90.,120.,30.))
+m.drawmeridians(np.arange(0.,420.,60.))
m.drawmapboundary(fill_color='aqua')
# add a map scale.
length = 5000
@@ -35,5 +36,5 @@
lon1,lat1 = m(x1,y1,inverse=True)
m.drawmapscale(lon1,lat1,lon_0,lat_0,length,fontsize=8,barstyle='fancy',\
labelstyle='fancy',units='km')
-title('Orthographic Map Centered on Lon=%s, Lat=%s' % (lon_0,lat_0))
-show()
+plt.title('Orthographic Map Centered on Lon=%s, Lat=%s' % (lon_0,lat_0))
+plt.show()
Modified: trunk/toolkits/basemap/examples/plotcities.py
===================================================================
--- trunk/toolkits/basemap/examples/plotcities.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/plotcities.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,6 +1,5 @@
-import pylab as p
from matplotlib.mlab import prctile_rank
-import numpy
+import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
# cities colored by population rank.
@@ -16,9 +15,9 @@
popranks = prctile_rank(pop,100)
colors = []
for rank in popranks:
- colors.append(p.cm.jet(float(rank)/100.))
+ colors.append(plt.cm.jet(float(rank)/100.))
m.drawcoastlines()
m.fillcontinents()
m.scatter(x,y,25,colors,marker='o',faceted=False,zorder=10)
-p.title('City Locations colored by Population Rank')
-p.show()
+plt.title('City Locations colored by Population Rank')
+plt.show()
Modified: trunk/toolkits/basemap/examples/quiver_demo.py
===================================================================
--- trunk/toolkits/basemap/examples/quiver_demo.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/quiver_demo.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,7 +1,6 @@
from mpl_toolkits.basemap import Basemap
-import numpy
-from pylab import show, title, arange, meshgrid, cm, figure, \
- colorbar, axes, gca, reshape, quiverkey
+import numpy as np
+import matplotlib.pyplot as plt
# read in data.
file = open('fcover.dat','r')
@@ -13,12 +12,12 @@
ul.append(float(l[0]))
vl.append(float(l[1]))
pl.append(float(l[2]))
-u = reshape(numpy.array(ul,numpy.float32),(nlats,nlons))
-v = reshape(numpy.array(vl,numpy.float32),(nlats,nlons))
-p = reshape(numpy.array(pl,numpy.float32),(nlats,nlons))
-lats1 = -90.+dellat*arange(nlats)
-lons1 = -180.+dellon*arange(nlons)
-lons, lats = meshgrid(lons1, lats1)
+u = np.reshape(np.array(ul,np.float32),(nlats,nlons))
+v = np.reshape(np.array(vl,np.float32),(nlats,nlons))
+p = np.reshape(np.array(pl,np.float32),(nlats,nlons))
+lats1 = -90.+dellat*np.arange(nlats)
+lons1 = -180.+dellon*np.arange(nlons)
+lons, lats = np.meshgrid(lons1, lats1)
# plot vectors in geographical (lat/lon) coordinates.
@@ -26,32 +25,32 @@
m = Basemap(lon_0=-135,boundinglat=25,
resolution='c',area_thresh=10000.,projection='npstere')
# create a figure, add an axes.
-fig=figure(figsize=(8,8))
+fig=plt.figure(figsize=(8,8))
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# rotate wind vectors to map projection coordinates.
# (also compute native map projections coordinates of lat/lon grid)
# only do Northern Hemisphere.
urot,vrot,x,y = m.rotate_vector(u[36:,:],v[36:,:],lons[36:,:],lats[36:,:],returnxy=True)
# plot filled contours over map.
-cs = m.contourf(x,y,p[36:,:],15,cmap=cm.jet)
+cs = m.contourf(x,y,p[36:,:],15,cmap=plt.cm.jet)
# plot wind vectors over map.
Q = m.quiver(x,y,urot,vrot) #or specify, e.g., width=0.003, scale=400)
-qk = quiverkey(Q, 0.95, 1.05, 25, '25 m/s', labelpos='W')
-cax = axes([0.875, 0.1, 0.05, 0.7]) # setup colorbar axes.
-colorbar(cax=cax) # draw colorbar
-axes(ax) # make the original axes current again
+qk = plt.quiverkey(Q, 0.95, 1.05, 25, '25 m/s', labelpos='W')
+cax = plt.axes([0.875, 0.1, 0.05, 0.7]) # setup colorbar axes.
+plt.colorbar(cax=cax) # draw colorbar
+plt.axes(ax) # make the original axes current again
m.drawcoastlines()
m.drawcountries()
# draw parallels
delat = 20.
-circles = arange(0.,90.+delat,delat).tolist()+\
- arange(-delat,-90.-delat,-delat).tolist()
+circles = np.arange(0.,90.+delat,delat).tolist()+\
+ np.arange(-delat,-90.-delat,-delat).tolist()
m.drawparallels(circles,labels=[1,1,1,1])
# draw meridians
delon = 45.
-meridians = arange(-180,180,delon)
+meridians = np.arange(-180,180,delon)
m.drawmeridians(meridians,labels=[1,1,1,1])
-title('Surface Winds Winds and Pressure (lat-lon grid)',y=1.075)
+plt.title('Surface Winds Winds and Pressure (lat-lon grid)',y=1.075)
# plot vectors in map projection coordinates.
@@ -62,30 +61,30 @@
# and interpolation).
nxv = 41; nyv = 41
nxp = 101; nyp = 101
-spd = numpy.sqrt(u**2+v**2)
+spd = np.sqrt(u**2+v**2)
udat, vdat, xv, yv = m.transform_vector(u,v,lons1,lats1,nxv,nyv,returnxy=True)
pdat, xp, yp = m.transform_scalar(p,lons1,lats1,nxp,nyp,returnxy=True)
# create a figure, add an axes.
-fig=figure(figsize=(8,8))
+fig=plt.figure(figsize=(8,8))
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# plot image over map
-im = m.imshow(pdat,cm.jet)
+im = m.imshow(pdat,plt.cm.jet)
# plot wind vectors over map.
Q = m.quiver(xv,yv,udat,vdat) #or specify, e.g., width=0.003, scale=400)
-qk = quiverkey(Q, 0.95, 1.05, 25, '25 m/s', labelpos='W')
-cax = axes([0.875, 0.1, 0.05, 0.7]) # setup colorbar axes.
-colorbar(cax=cax) # draw colorbar
-axes(ax) # make the original axes current again
+qk = plt.quiverkey(Q, 0.95, 1.05, 25, '25 m/s', labelpos='W')
+cax = plt.axes([0.875, 0.1, 0.05, 0.7]) # setup colorbar axes.
+plt.colorbar(cax=cax) # draw colorbar
+plt.axes(ax) # make the original axes current again
m.drawcoastlines()
m.drawcountries()
# draw parallels
delat = 20.
-circles = arange(0.,90.+delat,delat).tolist()+\
- arange(-delat,-90.-delat,-delat).tolist()
+circles = np.arange(0.,90.+delat,delat).tolist()+\
+ np.arange(-delat,-90.-delat,-delat).tolist()
m.drawparallels(circles,labels=[1,1,1,1])
# draw meridians
delon = 45.
-meridians = arange(-180,180,delon)
+meridians = np.arange(-180,180,delon)
m.drawmeridians(meridians,labels=[1,1,1,1])
-title('Surface Winds Winds and Pressure (projection grid)',y=1.075)
-show()
+plt.title('Surface Winds Winds and Pressure (projection grid)',y=1.075)
+plt.show()
Modified: trunk/toolkits/basemap/examples/randompoints.py
===================================================================
--- trunk/toolkits/basemap/examples/randompoints.py 2008-05-19 19:09:35 UTC (rev 5195)
+++ trunk/toolkits/basemap/examples/randompoints.py 2008-05-20 11:52:12 UTC (rev 5196)
@@ -1,4 +1,5 @@
-from pylab import show, title, arange, figure, title, arccos, pi, cm, text
+import numpy as np
+import matplotlib.pyplot as plt
from matplotlib.colors import rgb2hex
from mpl_toolkits.basemap import Basemap
from numpy.random import uniform
@@ -18,16 +19,16 @@
v = uniform(0.,1.,size=npts)
z = uniform(0,100,size=npts)
lons = 360.*u
-lats = (180./pi)*arccos(2*v-1) - 90.
+lats = (180./np.pi)*np.arccos(2*v-1) - 90.
# transform lons and lats to map coordinates.
x,y = m(lons,lats)
# plot them as filled circles on the map.
# first, create a figure.
-fig=figure()
+fig=plt.figure()
# draw colored markers.
# use zorder=10 to make sure markers are drawn last.
# (otherwise they are covered up when continents are filled)
-#m.scatter(x,y,25,z,cmap=cm.jet,marker='o',faceted=False,zorder=10)
+#m.scatter(x,y,25,z,cmap=plt.cm.jet,marker='o',faceted=False,zorder=10)
# create a list of strings containing z values
# or, plot actual numbers as color-coded text strings.
zn = [ '%2i' % zz for zz in z ]
@@ -35,8 +36,8 @@
for numstr,zval,xpt,ypt in zip(zn,z,x,y):
# only plot values inside map region.
if xpt > m.xmin and xpt < m.xmax and ypt > m.ymin and ypt < m.ymax:
- hexcolor = rgb2hex(cm.jet(zval/100.)[:3])
- text(xpt,ypt,numstr,fontsize=9,weight='bold',color=hexcolor)
+ hexcolor = rgb2hex(plt.cm.jet(zval/100.)[:3])
+ plt.text(xpt,ypt,numstr,fontsize=9,weight='bold',color=hexcolor)
# draw coasts and fill continents/lakes.
m.drawcoastlines(linewidth=0.5)
m.fillcontinents(color='coral',lake_color='aqua')
@@ -44,11 +45,11 @@
m.drawmapboundary(fill_color='aqua')
# draw parallels and meridians.
delat = 20.
-circles = arange(0.,90.,delat).tolist()+\
- arange(-delat,-90,-delat).tolist()
+circles = np.arange(0.,90.,delat).tolist()+\
+ np.arange(-delat,-90,-delat).tolist()
m.drawparallels(circles)
delon = 45.
-meridians = arange(0,360,delon)
+meridians = np.arange(0,360,delon)
m.drawmeridians(meridians,labels=[1,1,1,1])
-title('Random Points',y=1.075)
-show()
+plt.title('Random Points',y=1.075)
+plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-19 19:09:39
|
Revision: 5195
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5195&view=rev
Author: mdboom
Date: 2008-05-19 12:09:35 -0700 (Mon, 19 May 2008)
Log Message:
-----------
Merged revisions 5192-5193 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint
........
r5193 | mdboom | 2008-05-19 15:05:23 -0400 (Mon, 19 May 2008) | 3 lines
[ 1966974 ] win32FontDirectory() can fail with access denied (Thanks,
Patrik Simons)
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/font_manager.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5191
+ /branches/v0_91_maint:1-5193
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-19 19:07:47 UTC (rev 5194)
+++ trunk/matplotlib/CHANGELOG 2008-05-19 19:09:35 UTC (rev 5195)
@@ -1,3 +1,6 @@
+2008-05-19 Fix crash when Windows can not access the registry to
+ determine font path [Bug 1966974, thanks Patrik Simons] - MGD
+
2008-05-16 removed some unneeded code w/ the python 2.4 requirement.
cbook no longer provides compatibility for reversed,
enumerate, set or izip. removed lib/subprocess, mpl1,
Modified: trunk/matplotlib/lib/matplotlib/font_manager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/font_manager.py 2008-05-19 19:07:47 UTC (rev 5194)
+++ trunk/matplotlib/lib/matplotlib/font_manager.py 2008-05-19 19:09:35 UTC (rev 5195)
@@ -107,14 +107,17 @@
except ImportError:
pass # Fall through to default
else:
- user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders)
try:
+ user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders)
try:
- return _winreg.QueryValueEx(user, 'Fonts')[0]
- except OSError:
- pass # Fall through to default
- finally:
- _winreg.CloseKey(user)
+ try:
+ return _winreg.QueryValueEx(user, 'Fonts')[0]
+ except OSError:
+ pass # Fall through to default
+ finally:
+ _winreg.CloseKey(user)
+ except OSError:
+ pass # Fall through to default
return os.path.join(os.environ['WINDIR'], 'Fonts')
def win32InstalledFonts(directory=None, fontext='ttf'):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-19 19:07:50
|
Revision: 5194
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5194&view=rev
Author: mdboom
Date: 2008-05-19 12:07:47 -0700 (Mon, 19 May 2008)
Log Message:
-----------
Remove typo.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-05-19 19:05:23 UTC (rev 5193)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-05-19 19:07:47 UTC (rev 5194)
@@ -290,7 +290,7 @@
original_dpi = renderer.dpi
renderer.dpi = self.figure.dpi
if is_string_like(filename_or_obj):
- filename_or_obj = opefile(filename_or_obj, 'wb')
+ filename_or_obj = file(filename_or_obj, 'wb')
renderer._renderer.write_rgba(filename_or_obj)
renderer.dpi = original_dpi
print_rgba = print_raw
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-19 19:05:29
|
Revision: 5193
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5193&view=rev
Author: mdboom
Date: 2008-05-19 12:05:23 -0700 (Mon, 19 May 2008)
Log Message:
-----------
[ 1966974 ] win32FontDirectory() can fail with access denied (Thanks,
Patrik Simons)
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/font_manager.py
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-05-19 12:55:47 UTC (rev 5192)
+++ branches/v0_91_maint/CHANGELOG 2008-05-19 19:05:23 UTC (rev 5193)
@@ -1,3 +1,6 @@
+2008-05-19 Fix crash when Windows can not access the registry to
+ determine font path [Bug 1966974, thanks Patrik Simons] - MGD
+
2008-05-14 Don't use stat on Windows (fixes font embedding problem) - MGD
2008-05-09 Fix /singlequote (') in Postscript backend - MGD
Modified: branches/v0_91_maint/lib/matplotlib/font_manager.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/font_manager.py 2008-05-19 12:55:47 UTC (rev 5192)
+++ branches/v0_91_maint/lib/matplotlib/font_manager.py 2008-05-19 19:05:23 UTC (rev 5193)
@@ -107,14 +107,17 @@
except ImportError:
pass # Fall through to default
else:
- user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders)
try:
+ user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders)
try:
- return _winreg.QueryValueEx(user, 'Fonts')[0]
- except OSError:
- pass # Fall through to default
- finally:
- _winreg.CloseKey(user)
+ try:
+ return _winreg.QueryValueEx(user, 'Fonts')[0]
+ except OSError:
+ pass # Fall through to default
+ finally:
+ _winreg.CloseKey(user)
+ except OSError:
+ pass # Fall through to default
return os.path.join(os.environ['WINDIR'], 'Fonts')
def win32InstalledFonts(directory=None, fontext='ttf'):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-19 12:56:06
|
Revision: 5192
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5192&view=rev
Author: mdboom
Date: 2008-05-19 05:55:47 -0700 (Mon, 19 May 2008)
Log Message:
-----------
THIS MERGE IS NOT AS BIG AS IT LOOKS -- It is to correct an error
where somehow the svnmerge history was lost. This merge is in fact only
of r5191. I have left the revision ranges that svnmerge did here, but
edited the log list to only include r5191.
Merged revisions 4817-5171,5173-5177,5180,5182-5188,5190-5191 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint
........
r5191 | mdboom | 2008-05-19 08:12:30 -0400 (Mon, 19 May 2008) | 2 lines
Use is_string_like instead of explicitly string or unicode.
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-4816,5172,5178-5179,5181,5189
+ /branches/v0_91_maint:1-5191
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-05-19 12:12:30 UTC (rev 5191)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-05-19 12:55:47 UTC (rev 5192)
@@ -331,7 +331,6 @@
self.set_patchprops(seg, **kwargs)
ret.append(seg)
-
if self.command == 'plot': func = makeline
else: func = makefill
if multicol:
@@ -2818,7 +2817,6 @@
autoscaled; default True. See Axes.autoscale_view for more
information
"""
-
scalex = kwargs.pop( 'scalex', True)
scaley = kwargs.pop( 'scaley', True)
@@ -3757,7 +3755,7 @@
xlolims=False, xuplims=False, **kwargs):
"""
ERRORBAR(x, y, yerr=None, xerr=None,
- fmt='b-', ecolor=None, elinewidth=None, capsize=3,
+ fmt='b-', ecolor=None, elinewidth=None, capsize=3,
barsabove=False, lolims=False, uplims=False,
xlolims=False, xuplims=False)
@@ -5472,7 +5470,7 @@
if not self._hold: self.cla()
n, bins = np.histogram(x, bins, range=None,
normed=bool(normed), new=True)
-
+
if cumulative:
if normed:
n = (n * np.diff(bins)).cumsum()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-05-19 12:12:30 UTC (rev 5191)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-05-19 12:55:47 UTC (rev 5192)
@@ -289,7 +289,7 @@
renderer = self.get_renderer()
original_dpi = renderer.dpi
renderer.dpi = self.figure.dpi
- if type(filename_or_obj) in (str, unicode):
+ if is_string_like(filename_or_obj):
filename_or_obj = opefile(filename_or_obj, 'wb')
renderer._renderer.write_rgba(filename_or_obj)
renderer.dpi = original_dpi
@@ -300,7 +300,7 @@
renderer = self.get_renderer()
original_dpi = renderer.dpi
renderer.dpi = self.figure.dpi
- if type(filename_or_obj) in (str, unicode):
+ if is_string_like(filename_or_obj):
filename_or_obj = file(filename_or_obj, 'wb')
self.get_renderer()._renderer.write_png(filename_or_obj, self.figure.dpi)
renderer.dpi = original_dpi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-19 12:12:36
|
Revision: 5191
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5191&view=rev
Author: mdboom
Date: 2008-05-19 05:12:30 -0700 (Mon, 19 May 2008)
Log Message:
-----------
Use is_string_like instead of explicitly string or unicode.
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py 2008-05-19 01:10:11 UTC (rev 5190)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py 2008-05-19 12:12:30 UTC (rev 5191)
@@ -389,14 +389,14 @@
def print_raw(self, filename_or_obj, *args, **kwargs):
self.draw()
- if type(filename_or_obj) in (str, unicode):
+ if is_string_like(filename_or_obj):
filename_or_obj = file(filename_or_obj, 'wb')
self.get_renderer()._renderer.write_rgba(filename_or_obj)
print_rgba = print_raw
def print_png(self, filename_or_obj, *args, **kwargs):
self.draw()
- if type(filename_or_obj) in (str, unicode):
+ if is_string_like(filename_or_obj):
filename_or_obj = file(filename_or_obj, 'wb')
self.get_renderer()._renderer.write_png(filename_or_obj,
self.figure.dpi.get())
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-19 01:10:14
|
Revision: 5190
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5190&view=rev
Author: jdh2358
Date: 2008-05-18 18:10:11 -0700 (Sun, 18 May 2008)
Log Message:
-----------
Merged revisions 5189 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r5189 | jdh2358 | 2008-05-18 20:09:09 -0500 (Sun, 18 May 2008) | 1 line
fixed missing get_filterrad
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/image.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-4816,5172,5178-5179,5181
+ /branches/v0_91_maint:1-4816,5172,5178-5179,5181,5189
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2008-05-19 01:09:09 UTC (rev 5189)
+++ trunk/matplotlib/lib/matplotlib/image.py 2008-05-19 01:10:11 UTC (rev 5190)
@@ -362,6 +362,7 @@
def get_filterrad(self):
'return the filterrad setting'
+ return self._filterrad
class NonUniformImage(AxesImage):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-19 01:09:11
|
Revision: 5189
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5189&view=rev
Author: jdh2358
Date: 2008-05-18 18:09:09 -0700 (Sun, 18 May 2008)
Log Message:
-----------
fixed missing get_filterrad
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/image.py
Modified: branches/v0_91_maint/lib/matplotlib/image.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/image.py 2008-05-18 22:31:59 UTC (rev 5188)
+++ branches/v0_91_maint/lib/matplotlib/image.py 2008-05-19 01:09:09 UTC (rev 5189)
@@ -324,6 +324,7 @@
def get_filterrad(self):
'return the filterrad setting'
+ return self._filterrad
class NonUniformImage(AxesImage):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-18 22:32:18
|
Revision: 5188
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5188&view=rev
Author: jdh2358
Date: 2008-05-18 15:31:59 -0700 (Sun, 18 May 2008)
Log Message:
-----------
added z coordinate example for nearest neighbor images
Added Paths:
-----------
trunk/matplotlib/examples/api/image_zcoord.py
Added: trunk/matplotlib/examples/api/image_zcoord.py
===================================================================
--- trunk/matplotlib/examples/api/image_zcoord.py (rev 0)
+++ trunk/matplotlib/examples/api/image_zcoord.py 2008-05-18 22:31:59 UTC (rev 5188)
@@ -0,0 +1,27 @@
+"""
+Show how to modify the coordinate formatter to report the image "z"
+value of the nearest pixel given x and y
+"""
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.cm as cm
+
+X = 10*np.random.rand(5,3)
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.imshow(X, cmap=cm.jet, interpolation='nearest')
+
+numrows, numcols = X.shape
+def format_coord(x, y):
+ col = int(x+0.5)
+ row = int(y+0.5)
+ if col>=0 and col<numcols and row>=0 and row<numrows:
+ z = X[row,col]
+ return 'x=%1.4f, y=%1.4f, z=%1.4f'%(x, y, z)
+ else:
+ return 'x=%1.4f, y=%1.4f'%(x, y)
+
+ax.format_coord = format_coord
+plt.show()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-18 21:06:28
|
Revision: 5187
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5187&view=rev
Author: jdh2358
Date: 2008-05-18 14:06:13 -0700 (Sun, 18 May 2008)
Log Message:
-----------
moved a few more examples to their proper home
Added Paths:
-----------
trunk/matplotlib/examples/animation/anim.py
trunk/matplotlib/examples/animation/dynamic_demo.py
trunk/matplotlib/examples/animation/dynamic_image_gtkagg.py
trunk/matplotlib/examples/animation/strip_chart_demo.py
trunk/matplotlib/examples/event_handling/data_browser.py
trunk/matplotlib/examples/event_handling/keypress_demo.py
trunk/matplotlib/examples/event_handling/pick_event_demo2.py
trunk/matplotlib/examples/event_handling/poly_editor.py
trunk/matplotlib/examples/user_interfaces/interactive.py
trunk/matplotlib/examples/user_interfaces/interactive2.py
trunk/matplotlib/examples/user_interfaces/lineprops_dialog_gtk.py
trunk/matplotlib/examples/user_interfaces/pylab_with_gtk.py
Removed Paths:
-------------
trunk/matplotlib/examples/pylab/anim.py
trunk/matplotlib/examples/pylab/data_browser.py
trunk/matplotlib/examples/pylab/dynamic_demo.py
trunk/matplotlib/examples/pylab/dynamic_image_gtkagg.py
trunk/matplotlib/examples/pylab/interactive.py
trunk/matplotlib/examples/pylab/interactive2.py
trunk/matplotlib/examples/pylab/keypress_demo.py
trunk/matplotlib/examples/pylab/lineprops_dialog_gtk.py
trunk/matplotlib/examples/pylab/pick_event_demo2.py
trunk/matplotlib/examples/pylab/poly_editor.py
trunk/matplotlib/examples/pylab/pylab_with_gtk.py
trunk/matplotlib/examples/pylab/strip_chart_demo.py
Copied: trunk/matplotlib/examples/animation/anim.py (from rev 5186, trunk/matplotlib/examples/pylab/anim.py)
===================================================================
--- trunk/matplotlib/examples/animation/anim.py (rev 0)
+++ trunk/matplotlib/examples/animation/anim.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+"""
+A simple example of an animated plot in matplotlib. You can test the
+speed of animation of various backends by running the script with the
+'-dSomeBackend' flag
+
+SC Aug 31 2005 mpl 0.83.2:
+Here are some numbers from my system, where FPS is the frames rendered
+per second
+
+ GTK 29 FPS
+ GTKAgg 18 FPS
+ GTKCairo 15 FPS
+ TkAgg 13 FPS
+ QkAgg 13 FPS
+"""
+import time
+
+import pylab as p
+
+# turn interactive mode on for dynamic updates. If you aren't in
+# interactive mode, you'll need to use a GUI event handler/timer.
+p.ion()
+
+tstart = time.time() # for profiling
+x = p.arange(0, 2*p.pi, 0.01) # x-array
+line, = p.plot(x, p.sin(x))
+for i in p.arange(1,200):
+ line.set_ydata(p.sin(x+i/10.0)) # update the data
+ p.draw() # redraw the canvas
+
+print 'FPS:' , 200/(time.time()-tstart)
Copied: trunk/matplotlib/examples/animation/dynamic_demo.py (from rev 5186, trunk/matplotlib/examples/pylab/dynamic_demo.py)
===================================================================
--- trunk/matplotlib/examples/animation/dynamic_demo.py (rev 0)
+++ trunk/matplotlib/examples/animation/dynamic_demo.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+import gobject
+import gtk
+
+from pylab import *
+
+
+fig = figure(1)
+ind = arange(30)
+X = rand(len(ind),10)
+lines = plot(X[:,0], 'o')
+
+manager = get_current_fig_manager()
+def updatefig(*args):
+ lines[0].set_data(ind, X[:,updatefig.count])
+ manager.canvas.draw()
+ updatefig.count += 1
+ if updatefig.count<10:
+ return True
+ else:
+ return False
+
+updatefig.count = 0
+
+gobject.timeout_add(300, updatefig)
+show()
Copied: trunk/matplotlib/examples/animation/dynamic_image_gtkagg.py (from rev 5186, trunk/matplotlib/examples/pylab/dynamic_image_gtkagg.py)
===================================================================
--- trunk/matplotlib/examples/animation/dynamic_image_gtkagg.py (rev 0)
+++ trunk/matplotlib/examples/animation/dynamic_image_gtkagg.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+"""
+An animated image
+"""
+import time
+
+import gobject
+import gtk
+
+import matplotlib
+matplotlib.use('GTKAgg')
+from matplotlib import rcParams
+
+from pylab import *
+
+fig = figure(1)
+a = subplot(111)
+x = arange(120.0)*2*pi/120.0
+x = resize(x, (100,120))
+y = arange(100.0)*2*pi/100.0
+y = resize(y, (120,100))
+y = transpose(y)
+z = sin(x) + cos(y)
+im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
+
+manager = get_current_fig_manager()
+cnt = 0
+tstart = time.time()
+def updatefig(*args):
+ global x, y, cnt, start
+ x += pi/15
+ y += pi/20
+ z = sin(x) + cos(y)
+ im.set_array(z)
+ manager.canvas.draw()
+ cnt += 1
+ if cnt==50:
+ print 'FPS', cnt/(time.time() - tstart)
+ return False
+ return True
+
+cnt = 0
+
+gobject.idle_add(updatefig)
+show()
Copied: trunk/matplotlib/examples/animation/strip_chart_demo.py (from rev 5186, trunk/matplotlib/examples/pylab/strip_chart_demo.py)
===================================================================
--- trunk/matplotlib/examples/animation/strip_chart_demo.py (rev 0)
+++ trunk/matplotlib/examples/animation/strip_chart_demo.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -0,0 +1,72 @@
+"""
+Emulate an oscilloscope. Requires the animation API introduced in
+matplotlib 0.84. See
+http://www.scipy.org/wikis/topical_software/Animations for an
+explanation.
+
+This example uses gtk but does not depend on it intimately. It just
+uses the idle handler to trigger events. You can plug this into a
+different GUI that supports animation (GTKAgg, TkAgg, WXAgg) and use
+your toolkits idle/timer functions.
+"""
+import gobject, gtk
+import matplotlib
+matplotlib.use('GTKAgg')
+import numpy as np
+from matplotlib.lines import Line2D
+
+
+class Scope:
+ def __init__(self, ax, maxt=10, dt=0.01):
+ self.ax = ax
+ self.canvas = ax.figure.canvas
+ self.dt = dt
+ self.maxt = maxt
+ self.tdata = [0]
+ self.ydata = [0]
+ self.line = Line2D(self.tdata, self.ydata, animated=True)
+ self.ax.add_line(self.line)
+ self.background = None
+ self.canvas.mpl_connect('draw_event', self.update_background)
+ self.ax.set_ylim(-.1, 1.1)
+ self.ax.set_xlim(0, self.maxt)
+
+ def update_background(self, event):
+ self.background = self.canvas.copy_from_bbox(self.ax.bbox)
+
+ def emitter(self, p=0.01):
+ 'return a random value with probability p, else 0'
+ v = np.random.rand(1)
+ if v>p: return 0.
+ else: return np.random.rand(1)
+
+ def update(self, *args):
+ if self.background is None: return True
+ y = self.emitter()
+ lastt = self.tdata[-1]
+ if lastt>self.tdata[0]+self.maxt: # reset the arrays
+ self.tdata = [self.tdata[-1]]
+ self.ydata = [self.ydata[-1]]
+ self.ax.set_xlim(self.tdata[0], self.tdata[0]+self.maxt)
+ self.ax.figure.canvas.draw()
+
+ self.canvas.restore_region(self.background)
+
+ t = self.tdata[-1] + self.dt
+ self.tdata.append(t)
+ self.ydata.append(y)
+ self.line.set_data(self.tdata, self.ydata)
+ self.ax.draw_artist(self.line)
+
+ self.canvas.blit(self.ax.bbox)
+ return True
+
+
+from pylab import figure, show
+
+fig = figure()
+ax = fig.add_subplot(111)
+scope = Scope(ax)
+gobject.idle_add(scope.update)
+
+show()
Copied: trunk/matplotlib/examples/event_handling/data_browser.py (from rev 5186, trunk/matplotlib/examples/pylab/data_browser.py)
===================================================================
--- trunk/matplotlib/examples/event_handling/data_browser.py (rev 0)
+++ trunk/matplotlib/examples/event_handling/data_browser.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -0,0 +1,82 @@
+import numpy as np
+from pylab import figure, show
+
+
+X = np.random.rand(100, 200)
+xs = np.mean(X, axis=1)
+ys = np.std(X, axis=1)
+
+fig = figure()
+ax = fig.add_subplot(211)
+ax.set_title('click on point to plot time series')
+line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance
+ax2 = fig.add_subplot(212)
+
+class PointBrowser:
+ """
+ Click on a point to select and highlight it -- the data that
+ generated the point will be shown in the lower axes. Use the 'n'
+ and 'p' keys to browse through the next and pervious points
+ """
+ def __init__(self):
+ self.lastind = 0
+
+ self.text = ax.text(0.05, 0.95, 'selected: none',
+ transform=ax.transAxes, va='top')
+ self.selected, = ax.plot([xs[0]], [ys[0]], 'o', ms=12, alpha=0.4,
+ color='yellow', visible=False)
+
+ def onpress(self, event):
+ if self.lastind is None: return
+ if event.key not in ('n', 'p'): return
+ if event.key=='n': inc = 1
+ else: inc = -1
+
+
+ self.lastind += inc
+ self.lastind = np.clip(self.lastind, 0, len(xs)-1)
+ self.update()
+
+ def onpick(self, event):
+
+ if event.artist!=line: return True
+
+ N = len(event.ind)
+ if not N: return True
+
+ # the click locations
+ x = event.mouseevent.xdata
+ y = event.mouseevent.ydata
+
+
+ distances = np.hypot(x-xs[event.ind], y-ys[event.ind])
+ indmin = distances.argmin()
+ dataind = event.ind[indmin]
+
+ self.lastind = dataind
+ self.update()
+
+ def update(self):
+ if self.lastind is None: return
+
+ dataind = self.lastind
+
+ ax2.cla()
+ ax2.plot(X[dataind])
+
+ ax2.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]),
+ transform=ax2.transAxes, va='top')
+ ax2.set_ylim(-0.5, 1.5)
+ self.selected.set_visible(True)
+ self.selected.set_data(xs[dataind], ys[dataind])
+
+ self.text.set_text('selected: %d'%dataind)
+ fig.canvas.draw()
+
+
+browser = PointBrowser()
+
+fig.canvas.mpl_connect('pick_event', browser.onpick)
+fig.canvas.mpl_connect('key_press_event', browser.onpress)
+
+show()
Copied: trunk/matplotlib/examples/event_handling/keypress_demo.py (from rev 5186, trunk/matplotlib/examples/pylab/keypress_demo.py)
===================================================================
--- trunk/matplotlib/examples/event_handling/keypress_demo.py (rev 0)
+++ trunk/matplotlib/examples/event_handling/keypress_demo.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+"""
+Show how to connect to keypress events
+"""
+import numpy as n
+from pylab import figure, show
+
+def press(event):
+ print 'press', event.key
+ if event.key=='x':
+ visible = xl.get_visible()
+ xl.set_visible(not visible)
+ fig.canvas.draw()
+
+fig = figure()
+ax = fig.add_subplot(111)
+
+fig.canvas.mpl_connect('key_press_event', press)
+
+ax.plot(n.random.rand(12), n.random.rand(12), 'go')
+xl = ax.set_xlabel('easy come, easy go')
+
+show()
Copied: trunk/matplotlib/examples/event_handling/pick_event_demo2.py (from rev 5186, trunk/matplotlib/examples/pylab/pick_event_demo2.py)
===================================================================
--- trunk/matplotlib/examples/event_handling/pick_event_demo2.py (rev 0)
+++ trunk/matplotlib/examples/event_handling/pick_event_demo2.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -0,0 +1,45 @@
+"""
+compute the mean and stddev of 100 data sets and plot mean vs stddev.
+When you click on one of the mu, sigma points, plot the raw data from
+the dataset that generated the mean and stddev
+"""
+import numpy
+from pylab import figure, show
+
+
+X = numpy.random.rand(100, 1000)
+xs = numpy.mean(X, axis=1)
+ys = numpy.std(X, axis=1)
+
+fig = figure()
+ax = fig.add_subplot(111)
+ax.set_title('click on point to plot time series')
+line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance
+
+
+def onpick(event):
+
+ if event.artist!=line: return True
+
+ N = len(event.ind)
+ if not N: return True
+
+
+ figi = figure()
+ for subplotnum, dataind in enumerate(event.ind):
+ ax = figi.add_subplot(N,1,subplotnum+1)
+ ax.plot(X[dataind])
+ ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]),
+ transform=ax.transAxes, va='top')
+ ax.set_ylim(-0.5, 1.5)
+ figi.show()
+ return True
+
+fig.canvas.mpl_connect('pick_event', onpick)
+
+show()
+
+
+
+
+
Copied: trunk/matplotlib/examples/event_handling/poly_editor.py (from rev 5186, trunk/matplotlib/examples/pylab/poly_editor.py)
===================================================================
--- trunk/matplotlib/examples/event_handling/poly_editor.py (rev 0)
+++ trunk/matplotlib/examples/event_handling/poly_editor.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -0,0 +1,171 @@
+"""
+This is an example to show how to build cross-GUI applications using
+matplotlib event handling to interact with objects on the canvas
+
+"""
+from matplotlib.artist import Artist
+from matplotlib.patches import Polygon, CirclePolygon
+from numpy import sqrt, nonzero, equal, array, asarray, dot, amin, cos, sin
+from matplotlib.mlab import dist_point_to_segment
+
+
+class PolygonInteractor:
+ """
+ An polygon editor.
+
+ Key-bindings
+
+ 't' toggle vertex markers on and off. When vertex markers are on,
+ you can move them, delete them
+
+ 'd' delete the vertex under point
+
+ 'i' insert a vertex at point. You must be within epsilon of the
+ line connecting two existing vertices
+
+ """
+
+ showverts = True
+ epsilon = 5 # max pixel distance to count as a vertex hit
+
+ def __init__(self, ax, poly):
+ if poly.figure is None:
+ raise RuntimeError('You must first add the polygon to a figure or canvas before defining the interactor')
+ self.ax = ax
+ canvas = poly.figure.canvas
+ self.poly = poly
+
+ x, y = zip(*self.poly.xy)
+ self.line = Line2D(x,y,marker='o', markerfacecolor='r', animated=True)
+ self.ax.add_line(self.line)
+ #self._update_line(poly)
+
+ cid = self.poly.add_callback(self.poly_changed)
+ self._ind = None # the active vert
+
+ canvas.mpl_connect('draw_event', self.draw_callback)
+ canvas.mpl_connect('button_press_event', self.button_press_callback)
+ canvas.mpl_connect('key_press_event', self.key_press_callback)
+ canvas.mpl_connect('button_release_event', self.button_release_callback)
+ canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
+ self.canvas = canvas
+
+
+ def draw_callback(self, event):
+ self.background = self.canvas.copy_from_bbox(self.ax.bbox)
+ self.ax.draw_artist(self.poly)
+ self.ax.draw_artist(self.line)
+ self.canvas.blit(self.ax.bbox)
+
+ def poly_changed(self, poly):
+ 'this method is called whenever the polygon object is called'
+ # only copy the artist props to the line (except visibility)
+ vis = self.line.get_visible()
+ Artist.update_from(self.line, poly)
+ self.line.set_visible(vis) # don't use the poly visibility state
+
+
+ def get_ind_under_point(self, event):
+ 'get the index of the vertex under point if within epsilon tolerance'
+
+ # display coords
+ xy = asarray(self.poly.xy)
+ xyt = self.poly.get_transform().transform(xy)
+ xt, yt = xyt[:, 0], xyt[:, 1]
+ d = sqrt((xt-event.x)**2 + (yt-event.y)**2)
+ indseq = nonzero(equal(d, amin(d)))[0]
+ ind = indseq[0]
+
+ if d[ind]>=self.epsilon:
+ ind = None
+
+ return ind
+
+ def button_press_callback(self, event):
+ 'whenever a mouse button is pressed'
+ if not self.showverts: return
+ if event.inaxes==None: return
+ if event.button != 1: return
+ self._ind = self.get_ind_under_point(event)
+
+ def button_release_callback(self, event):
+ 'whenever a mouse button is released'
+ if not self.showverts: return
+ if event.button != 1: return
+ self._ind = None
+
+ def key_press_callback(self, event):
+ 'whenever a key is pressed'
+ if not event.inaxes: return
+ if event.key=='t':
+ self.showverts = not self.showverts
+ self.line.set_visible(self.showverts)
+ if not self.showverts: self._ind = None
+ elif event.key=='d':
+ ind = self.get_ind_under_point(event)
+ if ind is not None:
+ self.poly.xy = [tup for i,tup in enumerate(self.poly.xy) if i!=ind]
+ self.line.set_data(zip(*self.poly.xy))
+ elif event.key=='i':
+ xys = self.poly.get_transform().transform(self.poly.xy)
+ p = event.x, event.y # display coords
+ for i in range(len(xys)-1):
+ s0 = xys[i]
+ s1 = xys[i+1]
+ d = dist_point_to_segment(p, s0, s1)
+ if d<=self.epsilon:
+ self.poly.xy = array(
+ list(self.poly.xy[:i]) +
+ [(event.xdata, event.ydata)] +
+ list(self.poly.xy[i:]))
+ self.line.set_data(zip(*self.poly.xy))
+ break
+
+
+ self.canvas.draw()
+
+ def motion_notify_callback(self, event):
+ 'on mouse movement'
+ if not self.showverts: return
+ if self._ind is None: return
+ if event.inaxes is None: return
+ if event.button != 1: return
+ x,y = event.xdata, event.ydata
+
+ self.poly.xy[self._ind] = x,y
+ self.line.set_data(zip(*self.poly.xy))
+
+ self.canvas.restore_region(self.background)
+ self.ax.draw_artist(self.poly)
+ self.ax.draw_artist(self.line)
+ self.canvas.blit(self.ax.bbox)
+
+
+
+from pylab import *
+
+
+
+
+
+fig = figure()
+theta = arange(0, 2*pi, 0.1)
+r = 1.5
+
+xs = r*cos(theta)
+ys = r*sin(theta)
+
+poly = Polygon(zip(xs, ys,), animated=True)
+
+
+
+
+ax = subplot(111)
+ax.add_patch(poly)
+p = PolygonInteractor( ax, poly)
+
+#ax.add_line(p.line)
+ax.set_title('Click and drag a point to move it')
+ax.set_xlim((-2,2))
+ax.set_ylim((-2,2))
+show()
Deleted: trunk/matplotlib/examples/pylab/anim.py
===================================================================
--- trunk/matplotlib/examples/pylab/anim.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/anim.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-"""
-A simple example of an animated plot in matplotlib. You can test the
-speed of animation of various backends by running the script with the
-'-dSomeBackend' flag
-
-SC Aug 31 2005 mpl 0.83.2:
-Here are some numbers from my system, where FPS is the frames rendered
-per second
-
- GTK 29 FPS
- GTKAgg 18 FPS
- GTKCairo 15 FPS
- TkAgg 13 FPS
- QkAgg 13 FPS
-"""
-import time
-
-import pylab as p
-
-# turn interactive mode on for dynamic updates. If you aren't in
-# interactive mode, you'll need to use a GUI event handler/timer.
-p.ion()
-
-tstart = time.time() # for profiling
-x = p.arange(0, 2*p.pi, 0.01) # x-array
-line, = p.plot(x, p.sin(x))
-for i in p.arange(1,200):
- line.set_ydata(p.sin(x+i/10.0)) # update the data
- p.draw() # redraw the canvas
-
-print 'FPS:' , 200/(time.time()-tstart)
Deleted: trunk/matplotlib/examples/pylab/data_browser.py
===================================================================
--- trunk/matplotlib/examples/pylab/data_browser.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/data_browser.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,82 +0,0 @@
-import numpy as np
-from pylab import figure, show
-
-
-X = np.random.rand(100, 200)
-xs = np.mean(X, axis=1)
-ys = np.std(X, axis=1)
-
-fig = figure()
-ax = fig.add_subplot(211)
-ax.set_title('click on point to plot time series')
-line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance
-ax2 = fig.add_subplot(212)
-
-class PointBrowser:
- """
- Click on a point to select and highlight it -- the data that
- generated the point will be shown in the lower axes. Use the 'n'
- and 'p' keys to browse through the next and pervious points
- """
- def __init__(self):
- self.lastind = 0
-
- self.text = ax.text(0.05, 0.95, 'selected: none',
- transform=ax.transAxes, va='top')
- self.selected, = ax.plot([xs[0]], [ys[0]], 'o', ms=12, alpha=0.4,
- color='yellow', visible=False)
-
- def onpress(self, event):
- if self.lastind is None: return
- if event.key not in ('n', 'p'): return
- if event.key=='n': inc = 1
- else: inc = -1
-
-
- self.lastind += inc
- self.lastind = np.clip(self.lastind, 0, len(xs)-1)
- self.update()
-
- def onpick(self, event):
-
- if event.artist!=line: return True
-
- N = len(event.ind)
- if not N: return True
-
- # the click locations
- x = event.mouseevent.xdata
- y = event.mouseevent.ydata
-
-
- distances = np.hypot(x-xs[event.ind], y-ys[event.ind])
- indmin = distances.argmin()
- dataind = event.ind[indmin]
-
- self.lastind = dataind
- self.update()
-
- def update(self):
- if self.lastind is None: return
-
- dataind = self.lastind
-
- ax2.cla()
- ax2.plot(X[dataind])
-
- ax2.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]),
- transform=ax2.transAxes, va='top')
- ax2.set_ylim(-0.5, 1.5)
- self.selected.set_visible(True)
- self.selected.set_data(xs[dataind], ys[dataind])
-
- self.text.set_text('selected: %d'%dataind)
- fig.canvas.draw()
-
-
-browser = PointBrowser()
-
-fig.canvas.mpl_connect('pick_event', browser.onpick)
-fig.canvas.mpl_connect('key_press_event', browser.onpress)
-
-show()
Deleted: trunk/matplotlib/examples/pylab/dynamic_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab/dynamic_demo.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/dynamic_demo.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-
-import gobject
-import gtk
-
-from pylab import *
-
-
-fig = figure(1)
-ind = arange(30)
-X = rand(len(ind),10)
-lines = plot(X[:,0], 'o')
-
-manager = get_current_fig_manager()
-def updatefig(*args):
- lines[0].set_data(ind, X[:,updatefig.count])
- manager.canvas.draw()
- updatefig.count += 1
- if updatefig.count<10:
- return True
- else:
- return False
-
-updatefig.count = 0
-
-gobject.timeout_add(300, updatefig)
-show()
Deleted: trunk/matplotlib/examples/pylab/dynamic_image_gtkagg.py
===================================================================
--- trunk/matplotlib/examples/pylab/dynamic_image_gtkagg.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/dynamic_image_gtkagg.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-"""
-An animated image
-"""
-import time
-
-import gobject
-import gtk
-
-import matplotlib
-matplotlib.use('GTKAgg')
-from matplotlib import rcParams
-
-from pylab import *
-
-fig = figure(1)
-a = subplot(111)
-x = arange(120.0)*2*pi/120.0
-x = resize(x, (100,120))
-y = arange(100.0)*2*pi/100.0
-y = resize(y, (120,100))
-y = transpose(y)
-z = sin(x) + cos(y)
-im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
-
-manager = get_current_fig_manager()
-cnt = 0
-tstart = time.time()
-def updatefig(*args):
- global x, y, cnt, start
- x += pi/15
- y += pi/20
- z = sin(x) + cos(y)
- im.set_array(z)
- manager.canvas.draw()
- cnt += 1
- if cnt==50:
- print 'FPS', cnt/(time.time() - tstart)
- return False
- return True
-
-cnt = 0
-
-gobject.idle_add(updatefig)
-show()
Deleted: trunk/matplotlib/examples/pylab/interactive.py
===================================================================
--- trunk/matplotlib/examples/pylab/interactive.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/interactive.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,230 +0,0 @@
-#!/usr/bin/env python
-"""Multithreaded interactive interpreter with GTK and Matplotlib support.
-
-Usage:
-
- pyint-gtk.py -> starts shell with gtk thread running separately
-
- pyint-gtk.py -pylab [filename] -> initializes matplotlib, optionally running
- the named file. The shell starts after the file is executed.
-
-Threading code taken from:
-http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian
-McErlean and John Finlay.
-
-Matplotlib support taken from interactive.py in the matplotlib distribution.
-
-Also borrows liberally from code.py in the Python standard library."""
-
-__author__ = "Fernando Perez <Fer...@co...>"
-
-import sys
-import code
-import threading
-
-import gobject
-import gtk
-
-try:
- import readline
-except ImportError:
- has_readline = False
-else:
- has_readline = True
-
-class MTConsole(code.InteractiveConsole):
- """Simple multi-threaded shell"""
-
- def __init__(self,on_kill=None,*args,**kw):
- code.InteractiveConsole.__init__(self,*args,**kw)
- self.code_to_run = None
- self.ready = threading.Condition()
- self._kill = False
- if on_kill is None:
- on_kill = []
- # Check that all things to kill are callable:
- for _ in on_kill:
- if not callable(_):
- raise TypeError,'on_kill must be a list of callables'
- self.on_kill = on_kill
- # Set up tab-completer
- if has_readline:
- import rlcompleter
- try: # this form only works with python 2.3
- self.completer = rlcompleter.Completer(self.locals)
- except: # simpler for py2.2
- self.completer = rlcompleter.Completer()
-
- readline.set_completer(self.completer.complete)
- # Use tab for completions
- readline.parse_and_bind('tab: complete')
- # This forces readline to automatically print the above list when tab
- # completion is set to 'complete'.
- readline.parse_and_bind('set show-all-if-ambiguous on')
- # Bindings for incremental searches in the history. These searches
- # use the string typed so far on the command line and search
- # anything in the previous input history containing them.
- readline.parse_and_bind('"\C-r": reverse-search-history')
- readline.parse_and_bind('"\C-s": forward-search-history')
-
- def runsource(self, source, filename="<input>", symbol="single"):
- """Compile and run some source in the interpreter.
-
- Arguments are as for compile_command().
-
- One several things can happen:
-
- 1) The input is incorrect; compile_command() raised an
- exception (SyntaxError or OverflowError). A syntax traceback
- will be printed by calling the showsyntaxerror() method.
-
- 2) The input is incomplete, and more input is required;
- compile_command() returned None. Nothing happens.
-
- 3) The input is complete; compile_command() returned a code
- object. The code is executed by calling self.runcode() (which
- also handles run-time exceptions, except for SystemExit).
-
- The return value is True in case 2, False in the other cases (unless
- an exception is raised). The return value can be used to
- decide whether to use sys.ps1 or sys.ps2 to prompt the next
- line.
- """
- try:
- code = self.compile(source, filename, symbol)
- except (OverflowError, SyntaxError, ValueError):
- # Case 1
- self.showsyntaxerror(filename)
- return False
-
- if code is None:
- # Case 2
- return True
-
- # Case 3
- # Store code in self, so the execution thread can handle it
- self.ready.acquire()
- self.code_to_run = code
- self.ready.wait() # Wait until processed in timeout interval
- self.ready.release()
-
- return False
-
- def runcode(self):
- """Execute a code object.
-
- When an exception occurs, self.showtraceback() is called to display a
- traceback."""
-
- self.ready.acquire()
- if self._kill:
- print 'Closing threads...',
- sys.stdout.flush()
- for tokill in self.on_kill:
- tokill()
- print 'Done.'
-
- if self.code_to_run is not None:
- self.ready.notify()
- code.InteractiveConsole.runcode(self,self.code_to_run)
-
- self.code_to_run = None
- self.ready.release()
- return True
-
- def kill (self):
- """Kill the thread, returning when it has been shut down."""
- self.ready.acquire()
- self._kill = True
- self.ready.release()
-
-class GTKInterpreter(threading.Thread):
- """Run gtk.main in the main thread and a python interpreter in a
- separate thread.
- Python commands can be passed to the thread where they will be executed.
- This is implemented by periodically checking for passed code using a
- GTK timeout callback.
- """
- TIMEOUT = 100 # Millisecond interval between timeouts.
-
- def __init__(self,banner=None):
- threading.Thread.__init__(self)
- self.banner = banner
- self.shell = MTConsole(on_kill=[gtk.main_quit])
-
- def run(self):
- self.pre_interact()
- self.shell.interact(self.banner)
- self.shell.kill()
-
- def mainloop(self):
- self.start()
- gobject.timeout_add(self.TIMEOUT, self.shell.runcode)
- try:
- if gtk.gtk_version[0] >= 2:
- gtk.gdk.threads_init()
- except AttributeError:
- pass
- gtk.main()
- self.join()
-
- def pre_interact(self):
- """This method should be overridden by subclasses.
-
- It gets called right before interact(), but after the thread starts.
- Typically used to push initialization code into the interpreter"""
-
- pass
-
-class MatplotLibInterpreter(GTKInterpreter):
- """Threaded interpreter with matplotlib support.
-
- Note that this explicitly sets GTKAgg as the backend, since it has
- specific GTK hooks in it."""
-
- def __init__(self,banner=None):
- banner = """\nWelcome to matplotlib, a matlab-like python environment.
- help(matlab) -> help on matlab compatible commands from matplotlib.
- help(plotting) -> help on plotting commands.
- """
- GTKInterpreter.__init__(self,banner)
-
- def pre_interact(self):
- """Initialize matplotlib before user interaction begins"""
-
- push = self.shell.push
- # Code to execute in user's namespace
- lines = ["import matplotlib",
- "matplotlib.use('GTKAgg')",
- "matplotlib.interactive(1)",
- "import matplotlib.pylab as pylab",
- "from matplotlib.pylab import *\n"]
-
- map(push,lines)
-
- # Execute file if given.
- if len(sys.argv)>1:
- import matplotlib
- matplotlib.interactive(0) # turn off interaction
- fname = sys.argv[1]
- try:
- inFile = file(fname, 'r')
- except IOError:
- print '*** ERROR *** Could not read file <%s>' % fname
- else:
- print '*** Executing file <%s>:' % fname
- for line in inFile:
- if line.lstrip().find('show()')==0: continue
- print '>>', line,
- push(line)
- inFile.close()
- matplotlib.interactive(1) # turn on interaction
-
-if __name__ == '__main__':
- # Quick sys.argv hack to extract the option and leave filenames in sys.argv.
- # For real option handling, use optparse or getopt.
- if len(sys.argv) > 1 and sys.argv[1]=='-pylab':
- sys.argv = [sys.argv[0]]+sys.argv[2:]
- MatplotLibInterpreter().mainloop()
- else:
- GTKInterpreter().mainloop()
Deleted: trunk/matplotlib/examples/pylab/interactive2.py
===================================================================
--- trunk/matplotlib/examples/pylab/interactive2.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/interactive2.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,378 +0,0 @@
-#!/usr/bin/env python
-
-# GTK Interactive Console
-# (C) 2003, Jon Anderson
-# See www.python.org/2.2/license.html for
-# license details.
-#
-import gtk
-import gtk.gdk
-
-import code
-import os, sys
-import pango
-
-import __builtin__
-import __main__
-
-
-banner = """GTK Interactive Python Console
-Thanks to Jon Anderson
-%s
-""" % sys.version
-
-banner += """
-
-Welcome to matplotlib.
-
- help(matplotlib) -- shows a list of all matlab(TM) compatible commands provided
- help(plotting) -- shows a list of plot specific commands
-
-"""
-class Completer:
- """
- Taken from rlcompleter, with readline references stripped, and a local dictionary to use.
- """
- def __init__(self, locals):
- self.locals = locals
-
- def complete(self, text, state):
- """Return the next possible completion for 'text'.
- This is called successively with state == 0, 1, 2, ... until it
- returns None. The completion should begin with 'text'.
-
- """
- if state == 0:
- if "." in text:
- self.matches = self.attr_matches(text)
- else:
- self.matches = self.global_matches(text)
- try:
- return self.matches[state]
- except IndexError:
- return None
-
- def global_matches(self, text):
- """Compute matches when text is a simple name.
-
- Return a list of all keywords, built-in functions and names
- currently defines in __main__ that match.
-
- """
- import keyword
- matches = []
- n = len(text)
- for list in [keyword.kwlist,__builtin__.__dict__.keys(),__main__.__dict__.keys(), self.locals.keys()]:
- for word in list:
- if word[:n] == text and word != "__builtins__":
- matches.append(word)
- return matches
-
- def attr_matches(self, text):
- """Compute matches when text contains a dot.
-
- Assuming the text is of the form NAME.NAME....[NAME], and is
- evaluatable in the globals of __main__, it will be evaluated
- and its attributes (as revealed by dir()) are used as possible
- completions. (For class instances, class members are are also
- considered.)
-
- WARNING: this can still invoke arbitrary C code, if an object
- with a __getattr__ hook is evaluated.
-
- """
- import re
- m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
- if not m:
- return
- expr, attr = m.group(1, 3)
- object = eval(expr, __main__.__dict__, self.locals)
- words = dir(object)
- if hasattr(object,'__class__'):
- words.append('__class__')
- words = words + get_class_members(object.__class__)
- matches = []
- n = len(attr)
- for word in words:
- if word[:n] == attr and word != "__builtins__":
- matches.append("%s.%s" % (expr, word))
- return matches
-
-def get_class_members(klass):
- ret = dir(klass)
- if hasattr(klass,'__bases__'):
- for base in klass.__bases__:
- ret = ret + get_class_members(base)
- return ret
-
-
-
-class OutputStream:
- """
- A Multiplexing output stream.
- It can replace another stream, and tee output to the original stream and too
- a GTK textview.
- """
- def __init__(self,view,old_out,style):
- self.view = view
- self.buffer = view.get_buffer()
- self.mark = self.buffer.create_mark("End",self.buffer.get_end_iter(), False )
- self.out = old_out
- self.style = style
- self.tee = 1
-
- def write(self,text):
- if self.tee:
- self.out.write(text)
-
- end = self.buffer.get_end_iter()
-
- if not self.view == None:
- self.view.scroll_to_mark(self.mark, 0, True, 1, 1)
-
- self.buffer.insert_with_tags(end,text,self.style)
-
-class GTKInterpreterConsole(gtk.ScrolledWindow):
- """
- An InteractiveConsole for GTK. It's an actual widget,
- so it can be dropped in just about anywhere.
- """
- def __init__(self):
- gtk.ScrolledWindow.__init__(self)
- self.set_policy (gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
-
- self.text = gtk.TextView()
- self.text.set_wrap_mode(True)
-
- self.interpreter = code.InteractiveInterpreter()
-
- self.completer = Completer(self.interpreter.locals)
- self.buffer = []
- self.history = []
- self.banner = banner
- self.ps1 = ">>> "
- self.ps2 = "... "
-
- self.text.add_events( gtk.gdk.KEY_PRESS_MASK )
- self.text.connect( "key_press_event", self.key_pressed )
-
- self.current_history = -1
-
- self.mark = self.text.get_buffer().create_mark("End",self.text.get_buffer().get_end_iter(), False )
-
- #setup colors
- self.style_banner = gtk.TextTag("banner")
- self.style_banner.set_property( "foreground", "saddle brown" )
-
- self.style_ps1 = gtk.TextTag("ps1")
- self.style_ps1.set_property( "foreground", "DarkOrchid4" )
- self.style_ps1.set_property( "editable", False )
- self.style_ps1.set_property("font", "courier" )
-
- self.style_ps2 = gtk.TextTag("ps2")
- self.style_ps2.set_property( "foreground", "DarkOliveGreen" )
- self.style_ps2.set_property( "editable", False )
- self.style_ps2.set_property("font", "courier" )
-
- self.style_out = gtk.TextTag("stdout")
- self.style_out.set_property( "foreground", "midnight blue" )
- self.style_err = gtk.TextTag("stderr")
- self.style_err.set_property( "style", pango.STYLE_ITALIC )
- self.style_err.set_property( "foreground", "red" )
-
- self.text.get_buffer().get_tag_table().add(self.style_banner)
- self.text.get_buffer().get_tag_table().add(self.style_ps1)
- self.text.get_buffer().get_tag_table().add(self.style_ps2)
- self.text.get_buffer().get_tag_table().add(self.style_out)
- self.text.get_buffer().get_tag_table().add(self.style_err)
-
- self.stdout = OutputStream(self.text,sys.stdout,self.style_out)
- self.stderr = OutputStream(self.text,sys.stderr,self.style_err)
-
- sys.stderr = self.stderr
- sys.stdout = self.stdout
-
- self.current_prompt = None
-
- self.write_line(self.banner, self.style_banner)
- self.prompt_ps1()
-
- self.add(self.text)
- self.text.show()
-
-
- def reset_history(self):
- self.history = []
-
- def reset_buffer(self):
- self.buffer = []
-
- def prompt_ps1(self):
- self.current_prompt = self.prompt_ps1
- self.write_line(self.ps1,self.style_ps1)
-
- def prompt_ps2(self):
- self.current_prompt = self.prompt_ps2
- self.write_line(self.ps2,self.style_ps2)
-
- def write_line(self,text,style=None):
- start,end = self.text.get_buffer().get_bounds()
- if style==None:
- self.text.get_buffer().insert(end,text)
- else:
- self.text.get_buffer().insert_with_tags(end,text,style)
-
- self.text.scroll_to_mark(self.mark, 0, True, 1, 1)
-
- def push(self, line):
-
- self.buffer.append(line)
- if len(line) > 0:
- self.history.append(line)
-
- source = "\n".join(self.buffer)
-
- more = self.interpreter.runsource(source, "<<console>>")
-
- if not more:
- self.reset_buffer()
-
- return more
-
- def key_pressed(self,widget,event):
- if event.keyval == gtk.gdk.keyval_from_name('Return'):
- return self.execute_line()
-
- if event.keyval == gtk.gdk.keyval_from_name('Up'):
- self.current_history = self.current_history - 1
- if self.current_history < - len(self.history):
- self.current_history = - len(self.history)
- return self.show_history()
- elif event.keyval == gtk.gdk.keyval_from_name('Down'):
- self.current_history = self.current_history + 1
- if self.current_history > 0:
- self.current_history = 0
- return self.show_history()
- elif event.keyval == gtk.gdk.keyval_from_name( 'Home'):
- l = self.text.get_buffer().get_line_count() - 1
- start = self.text.get_buffer().get_iter_at_line_offset(l,4)
- self.text.get_buffer().place_cursor(start)
- return True
- elif event.keyval == gtk.gdk.keyval_from_name( 'space') and event.state & gtk.gdk.CONTROL_MASK:
- return self.complete_line()
- return False
-
- def show_history(self):
- if self.current_history == 0:
- return True
- else:
- self.replace_line( self.history[self.current_history] )
- return True
-
- def current_line(self):
- start,end = self.current_line_bounds()
- return self.text.get_buffer().get_text(start,end, True)
-
- def current_line_bounds(self):
- txt_buffer = self.text.get_buffer()
- l = txt_buffer.get_line_count() - 1
-
- start = txt_buffer.get_iter_at_line(l)
- if start.get_chars_in_line() >= 4:
- start.forward_chars(4)
- end = txt_buffer.get_end_iter()
- return start,end
-
- def replace_line(self,txt):
- start,end = self.current_line_bounds()
- self.text.get_buffer().delete(start,end)
- self.write_line(txt)
-
- def execute_line(self, line=None):
- if line is None:
- line = self.current_line()
- self.write_line("\n")
- else:
- self.write_line(line + "\n")
-
-
- more = self.push(line)
-
- self.text.get_buffer().place_cursor(self.text.get_buffer().get_end_iter())
-
- if more:
- self.prompt_ps2()
- else:
- self.prompt_ps1()
-
-
- self.current_history = 0
-
- self.window.raise_()
-
- return True
-
- def complete_line(self):
- line = self.current_line()
- tokens = line.split()
- token = tokens[-1]
-
- completions = []
- p = self.completer.complete(token,len(completions))
- while p != None:
- completions.append(p)
- p = self.completer.complete(token, len(completions))
-
- if len(completions) != 1:
- self.write_line("\n")
- self.write_line("\n".join(completions), self.style_ps1)
- self.write_line("\n")
- self.current_prompt()
- self.write_line(line)
- else:
- i = line.rfind(token)
- line = line[0:i] + completions[0]
- self.replace_line(line)
-
- return True
-
-
-def main():
- w = gtk.Window()
- console = GTKInterpreterConsole()
- console.set_size_request(640,480)
- w.add(console)
-
- def destroy(arg=None):
- gtk.main_quit()
-
- def key_event(widget,event):
- if gtk.gdk.keyval_name( event.keyval) == 'd' and \
- event.state & gtk.gdk.CONTROL_MASK:
- destroy()
- return False
-
- w.connect("destroy", destroy)
-
- w.add_events( gtk.gdk.KEY_PRESS_MASK )
- w.connect( 'key_press_event', key_event)
- w.show_all()
-
- console.execute_line('import matplotlib')
- console.execute_line("matplotlib.use('GTKAgg')")
- console.execute_line('matplotlib.interactive(1)')
- console.execute_line('from pylab import *')
-
-
- if len(sys.argv)>1:
- fname = sys.argv[1]
- if not os.path.exists(fname):
- print >> sys.stderr, '%s does not exist' % fname
- for line in file(fname):
- line = line.strip()
-
- console.execute_line(line)
- gtk.main()
-
-if __name__ == '__main__':
- main()
Deleted: trunk/matplotlib/examples/pylab/keypress_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab/keypress_demo.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/keypress_demo.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,23 +0,0 @@
-#!/usr/bin/env python
-"""
-Show how to connect to keypress events
-"""
-import numpy as n
-from pylab import figure, show
-
-def press(event):
- print 'press', event.key
- if event.key=='x':
- visible = xl.get_visible()
- xl.set_visible(not visible)
- fig.canvas.draw()
-
-fig = figure()
-ax = fig.add_subplot(111)
-
-fig.canvas.mpl_connect('key_press_event', press)
-
-ax.plot(n.random.rand(12), n.random.rand(12), 'go')
-xl = ax.set_xlabel('easy come, easy go')
-
-show()
Deleted: trunk/matplotlib/examples/pylab/lineprops_dialog_gtk.py
===================================================================
--- trunk/matplotlib/examples/pylab/lineprops_dialog_gtk.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/lineprops_dialog_gtk.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,25 +0,0 @@
-import matplotlib
-matplotlib.use('GTKAgg')
-from matplotlib.backends.backend_gtk import DialogLineprops
-
-import numpy as np
-from pylab import figure, show
-
-def f(t):
- s1 = np.cos(2*np.pi*t)
- e1 = np.exp(-t)
- return np.multiply(s1,e1)
-
-t1 = np.arange(0.0, 5.0, 0.1)
-t2 = np.arange(0.0, 5.0, 0.02)
-t3 = np.arange(0.0, 2.0, 0.01)
-
-fig = figure()
-ax = fig.add_subplot(111)
-l1, = ax.plot(t1, f(t1), 'bo', label='line 1')
-l2, = ax.plot(t2, f(t2), 'k--', label='line 2')
-
-dlg = DialogLineprops([l1,l2])
-dlg.show()
-show()
-
Deleted: trunk/matplotlib/examples/pylab/pick_event_demo2.py
===================================================================
--- trunk/matplotlib/examples/pylab/pick_event_demo2.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/pick_event_demo2.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,45 +0,0 @@
-"""
-compute the mean and stddev of 100 data sets and plot mean vs stddev.
-When you click on one of the mu, sigma points, plot the raw data from
-the dataset that generated the mean and stddev
-"""
-import numpy
-from pylab import figure, show
-
-
-X = numpy.random.rand(100, 1000)
-xs = numpy.mean(X, axis=1)
-ys = numpy.std(X, axis=1)
-
-fig = figure()
-ax = fig.add_subplot(111)
-ax.set_title('click on point to plot time series')
-line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance
-
-
-def onpick(event):
-
- if event.artist!=line: return True
-
- N = len(event.ind)
- if not N: return True
-
-
- figi = figure()
- for subplotnum, dataind in enumerate(event.ind):
- ax = figi.add_subplot(N,1,subplotnum+1)
- ax.plot(X[dataind])
- ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]),
- transform=ax.transAxes, va='top')
- ax.set_ylim(-0.5, 1.5)
- figi.show()
- return True
-
-fig.canvas.mpl_connect('pick_event', onpick)
-
-show()
-
-
-
-
-
Deleted: trunk/matplotlib/examples/pylab/poly_editor.py
===================================================================
--- trunk/matplotlib/examples/pylab/poly_editor.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/poly_editor.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,171 +0,0 @@
-"""
-This is an example to show how to build cross-GUI applications using
-matplotlib event handling to interact with objects on the canvas
-
-"""
-from matplotlib.artist import Artist
-from matplotlib.patches import Polygon, CirclePolygon
-from numpy import sqrt, nonzero, equal, array, asarray, dot, amin, cos, sin
-from matplotlib.mlab import dist_point_to_segment
-
-
-class PolygonInteractor:
- """
- An polygon editor.
-
- Key-bindings
-
- 't' toggle vertex markers on and off. When vertex markers are on,
- you can move them, delete them
-
- 'd' delete the vertex under point
-
- 'i' insert a vertex at point. You must be within epsilon of the
- line connecting two existing vertices
-
- """
-
- showverts = True
- epsilon = 5 # max pixel distance to count as a vertex hit
-
- def __init__(self, ax, poly):
- if poly.figure is None:
- raise RuntimeError('You must first add the polygon to a figure or canvas before defining the interactor')
- self.ax = ax
- canvas = poly.figure.canvas
- self.poly = poly
-
- x, y = zip(*self.poly.xy)
- self.line = Line2D(x,y,marker='o', markerfacecolor='r', animated=True)
- self.ax.add_line(self.line)
- #self._update_line(poly)
-
- cid = self.poly.add_callback(self.poly_changed)
- self._ind = None # the active vert
-
- canvas.mpl_connect('draw_event', self.draw_callback)
- canvas.mpl_connect('button_press_event', self.button_press_callback)
- canvas.mpl_connect('key_press_event', self.key_press_callback)
- canvas.mpl_connect('button_release_event', self.button_release_callback)
- canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
- self.canvas = canvas
-
-
- def draw_callback(self, event):
- self.background = self.canvas.copy_from_bbox(self.ax.bbox)
- self.ax.draw_artist(self.poly)
- self.ax.draw_artist(self.line)
- self.canvas.blit(self.ax.bbox)
-
- def poly_changed(self, poly):
- 'this method is called whenever the polygon object is called'
- # only copy the artist props to the line (except visibility)
- vis = self.line.get_visible()
- Artist.update_from(self.line, poly)
- self.line.set_visible(vis) # don't use the poly visibility state
-
-
- def get_ind_under_point(self, event):
- 'get the index of the vertex under point if within epsilon tolerance'
-
- # display coords
- xy = asarray(self.poly.xy)
- xyt = self.poly.get_transform().transform(xy)
- xt, yt = xyt[:, 0], xyt[:, 1]
- d = sqrt((xt-event.x)**2 + (yt-event.y)**2)
- indseq = nonzero(equal(d, amin(d)))[0]
- ind = indseq[0]
-
- if d[ind]>=self.epsilon:
- ind = None
-
- return ind
-
- def button_press_callback(self, event):
- 'whenever a mouse button is pressed'
- if not self.showverts: return
- if event.inaxes==None: return
- if event.button != 1: return
- self._ind = self.get_ind_under_point(event)
-
- def button_release_callback(self, event):
- 'whenever a mouse button is released'
- if not self.showverts: return
- if event.button != 1: return
- self._ind = None
-
- def key_press_callback(self, event):
- 'whenever a key is pressed'
- if not event.inaxes: return
- if event.key=='t':
- self.showverts = not self.showverts
- self.line.set_visible(self.showverts)
- if not self.showverts: self._ind = None
- elif event.key=='d':
- ind = self.get_ind_under_point(event)
- if ind is not None:
- self.poly.xy = [tup for i,tup in enumerate(self.poly.xy) if i!=ind]
- self.line.set_data(zip(*self.poly.xy))
- elif event.key=='i':
- xys = self.poly.get_transform().transform(self.poly.xy)
- p = event.x, event.y # display coords
- for i in range(len(xys)-1):
- s0 = xys[i]
- s1 = xys[i+1]
- d = dist_point_to_segment(p, s0, s1)
- if d<=self.epsilon:
- self.poly.xy = array(
- list(self.poly.xy[:i]) +
- [(event.xdata, event.ydata)] +
- list(self.poly.xy[i:]))
- self.line.set_data(zip(*self.poly.xy))
- break
-
-
- self.canvas.draw()
-
- def motion_notify_callback(self, event):
- 'on mouse movement'
- if not self.showverts: return
- if self._ind is None: return
- if event.inaxes is None: return
- if event.button != 1: return
- x,y = event.xdata, event.ydata
-
- self.poly.xy[self._ind] = x,y
- self.line.set_data(zip(*self.poly.xy))
-
- self.canvas.restore_region(self.background)
- self.ax.draw_artist(self.poly)
- self.ax.draw_artist(self.line)
- self.canvas.blit(self.ax.bbox)
-
-
-
-from pylab import *
-
-
-
-
-
-fig = figure()
-theta = arange(0, 2*pi, 0.1)
-r = 1.5
-
-xs = r*cos(theta)
-ys = r*sin(theta)
-
-poly = Polygon(zip(xs, ys,), animated=True)
-
-
-
-
-ax = subplot(111)
-ax.add_patch(poly)
-p = PolygonInteractor( ax, poly)
-
-#ax.add_line(p.line)
-ax.set_title('Click and drag a point to move it')
-ax.set_xlim((-2,2))
-ax.set_ylim((-2,2))
-show()
Deleted: trunk/matplotlib/examples/pylab/pylab_with_gtk.py
===================================================================
--- trunk/matplotlib/examples/pylab/pylab_with_gtk.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/pylab_with_gtk.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,54 +0,0 @@
-"""
-An example of how to use pylab to manage your figure windows, but
-modify the GUI by accessing the underlying gtk widgets
-"""
-import matplotlib
-matplotlib.use('GTKAgg')
-from pylab import get_current_fig_manager, subplot, plot, legend, connect, show
-
-ax = subplot(111)
-plot([1,2,3], 'ro-', label='easy as 1 2 3')
-plot([1,4,9], 'gs--', label='easy as 1 2 3 squared')
-legend()
-
-
-manager = get_current_fig_manager()
-# you can also access the window or vbox attributes this way
-toolbar = manager.toolbar
-
-# now let's add a button to the toolbar
-import gtk
-next = 8; #where to insert this in the mpl toolbar
-button = gtk.Button('Click me')
-button.show()
-
-def clicked(button):
- print 'hi mom'
-button.connect('clicked', clicked)
-
-toolitem = gtk.ToolItem()
-toolitem.show()
-toolitem.set_tooltip(
- toolbar.tooltips,
- 'Click me for fun and profit')
-
-toolitem.add(button)
-toolbar.insert(toolitem, next); next +=1
-
-# now let's add a widget to the vbox
-label = gtk.Label()
-label.set_markup('Drag mouse over axes for position')
-label.show()
-vbox = manager.vbox
-vbox.pack_start(label, False, False)
-vbox.reorder_child(manager.toolbar, -1)
-
-def update(event):
- if event.xdata is None:
- label.set_markup('Drag mouse over axes for position')
- else:
- label.set_markup('<span color="#ef0000">x,y=(%f, %f)</span>'%(event.xdata, event.ydata))
-
-connect('motion_notify_event', update)
-
-show()
Deleted: trunk/matplotlib/examples/pylab/strip_chart_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab/strip_chart_demo.py 2008-05-17 22:05:52 UTC (rev 5186)
+++ trunk/matplotlib/examples/pylab/strip_chart_demo.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -1,72 +0,0 @@
-"""
-Emulate an oscilloscope. Requires the animation API introduced in
-matplotlib 0.84. See
-http://www.scipy.org/wikis/topical_software/Animations for an
-explanation.
-
-This example uses gtk but does not depend on it intimately. It just
-uses the idle handler to trigger events. You can plug this into a
-different GUI that supports animation (GTKAgg, TkAgg, WXAgg) and use
-your toolkits idle/timer functions.
-"""
-import gobject, gtk
-import matplotlib
-matplotlib.use('GTKAgg')
-import numpy as np
-from matplotlib.lines import Line2D
-
-
-class Scope:
- def __init__(self, ax, maxt=10, dt=0.01):
- self.ax = ax
- self.canvas = ax.figure.canvas
- self.dt = dt
- self.maxt = maxt
- self.tdata = [0]
- self.ydata = [0]
- self.line = Line2D(self.tdata, self.ydata, animated=True)
- self.ax.add_line(self.line)
- self.background = None
- self.canvas.mpl_connect('draw_event', self.update_background)
- self.ax.set_ylim(-.1, 1.1)
- self.ax.set_xlim(0, self.maxt)
-
- def update_background(self, event):
- self.background = self.canvas.copy_from_bbox(self.ax.bbox)
-
- def emitter(self, p=0.01):
- 'return a random value with probability p, else 0'
- v = np.random.rand(1)
- if v>p: return 0.
- else: return np.random.rand(1)
-
- def update(self, *args):
- if self.background is None: return True
- y = self.emitter()
- lastt = self.tdata[-1]
- if lastt>self.tdata[0]+self.maxt: # reset the arrays
- self.tdata = [self.tdata[-1]]
- self.ydata = [self.ydata[-1]]
- self.ax.set_xlim(self.tdata[0], self.tdata[0]+self.maxt)
- self.ax.figure.canvas.draw()
-
- self.canvas.restore_region(self.background)
-
- t = self.tdata[-1] + self.dt
- self.tdata.append(t)
- self.ydata.append(y)
- self.line.set_data(self.tdata, self.ydata)
- self.ax.draw_artist(self.line)
-
- self.canvas.blit(self.ax.bbox)
- return True
-
-
-from pylab import figure, show
-
-fig = figure()
-ax = fig.add_subplot(111)
-scope = Scope(ax)
-gobject.idle_add(scope.update)
-
-show()
Copied: trunk/matplotlib/examples/user_interfaces/interactive.py (from rev 5186, trunk/matplotlib/examples/pylab/interactive.py)
===================================================================
--- trunk/matplotlib/examples/user_interfaces/interactive.py (rev 0)
+++ trunk/matplotlib/examples/user_interfaces/interactive.py 2008-05-18 21:06:13 UTC (rev 5187)
@@ -0,0 +1,230 @@
+#!/usr/bin/env python
+"""Multithreaded interactive interpreter with GTK and Matplotlib support.
+
+Usage:
+
+ pyint-gtk.py -> starts shell with gtk thread running separately
+
+ pyint-gtk.py -pylab [filename] -> initializes matplotlib, optionally running
+ the named file. The shell starts after the file is executed.
+
+Threading code taken from:
+http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by Brian
+McErlean and John Finlay.
+
+Matplotlib support taken from interactive.py in the matplotlib distribution.
+
+Also borrows liberally from code.py in the Python standard library."""
+
+__author__ = "Fernando Perez <Fer...@co...>"
+
+import sys
+import code
+import threading
+
+import gobject
+import gtk
+
+try:
+ import readline
+except ImportError:
+ has_readline = False
+else:
+ has_readline = True
+
+class MTConsole(code.InteractiveConsole):
+ """Simple multi-threaded shell"""
+
+ def __init__(self,on_kill=None,*args,**kw):
+ code.InteractiveConsole.__init__(self,*args,**kw)
+ self.code_to_run = None
+ self.ready = threading.Condition()
+ self._kill = False
+ if on_kill is None:
+ on_kill = []
+ # Check that all things to kill are callable:
+ for _ in on_kill:
+ if not callable(_):
+ raise TypeError,'on_kill must be a list of callables'
+ self.on_kill = on_kill
+ # Set up tab-completer
+ if has_readline:
+ import rlcompleter
+ try: # this form only works with python 2.3
+ self.completer = rlcompleter.Completer(self.locals)
+ except: # simpler for py2.2
+ self.completer = rlcompleter.Completer()
+
+ readline.set_completer(self.completer.complete)
+ # Use tab for completions
+ readline.parse_and_bind('tab: complete')
+ # This forces readline to automatically print the above list when tab
+ # completion is set to 'complete'.
+ readline.parse_and_bind('set show-all-if-ambiguous on')
+ # Bindings for incremental searches in the history. These searches
+ # use the string typed so far on the command line and search
+ # anything in the previous input history containing them.
+ readline.parse_and_bind('"\C-r": reverse-search-history')
+ readline.parse_and_bind('"\C-s": forward-search-history')
+
+ def runsource(self, source, filename="<input>", symbol="single"):
+ """Compile and run some source in the interpreter.
+
+ Arguments are as for compile_command().
+
+ One several things can happen:
+
+ 1) The input is incorrect; compile_command() raised an
+ exception (SyntaxError or OverflowError). A syntax traceback
+ will be printed by calling the showsyntaxerror() method.
+
+ 2) The input is incomplete, and more input is required;
+ compile_command() returned None. Nothing happens.
+
+ 3) The input is complete; compile_command() returned a code
+ object. The code is executed by calling self.runcode() (which
+ also handles run-time exceptions, except for SystemExit).
+
+ The return v...
[truncated message content] |