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-08-14 13:38:04
|
Revision: 6036
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6036&view=rev
Author: mdboom
Date: 2008-08-14 13:38:01 +0000 (Thu, 14 Aug 2008)
Log Message:
-----------
Remove deprecated Numpy call.
Modified Paths:
--------------
trunk/matplotlib/src/_backend_gdk.c
Modified: trunk/matplotlib/src/_backend_gdk.c
===================================================================
--- trunk/matplotlib/src/_backend_gdk.c 2008-08-13 18:25:26 UTC (rev 6035)
+++ trunk/matplotlib/src/_backend_gdk.c 2008-08-14 13:38:01 UTC (rev 6036)
@@ -12,15 +12,6 @@
static PyTypeObject *_PyGdkPixbuf_Type;
#define PyGdkPixbuf_Type (*_PyGdkPixbuf_Type)
-/* Implement the equivalent to gtk.gdk.Pixbuf.get_pixels_array()
- * To solve these problems with the pygtk version:
- * 1) It works for Numeric, but not numarray
- * 2) Its only available if pygtk is compiled with Numeric support
- * Fedora 1,2,3 has PyGTK, but not Numeric and so does not have
- * Pixbuf.get_pixels_array().
- * Fedora 4 does have PyGTK, Numeric and Pixbuf.get_pixels_array()
- */
-
static PyObject *
pixbuf_get_pixels_array(PyObject *self, PyObject *args)
{
@@ -45,7 +36,7 @@
if (gdk_pixbuf_get_has_alpha(gdk_pixbuf))
dims[2] = 4;
- array = (PyArrayObject *)PyArray_FromDimsAndData(3, dims, PyArray_UBYTE,
+ array = (PyArrayObject *)PyArray_SimpleNewFromData(3, dims, PyArray_UBYTE,
(char *)gdk_pixbuf_get_pixels(gdk_pixbuf));
if (array == NULL)
return NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-13 18:25:32
|
Revision: 6035
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6035&view=rev
Author: mdboom
Date: 2008-08-13 18:25:26 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
[ 2029956 ] Fix documentation warnings.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-08-13 18:10:33 UTC (rev 6034)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-08-13 18:25:26 UTC (rev 6035)
@@ -1464,7 +1464,7 @@
Call signature::
- stop_event_loop_default(self)
+ stop_event_loop_default(self)
"""
self._looping = False
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2008-08-13 18:10:33 UTC (rev 6034)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2008-08-13 18:25:26 UTC (rev 6035)
@@ -40,10 +40,12 @@
Arguments:
*X*, *Y*:
- The x and y coordinates of the arrow locations
- (default is tail of arrow; see *pivot* kwarg)
+ The x and y coordinates of the arrow locations (default is tail of
+ arrow; see *pivot* kwarg)
+
*U*, *V*:
+
give the *x* and *y* components of the arrow vectors
*C*:
@@ -61,28 +63,31 @@
Keyword arguments:
*units*: ['width' | 'height' | 'dots' | 'inches' | 'x' | 'y' ]
- arrow units; the arrow dimensions *except for length* are
- in multiples of this unit.
+ arrow units; the arrow dimensions *except for length* are in
+ multiples of this unit.
* 'width' or 'height': the width or height of the axes
- * 'dots' or 'inches': pixels or inches, based on the figure dpi
+
+ * 'dots' or 'inches': pixels or inches, based on the figure dpi
+
* 'x' or 'y': *X* or *Y* data units
In all cases the arrow aspect ratio is 1, so that if *U*==*V* the
- angle of the arrow on the plot is 45 degrees CCW from the *x*-axis.
+ angle of the arrow on the plot is 45 degrees CCW from the
+ *x*-axis.
- The arrows scale differently depending on the units, however.
- For 'x' or 'y', the arrows get larger as one zooms in; for other
+ The arrows scale differently depending on the units, however. For
+ 'x' or 'y', the arrows get larger as one zooms in; for other
units, the arrow size is independent of the zoom state. For
'width or 'height', the arrow size increases with the width and
height of the axes, respectively, when the the window is resized;
for 'dots' or 'inches', resizing does not change the arrows.
*scale*: [ None | float ]
- data units per arrow unit, e.g. m/s per plot width;
- a smaller scale parameter makes the arrow longer.
- If *None*, a simple autoscaling algorithm is used, based
- on the average vector length and the number of vectors.
+ data units per arrow unit, e.g. m/s per plot width; a smaller
+ scale parameter makes the arrow longer. If *None*, a simple
+ autoscaling algorithm is used, based on the average vector length
+ and the number of vectors.
*width*:
shaft width in arrow units; default depends on choice of units,
@@ -109,8 +114,8 @@
Default is 1.
*pivot*: [ 'tail' | 'middle' | 'tip' ]
- The part of the arrow that is at the grid point; the arrow
- rotates about this point, hence the name *pivot*.
+ The part of the arrow that is at the grid point; the arrow rotates
+ about this point, hence the name *pivot*.
*color*: [ color | color sequence ]
This is a synonym for the
@@ -155,23 +160,23 @@
Keyword arguments:
*coordinates* = [ 'axes' | 'figure' | 'data' | 'inches' ]
- Coordinate system and units for *X*, *Y*: 'axes' and 'figure'
- are normalized coordinate systems with 0,0 in the lower
- left and 1,1 in the upper right; 'data' are the axes
- data coordinates (used for the locations of the vectors
- in the quiver plot itself); 'inches' is position in the
- figure in inches, with 0,0 at the lower left corner.
+ Coordinate system and units for *X*, *Y*: 'axes' and 'figure' are
+ normalized coordinate systems with 0,0 in the lower left and 1,1
+ in the upper right; 'data' are the axes data coordinates (used for
+ the locations of the vectors in the quiver plot itself); 'inches'
+ is position in the figure in inches, with 0,0 at the lower left
+ corner.
*color*:
overrides face and edge colors from *Q*.
*labelpos* = [ 'N' | 'S' | 'E' | 'W' ]
- Position the label above, below, to the right, to the left
- of the arrow, respectively.
+ Position the label above, below, to the right, to the left of the
+ arrow, respectively.
*labelsep*:
- Distance in inches between the arrow and the label.
- Default is 0.1
+ Distance in inches between the arrow and the label. Default is
+ 0.1
*labelcolor*:
defaults to default :class:`~matplotlib.text.Text` color.
@@ -557,88 +562,100 @@
Default is 9
*pivot*: [ 'tip' | 'middle' ]
- The part of the arrow that is at the grid point; the arrow
- rotates about this point, hence the name *pivot*.
- Default is 'tip'
+ The part of the arrow that is at the grid point; the arrow rotates
+ about this point, hence the name *pivot*. Default is 'tip'
*barbcolor*: [ color | color sequence ]
- Specifies the color all parts of the barb except any flags.
- This parameter is analagous to the *edgecolor* parameter
- for polygons, which can be used instead. However this parameter
- will override facecolor.
+ Specifies the color all parts of the barb except any flags. This
+ parameter is analagous to the *edgecolor* parameter for polygons,
+ which can be used instead. However this parameter will override
+ facecolor.
*flagcolor*: [ color | color sequence ]
- Specifies the color of any flags on the barb.
- This parameter is analagous to the *facecolor* parameter
- for polygons, which can be used instead. However this parameter
- will override facecolor. If this is not set (and *C* has not either)
- then *flagcolor* will be set to match *barbcolor* so that the barb
- has a uniform color. If *C* has been set, *flagcolor* has no effect.
+ Specifies the color of any flags on the barb. This parameter is
+ analagous to the *facecolor* parameter for polygons, which can be
+ used instead. However this parameter will override facecolor. If
+ this is not set (and *C* has not either) then *flagcolor* will be
+ set to match *barbcolor* so that the barb has a uniform color. If
+ *C* has been set, *flagcolor* has no effect.
*sizes*:
- A dictionary of coefficients specifying the ratio of a given feature
- to the length of the barb. Only those values one wishes to override
- need to be included. These features include:
- 'spacing' - space between features (flags, full/half barbs)
- 'height' - height (distance from shaft to top) of a flag or full barb
- 'width' - width of a flag, twice the width of a full barb
- 'emptybarb' - radius of the circle used for low magnitudes
+ A dictionary of coefficients specifying the ratio of a given
+ feature to the length of the barb. Only those values one wishes to
+ override need to be included. These features include:
+ - 'spacing' - space between features (flags, full/half barbs)
+
+ - 'height' - height (distance from shaft to top) of a flag or
+ full barb
+
+ - 'width' - width of a flag, twice the width of a full barb
+
+ - 'emptybarb' - radius of the circle used for low magnitudes
+
*fill_empty*:
- A flag on whether the empty barbs (circles) that are drawn should be filled
- with the flag color. If they are not filled, they will be drawn such that
- no color is applied to the center.
- Default is False
+ A flag on whether the empty barbs (circles) that are drawn should
+ be filled with the flag color. If they are not filled, they will
+ be drawn such that no color is applied to the center. Default is
+ False
*rounding*:
- A flag to indicate whether the vector magnitude should be rounded when
- allocating barb components. If True, the magnitude is rounded to the
- nearest multiple of the half-barb increment. If False, the magnitude
- is simply truncated to the next lowest multiple.
- Default is True
+ A flag to indicate whether the vector magnitude should be rounded
+ when allocating barb components. If True, the magnitude is
+ rounded to the nearest multiple of the half-barb increment. If
+ False, the magnitude is simply truncated to the next lowest
+ multiple. Default is True
*barb_increments*:
- A dictionary of increments specifying values to associate with different
- parts of the barb. Only those values one wishes to override need to be
- included.
- 'half' - half barbs (Default is 5)
- 'full' - full barbs (Default is 10)
- 'flag' - flags (default is 50)
+ A dictionary of increments specifying values to associate with
+ different parts of the barb. Only those values one wishes to
+ override need to be included.
+ - 'half' - half barbs (Default is 5)
+
+ - 'full' - full barbs (Default is 10)
+
+ - 'flag' - flags (default is 50)
+
*flip_barb*:
- Either a single boolean flag or an array of booleans. Single boolean
- indicates whether the lines and flags should point opposite to normal
- for all barbs. An array (which should be the same size as the other
- data arrays) indicates whether to flip for each individual barb.
- Normal behavior is for the barbs and lines to point right (comes from
- wind barbs having these features point towards low pressure in the
- Northern Hemisphere.)
- Default is False
+ Either a single boolean flag or an array of booleans. Single
+ boolean indicates whether the lines and flags should point
+ opposite to normal for all barbs. An array (which should be the
+ same size as the other data arrays) indicates whether to flip for
+ each individual barb. Normal behavior is for the barbs and lines
+ to point right (comes from wind barbs having these features point
+ towards low pressure in the Northern Hemisphere.) Default is
+ False
Barbs are traditionally used in meteorology as a way to plot the speed
-and direction of wind observations, but can technically be used to plot
-any two dimensional vector quantity. As opposed to arrows, which give
-vector magnitude by the length of the arrow, the barbs give more quantitative
-information about the vector magnitude by putting slanted lines or a triangle
-for various increments in magnitude, as show schematically below:
+and direction of wind observations, but can technically be used to
+plot any two dimensional vector quantity. As opposed to arrows, which
+give vector magnitude by the length of the arrow, the barbs give more
+quantitative information about the vector magnitude by putting slanted
+lines or a triangle for various increments in magnitude, as show
+schematically below::
- /\ \
- / \ \
- / \ \ \
-/ \ \ \
-------------------------------
+ : /\ \\
+ : / \ \\
+ : / \ \ \\
+ : / \ \ \\
+ : ------------------------------
-The largest increment is given by a triangle (or "flag"). After those come full
-lines (barbs). The smallest increment is a half line. There is only, of
-course, ever at most 1 half line. If the magnitude is small and only needs a
-single half-line and no full lines or triangles, the half-line is offset from
-the end of the barb so that it can be easily distinguished from barbs with a
-single full line. The magnitude for the barb shown above would nominally be
-65, using the standard increments of 50, 10, and 5.
+.. note the double \\ at the end of each line to make the figure
+.. render correctly
+The largest increment is given by a triangle (or "flag"). After those
+come full lines (barbs). The smallest increment is a half line. There
+is only, of course, ever at most 1 half line. If the magnitude is
+small and only needs a single half-line and no full lines or
+triangles, the half-line is offset from the end of the barb so that it
+can be easily distinguished from barbs with a single full line. The
+magnitude for the barb shown above would nominally be 65, using the
+standard increments of 50, 10, and 5.
+
linewidths and edgecolors can be used to customize the barb.
-Additional :class:`~matplotlib.collections.PolyCollection`
-keyword arguments:
+Additional :class:`~matplotlib.collections.PolyCollection` keyword
+arguments:
%(PolyCollection)s
""" % martist.kwdocd
@@ -647,15 +664,15 @@
'''
Specialized PolyCollection for barbs.
- The only API method is set_UVC(), which can be used
- to change the size, orientation, and color of the
- arrows. Locations are changed using the set_offsets() collection
- method.Possibly this method will be useful in animations.
+ The only API method is :meth:`set_UVC`, which can be used to
+ change the size, orientation, and color of the arrows. Locations
+ are changed using the :meth:`set_offsets` collection method.
+ Possibly this method will be useful in animations.
- There is one internal function _find_tails() which finds exactly
- what should be put on the barb given the vector magnitude. From there
- _make_barbs() is used to find the vertices of the polygon to represent the
- barb based on this information.
+ There is one internal function :meth:`_find_tails` which finds
+ exactly what should be put on the barb given the vector magnitude.
+ From there :meth:`_make_barbs` is used to find the vertices of the
+ polygon to represent the barb based on this information.
'''
#This may be an abuse of polygons here to render what is essentially maybe
#1 triangle and a series of lines. It works fine as far as I can tell
@@ -714,12 +731,15 @@
half a barb. Mag should be the magnitude of a vector (ie. >= 0).
This returns a tuple of:
- (number of flags, number of barbs, half_flag, empty_flag)
- half_flag is a boolean whether half of a barb is needed, since there
- should only ever be one half on a given barb. Empty flag is an array
- of flags to easily tell if a barb is empty (too low to plot any
- barbs/flags.'''
+ (*number of flags*, *number of barbs*, *half_flag*, *empty_flag*)
+
+ *half_flag* is a boolean whether half of a barb is needed,
+ since there should only ever be one half on a given
+ barb. *empty_flag* flag is an array of flags to easily tell if
+ a barb is empty (too low to plot any barbs/flags.
+ '''
+
#If rounding, round to the nearest multiple of half, the smallest
#increment
if rounding:
@@ -738,25 +758,41 @@
def _make_barbs(self, u, v, nflags, nbarbs, half_barb, empty_flag, length,
pivot, sizes, fill_empty, flip):
- '''This function actually creates the wind barbs. u and v are
- components of the vector in the x and y directions, respectively.
- nflags, nbarbs, and half_barb, empty_flag are, respectively, the number
- of flags, number of barbs, flag for half a barb, and flag for empty
- barb, ostensibly obtained from _find_tails. length is the length of
- the barb staff in points. pivot specifies the point on the barb around
- which the entire barb should be rotated. Right now valid options are
- 'head' and 'middle'. sizes is a dictionary of coefficients specifying
- the ratio of a given feature to the length of the barb. These features
+ '''This function actually creates the wind barbs. *u* and *v*
+ are components of the vector in the *x* and *y* directions,
+ respectively.
+
+ *nflags*, *nbarbs*, and *half_barb*, empty_flag* are,
+ *respectively, the number of flags, number of barbs, flag for
+ *half a barb, and flag for empty barb, ostensibly obtained
+ *from :meth:`_find_tails`.
+
+ *length* is the length of the barb staff in points.
+
+ *pivot* specifies the point on the barb around which the
+ entire barb should be rotated. Right now, valid options are
+ 'head' and 'middle'.
+
+ *sizes* is a dictionary of coefficients specifying the ratio
+ of a given feature to the length of the barb. These features
include:
- spacing - space between features (flags, full/half barbs)
- height - height (distance from shaft of top) of a flag or full barb
- width - width of a flag, twice the width of a full barb
- emptybarb - radius of the circle used for low magnitudes
+ - *spacing*: space between features (flags, full/half
+ barbs)
- fill_empty specifies whether the circle representing an empty barb
- should be filled or not (this changes the drawing of the polygon).
- flip is a flag indicating whether the features should be flipped to
+ - *height*: distance from shaft of top of a flag or full
+ barb
+
+ - *width* - width of a flag, twice the width of a full barb
+
+ - *emptybarb* - radius of the circle used for low
+ magnitudes
+
+ *fill_empty* specifies whether the circle representing an
+ empty barb should be filled or not (this changes the drawing
+ of the polygon).
+
+ *flip* is a flag indicating whether the features should be flipped to
the other side of the barb (useful for winds in the southern
hemisphere.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-13 18:10:38
|
Revision: 6034
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6034&view=rev
Author: mdboom
Date: 2008-08-13 18:10:33 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
Quiet the math -> png conversion.
Modified Paths:
--------------
trunk/matplotlib/doc/sphinxext/mathmpl.py
Modified: trunk/matplotlib/doc/sphinxext/mathmpl.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/mathmpl.py 2008-08-13 16:23:48 UTC (rev 6033)
+++ trunk/matplotlib/doc/sphinxext/mathmpl.py 2008-08-13 18:10:33 UTC (rev 6034)
@@ -100,7 +100,6 @@
if os.path.exists(filename):
depth = mathtext_parser.get_depth(latex, dpi=100)
else:
- print latex.encode("ascii", "backslashreplace")
try:
depth = mathtext_parser.to_png(filename, latex, dpi=100)
except:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-13 16:23:53
|
Revision: 6033
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6033&view=rev
Author: mdboom
Date: 2008-08-13 16:23:48 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
Fix formatting.
Modified Paths:
--------------
trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2008-08-13 16:20:18 UTC (rev 6032)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-08-13 16:23:48 UTC (rev 6033)
@@ -19,7 +19,7 @@
public:
PathIterator(const Py::Object& path_obj) :
- m_vertices(NULL), m_codes(NULL), m_iterator(0)
+ m_vertices(NULL), m_codes(NULL), m_iterator(0), m_should_simplify(false)
{
Py::Object vertices_obj = path_obj.getAttr("vertices");
Py::Object codes_obj = path_obj.getAttr("codes");
@@ -28,9 +28,10 @@
m_vertices = (PyArrayObject*)PyArray_FromObject
(vertices_obj.ptr(), PyArray_DOUBLE, 2, 2);
if (!m_vertices ||
- PyArray_NDIM(m_vertices) != 2 ||
PyArray_DIM(m_vertices, 1) != 2)
+ {
throw Py::ValueError("Invalid vertices array.");
+ }
if (codes_obj.ptr() != Py_None)
{
@@ -38,6 +39,8 @@
(codes_obj.ptr(), PyArray_UINT8, 1, 1);
if (!m_codes)
throw Py::ValueError("Invalid codes array.");
+ if (PyArray_DIM(m_codes, 0) != PyArray_DIM(m_vertices, 1))
+ throw Py::ValueError("Codes array is wrong length");
}
m_should_simplify = should_simplify_obj.isTrue();
@@ -79,11 +82,16 @@
if (m_iterator >= m_total_vertices) return agg::path_cmd_stop;
unsigned code = vertex_with_code(m_iterator++, x, y);
- if (MPL_notisfinite64(*x) || MPL_notisfinite64(*y)) {
- do {
- if (m_iterator < m_total_vertices) {
+ if (MPL_notisfinite64(*x) || MPL_notisfinite64(*y))
+ {
+ do
+ {
+ if (m_iterator < m_total_vertices)
+ {
vertex(m_iterator++, x, y);
- } else {
+ }
+ else
+ {
return agg::path_cmd_stop;
}
} while (MPL_notisfinite64(*x) || MPL_notisfinite64(*y));
@@ -207,7 +215,8 @@
// If the queue is now empty, and the path was fully consumed
// in the last call to the main loop, return agg::path_cmd_stop to
// signal that there are no more points to emit.
- if (m_done) {
+ if (m_done)
+ {
#if DEBUG_SIMPLIFY
printf(".\n");
#endif
@@ -376,21 +385,26 @@
//direction we are drawing in, move back to we start drawing from
//back there.
if (m_haveMin)
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY);
+ {
+ m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY);
+ }
m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY);
//if we clipped some segments between this line and the next line
//we are starting, we also need to move to the last point.
- if (m_clipped)
- m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty);
+ if (m_clipped) {
+ m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty);
+ }
else if (!m_lastMax)
+ {
//if the last line was not the longest line, then move back to
//the end point of the last line in the sequence. Only do this
//if not clipped, since in that case lastx,lasty is not part of
//the line just drawn.
//Would be move_to if not for the artifacts
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_lastx, m_lasty);
+ m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_lastx, m_lasty);
+ }
//now reset all the variables to get ready for the next line
m_origdx = *x - m_lastx;
@@ -421,7 +435,9 @@
if (m_origdNorm2 != 0)
{
if (m_haveMin)
+ {
m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY);
+ }
m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY);
}
m_done = true;
@@ -458,7 +474,8 @@
struct item
{
item() {}
- inline void set(const unsigned cmd_, const double& x_, const double& y_) {
+ inline void set(const unsigned cmd_, const double& x_, const double& y_)
+ {
cmd = cmd_;
x = x_;
y = y_;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-13 16:20:22
|
Revision: 6032
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6032&view=rev
Author: mdboom
Date: 2008-08-13 16:20:18 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
Minor fix to conversion of should_simplify.
Modified Paths:
--------------
trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2008-08-13 15:00:05 UTC (rev 6031)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-08-13 16:20:18 UTC (rev 6032)
@@ -40,7 +40,7 @@
throw Py::ValueError("Invalid codes array.");
}
- m_should_simplify = bool(Py::Int(should_simplify_obj));
+ m_should_simplify = should_simplify_obj.isTrue();
m_total_vertices = m_vertices->dimensions[0];
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-13 15:00:10
|
Revision: 6031
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6031&view=rev
Author: mdboom
Date: 2008-08-13 15:00:05 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
Raise ImportError rather than SystemExit --
that is, importing an improperly configured matplotlib should not quit the Python console.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/__init__.py
trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
trunk/matplotlib/lib/matplotlib/finance.py
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py 2008-08-13 14:09:04 UTC (rev 6030)
+++ trunk/matplotlib/lib/matplotlib/__init__.py 2008-08-13 15:00:05 UTC (rev 6031)
@@ -144,12 +144,12 @@
#else: _have_pkg_resources = True
if not _python24:
- raise SystemExit('matplotlib requires Python 2.4 or later')
+ raise ImportError('matplotlib requires Python 2.4 or later')
import numpy
nn = numpy.__version__.split('.')
if not (int(nn[0]) >= 1 and int(nn[1]) >= 1):
- raise SystemExit(
+ raise ImportError(
'numpy 1.1 or later is required; you have %s' % numpy.__version__)
def is_string_like(obj):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2008-08-13 14:09:04 UTC (rev 6030)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2008-08-13 15:00:05 UTC (rev 6031)
@@ -28,7 +28,7 @@
import cairo
_version_required = (1,2,0)
if cairo.version_info < _version_required:
- raise SystemExit ("Pycairo %d.%d.%d is installed\n"
+ raise ImportError ("Pycairo %d.%d.%d is installed\n"
"Pycairo %d.%d.%d or later is required"
% (cairo.version_info + _version_required))
backend_version = cairo.version
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py 2008-08-13 14:09:04 UTC (rev 6030)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py 2008-08-13 15:00:05 UTC (rev 6031)
@@ -11,7 +11,7 @@
import pango
pygtk_version_required = (2,2,0)
if gtk.pygtk_version < pygtk_version_required:
- raise SystemExit ("PyGTK %d.%d.%d is installed\n"
+ raise ImportError ("PyGTK %d.%d.%d is installed\n"
"PyGTK %d.%d.%d or later is required"
% (gtk.pygtk_version + pygtk_version_required))
del pygtk_version_required
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-08-13 14:09:04 UTC (rev 6030)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-08-13 15:00:05 UTC (rev 6031)
@@ -8,7 +8,7 @@
import pango
pygtk_version_required = (2,2,0)
if gtk.pygtk_version < pygtk_version_required:
- raise SystemExit ("PyGTK %d.%d.%d is installed\n"
+ raise ImportError ("PyGTK %d.%d.%d is installed\n"
"PyGTK %d.%d.%d or later is required"
% (gtk.pygtk_version + pygtk_version_required))
del pygtk_version_required
Modified: trunk/matplotlib/lib/matplotlib/finance.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/finance.py 2008-08-13 14:09:04 UTC (rev 6030)
+++ trunk/matplotlib/lib/matplotlib/finance.py 2008-08-13 15:00:05 UTC (rev 6031)
@@ -14,7 +14,7 @@
try: import datetime
except ImportError:
- raise SystemExit('The finance module requires datetime support (python2.3)')
+ raise ImportError('The finance module requires datetime support (python2.3)')
import numpy as np
@@ -415,7 +415,7 @@
# note this code assumes if any value open, close, low, high is
# missing they all are missing
-
+
delta = width/2.
barVerts = [ ( (i-delta, open), (i-delta, close), (i+delta, close), (i+delta, open) ) for i, open, close in zip(xrange(len(opens)), opens, closes) if open != -1 and close!=-1 ]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-13 14:09:07
|
Revision: 6030
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6030&view=rev
Author: mdboom
Date: 2008-08-13 14:09:04 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
Bumping version number.
Modified Paths:
--------------
trunk/py4science/examples/sphinx_template/conf.py
Modified: trunk/py4science/examples/sphinx_template/conf.py
===================================================================
--- trunk/py4science/examples/sphinx_template/conf.py 2008-08-13 13:11:51 UTC (rev 6029)
+++ trunk/py4science/examples/sphinx_template/conf.py 2008-08-13 14:09:04 UTC (rev 6030)
@@ -48,9 +48,9 @@
# other places throughout the built documents.
#
# The short X.Y version.
-version = '0.1'
+version = '0.2'
# The full version, including alpha/beta/rc tags.
-release = '0.1'
+release = '0.2'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-08-13 13:11:54
|
Revision: 6029
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6029&view=rev
Author: jswhit
Date: 2008-08-13 13:11:51 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
more kludges for geos 3.0.0
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-12 18:36:29 UTC (rev 6028)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-13 13:11:51 UTC (rev 6029)
@@ -913,6 +913,12 @@
antart = True
else:
poly = Shape(b)
+ # this is a workaround to avoid
+ # "GEOS_ERROR: TopologyException:
+ # found non-noded intersection between ..."
+ # with geos 3.0.0
+ if _geoslib.__geos_major_version__ > 2:
+ poly = poly.simplify(1.e-10)
antart = False
# create duplicate polygons shifted by -360 and +360
# (so as to properly treat polygons that cross
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-12 18:36:32
|
Revision: 6028
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6028&view=rev
Author: mdboom
Date: 2008-08-12 18:36:29 +0000 (Tue, 12 Aug 2008)
Log Message:
-----------
Small bugfix in inheritance_diagram.py
Modified Paths:
--------------
trunk/matplotlib/doc/sphinxext/inheritance_diagram.py
Modified: trunk/matplotlib/doc/sphinxext/inheritance_diagram.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2008-08-12 18:35:53 UTC (rev 6027)
+++ trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2008-08-12 18:36:29 UTC (rev 6028)
@@ -81,10 +81,9 @@
raise ValueError(
"Invalid class or module '%s' specified for inheritance diagram" % name)
fullname = (path or '') + base
- path = path and path.rstrip('.')
+ path = (path and path.rstrip('.'))
if not path:
- raise ValueError(
- "Invalid class or module '%s' specified for inheritance diagram" % name)
+ path = base
try:
module = __import__(path, None, None, [])
except ImportError:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-12 18:35:59
|
Revision: 6027
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6027&view=rev
Author: mdboom
Date: 2008-08-12 18:35:53 +0000 (Tue, 12 Aug 2008)
Log Message:
-----------
Add new features to template in prep for SciPy 08
Modified Paths:
--------------
trunk/py4science/examples/sphinx_template/conf.py
trunk/py4science/examples/sphinx_template/make.py
trunk/py4science/examples/sphinx_template/model/api_docs.rst
trunk/py4science/examples/sphinx_template/model/sphinx_helpers.rst
trunk/py4science/examples/sphinx_template/simulations/finale.rst
trunk/py4science/examples/sphinx_template/simulations/preliminary.rst
trunk/py4science/examples/sphinx_template/sphinxext/ipython_console_highlighting.py
trunk/py4science/examples/sphinx_template/sphinxext/mathmpl.py
Added Paths:
-----------
trunk/py4science/examples/sphinx_template/pyplots/
trunk/py4science/examples/sphinx_template/pyplots/elegant.py
trunk/py4science/examples/sphinx_template/pyplots/hairy.py
trunk/py4science/examples/sphinx_template/sphinxext/inheritance_diagram.py
trunk/py4science/examples/sphinx_template/sphinxext/only_directives.py
trunk/py4science/examples/sphinx_template/sphinxext/plot_directive.py
Removed Paths:
-------------
trunk/py4science/examples/sphinx_template/simulations/code/
Modified: trunk/py4science/examples/sphinx_template/conf.py
===================================================================
--- trunk/py4science/examples/sphinx_template/conf.py 2008-08-12 18:01:52 UTC (rev 6026)
+++ trunk/py4science/examples/sphinx_template/conf.py 2008-08-12 18:35:53 UTC (rev 6027)
@@ -28,7 +28,8 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['mathpng', 'sphinx.ext.autodoc']
+extensions = ['mathmpl', 'ipython_console_highlighting', 'sphinx.ext.autodoc',
+ 'inheritance_diagram', 'only_directives', 'plot_directive']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Modified: trunk/py4science/examples/sphinx_template/make.py
===================================================================
--- trunk/py4science/examples/sphinx_template/make.py 2008-08-12 18:01:52 UTC (rev 6026)
+++ trunk/py4science/examples/sphinx_template/make.py 2008-08-12 18:35:53 UTC (rev 6027)
@@ -14,17 +14,12 @@
except OSError:
pass
-def figs():
- os.system('cd simulations/code/ && python make.py')
-
def html():
check_build()
- figs()
os.system('sphinx-build -b html -d build/doctrees . build/html')
def latex():
check_build()
- figs()
if sys.platform != 'win32':
# LaTeX format.
os.system('sphinx-build -b latex -d build/doctrees . build/latex')
@@ -47,13 +42,11 @@
shutil.rmtree('build')
def all():
- figs()
html()
latex()
-funcd = {'figs':figs,
- 'html':html,
+funcd = {'html':html,
'latex':latex,
'clean':clean,
'all':all,
Modified: trunk/py4science/examples/sphinx_template/model/api_docs.rst
===================================================================
--- trunk/py4science/examples/sphinx_template/model/api_docs.rst 2008-08-12 18:01:52 UTC (rev 6026)
+++ trunk/py4science/examples/sphinx_template/model/api_docs.rst 2008-08-12 18:35:53 UTC (rev 6027)
@@ -6,7 +6,7 @@
It is easy to autodocument API code if the code has REST docstrings
using the sphinx `autodoc <http://sphinx.pocoo.org/ext/autodoc.html>`_
-facilites.
+facilities.
:mod:`matplotlib.backend_bases`
================================
Modified: trunk/py4science/examples/sphinx_template/model/sphinx_helpers.rst
===================================================================
--- trunk/py4science/examples/sphinx_template/model/sphinx_helpers.rst 2008-08-12 18:01:52 UTC (rev 6026)
+++ trunk/py4science/examples/sphinx_template/model/sphinx_helpers.rst 2008-08-12 18:35:53 UTC (rev 6027)
@@ -88,6 +88,9 @@
antialiased or aa: [True | False]
...snip
+This support is included in this template, but will also be included
+in a future version of Pygments by default.
+
.. _formatting-text:
Formatting text
@@ -102,7 +105,7 @@
Or literally include code:
-.. literalinclude:: ../simulations/code/elegant.py
+.. literalinclude:: ../pyplots/elegant.py
.. _using-math:
@@ -117,26 +120,61 @@
W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]
+This documentation framework includes a Sphinx extension,
+:file:`sphinxext/mathmpl.py`, that uses matplotlib to render math
+equations when generating HTML, and LaTeX itself when generating a
+PDF. This can be useful on systems that have matplotlib, but not
+LaTeX, installed. To use it, add ``mathpng`` to the list of
+extensions in :file:`conf.py`.
-There is a :file:`spinxext/mathml.py` file in the
-:file:`spinx_template` directory which can be enabled via the
-:file:`conf.py` configuration file. However, we have found that
-resultant html is not supported across many browsers, so have added a
-sphinx extension for translating math to png. In the file
-:file:`sphinxext/mathpng.py` there are two functions ``latex2png``.
-The first one requires latex and dvipng, and the second one uses
-matplotlib mathtext (requires mpl svn rxx or later). Because the 2nd
-function replaces the first one, the matplotlib mathtext support is on
-by default, so you can generate equation enabled html anywhere
-matplotlib is installed (for PDF you will still need pdflatex
-installed). If you would rather use latex and dvipng, simply hide the
-second ``latex2png`` definition, eg by renaming the second function
-``_latex2png``.
+Current SVN versions of Sphinx now include built-in support for math.
+There are two flavors:
+ - pngmath: uses dvipng to render the equation
+ - jsmath: renders the math in the browser using Javascript
+To use these extensions instead, add ``sphinx.ext.pngmath`` or
+``sphinx.ext.jsmath`` to the list of extensions in :file:`conf.py`.
+
+All three of these options for math are designed to behave in the same
+way.
+
.. _emacs-helpers:
+Inserting matplotlib plots
+==========================
+
+Inserting automatically-generated plots is easy. Simply put the
+script to generate the plot in the :file:`pyplots` directory, and
+refer to it using the ``plot`` directive. To include the source code
+for the plot in the document, pass the ``include-source`` parameter::
+
+ .. plot:: elegant.py
+ :include-source:
+
+In the HTML version of the document, the plot includes links to the
+original source code, a high-resolution PNG and a PDF. In the PDF
+version of the document, the plot is included as a scalable PDF.
+
+.. plot:: elegant.py
+ :include-source:
+
+Inheritance diagrams
+====================
+
+Inheritance diagrams can be inserted directly into the document by
+providing a list of class or module names to the
+``inheritance-diagram`` directive.
+
+For example::
+
+ .. inheritance-diagram:: codecs
+
+produces:
+
+.. inheritance-diagram:: codecs
+
Emacs helpers
=============
Copied: trunk/py4science/examples/sphinx_template/pyplots/elegant.py (from rev 6022, trunk/py4science/examples/sphinx_template/simulations/code/elegant.py)
===================================================================
--- trunk/py4science/examples/sphinx_template/pyplots/elegant.py (rev 0)
+++ trunk/py4science/examples/sphinx_template/pyplots/elegant.py 2008-08-12 18:35:53 UTC (rev 6027)
@@ -0,0 +1,4 @@
+import matplotlib.pyplot as plt
+plt.plot([1,2,3], [4,5,6])
+plt.ylabel('some more numbers')
+
Copied: trunk/py4science/examples/sphinx_template/pyplots/hairy.py (from rev 6022, trunk/py4science/examples/sphinx_template/simulations/code/hairy.py)
===================================================================
--- trunk/py4science/examples/sphinx_template/pyplots/hairy.py (rev 0)
+++ trunk/py4science/examples/sphinx_template/pyplots/hairy.py 2008-08-12 18:35:53 UTC (rev 6027)
@@ -0,0 +1,4 @@
+import matplotlib.pyplot as plt
+plt.plot([1,2,3])
+plt.ylabel('some numbers')
+
Modified: trunk/py4science/examples/sphinx_template/simulations/finale.rst
===================================================================
--- trunk/py4science/examples/sphinx_template/simulations/finale.rst 2008-08-12 18:01:52 UTC (rev 6026)
+++ trunk/py4science/examples/sphinx_template/simulations/finale.rst 2008-08-12 18:35:53 UTC (rev 6027)
@@ -5,13 +5,8 @@
*************
-After much head scratching, I wrote this big elegant piece of code
+After much head scratching, I wrote this big elegant piece of code, to
+produce this much more elegant figure:
-.. literalinclude:: code/elegant.py
-
-which produced this elegant figure
-
-.. image:: code/elegant.png
- :scale: 50
-
-
+.. plot:: elegant.py
+ :include-source:
Modified: trunk/py4science/examples/sphinx_template/simulations/preliminary.rst
===================================================================
--- trunk/py4science/examples/sphinx_template/simulations/preliminary.rst 2008-08-12 18:01:52 UTC (rev 6026)
+++ trunk/py4science/examples/sphinx_template/simulations/preliminary.rst 2008-08-12 18:35:53 UTC (rev 6027)
@@ -4,14 +4,8 @@
Preliminary tests
*****************
-I wrote this big hairy piece of code
+I wrote this big hairy piece of code to make the following plot:
-.. literalinclude:: code/hairy.py
+.. plot:: hairy.py
+ :include-source:
-
-which produced this lovely figure
-
-.. image:: code/hairy.png
- :scale: 50
-
-
Added: trunk/py4science/examples/sphinx_template/sphinxext/inheritance_diagram.py
===================================================================
--- trunk/py4science/examples/sphinx_template/sphinxext/inheritance_diagram.py (rev 0)
+++ trunk/py4science/examples/sphinx_template/sphinxext/inheritance_diagram.py 2008-08-12 18:35:53 UTC (rev 6027)
@@ -0,0 +1,423 @@
+"""
+Defines a docutils directive for inserting inheritance diagrams.
+
+Provide the directive with one or more classes or modules (separated
+by whitespace). For modules, all of the classes in that module will
+be used.
+
+Example::
+
+ Given the following classes:
+
+ class A: pass
+ class B(A): pass
+ class C(A): pass
+ class D(B, C): pass
+ class E(B): pass
+
+ .. inheritance-diagram: D E
+
+ Produces a graph like the following:
+
+ A
+ / \
+ B C
+ / \ /
+ E D
+
+The graph is inserted as a PNG+image map into HTML and a PDF in
+LaTeX.
+"""
+
+import inspect
+import os
+import re
+import subprocess
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
+from docutils.nodes import Body, Element
+from docutils.writers.html4css1 import HTMLTranslator
+from sphinx.latexwriter import LaTeXTranslator
+from docutils.parsers.rst import directives
+from sphinx.roles import xfileref_role
+
+class DotException(Exception):
+ pass
+
+class InheritanceGraph(object):
+ """
+ Given a list of classes, determines the set of classes that
+ they inherit from all the way to the root "object", and then
+ is able to generate a graphviz dot graph from them.
+ """
+ def __init__(self, class_names, show_builtins=False):
+ """
+ *class_names* is a list of child classes to show bases from.
+
+ If *show_builtins* is True, then Python builtins will be shown
+ in the graph.
+ """
+ self.class_names = class_names
+ self.classes = self._import_classes(class_names)
+ self.all_classes = self._all_classes(self.classes)
+ if len(self.all_classes) == 0:
+ raise ValueError("No classes found for inheritance diagram")
+ self.show_builtins = show_builtins
+
+ py_sig_re = re.compile(r'''^([\w.]*\.)? # class names
+ (\w+) \s* $ # optionally arguments
+ ''', re.VERBOSE)
+
+ def _import_class_or_module(self, name):
+ """
+ Import a class using its fully-qualified *name*.
+ """
+ try:
+ path, base = self.py_sig_re.match(name).groups()
+ except:
+ raise ValueError(
+ "Invalid class or module '%s' specified for inheritance diagram" % name)
+ fullname = (path or '') + base
+ path = (path and path.rstrip('.'))
+ if not path:
+ path = base
+ if not path:
+ raise ValueError(
+ "Invalid class or module '%s' specified for inheritance diagram" % name)
+ try:
+ module = __import__(path, None, None, [])
+ except ImportError:
+ raise ValueError(
+ "Could not import class or module '%s' specified for inheritance diagram" % name)
+
+ try:
+ todoc = module
+ for comp in fullname.split('.')[1:]:
+ todoc = getattr(todoc, comp)
+ except AttributeError:
+ raise ValueError(
+ "Could not find class or module '%s' specified for inheritance diagram" % name)
+
+ # If a class, just return it
+ if inspect.isclass(todoc):
+ return [todoc]
+ elif inspect.ismodule(todoc):
+ classes = []
+ for cls in todoc.__dict__.values():
+ if inspect.isclass(cls) and cls.__module__ == todoc.__name__:
+ classes.append(cls)
+ return classes
+ raise ValueError(
+ "'%s' does not resolve to a class or module" % name)
+
+ def _import_classes(self, class_names):
+ """
+ Import a list of classes.
+ """
+ classes = []
+ for name in class_names:
+ classes.extend(self._import_class_or_module(name))
+ return classes
+
+ def _all_classes(self, classes):
+ """
+ Return a list of all classes that are ancestors of *classes*.
+ """
+ all_classes = {}
+
+ def recurse(cls):
+ all_classes[cls] = None
+ for c in cls.__bases__:
+ if c not in all_classes:
+ recurse(c)
+
+ for cls in classes:
+ recurse(cls)
+
+ return all_classes.keys()
+
+ def class_name(self, cls, parts=0):
+ """
+ Given a class object, return a fully-qualified name. This
+ works for things I've tested in matplotlib so far, but may not
+ be completely general.
+ """
+ module = cls.__module__
+ if module == '__builtin__':
+ fullname = cls.__name__
+ else:
+ fullname = "%s.%s" % (module, cls.__name__)
+ if parts == 0:
+ return fullname
+ name_parts = fullname.split('.')
+ return '.'.join(name_parts[-parts:])
+
+ def get_all_class_names(self):
+ """
+ Get all of the class names involved in the graph.
+ """
+ return [self.class_name(x) for x in self.all_classes]
+
+ # These are the default options for graphviz
+ default_graph_options = {
+ "rankdir": "LR",
+ "size": '"8.0, 12.0"'
+ }
+ default_node_options = {
+ "shape": "box",
+ "fontsize": 10,
+ "height": 0.25,
+ "fontname": "Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",
+ "style": '"setlinewidth(0.5)"'
+ }
+ default_edge_options = {
+ "arrowsize": 0.5,
+ "style": '"setlinewidth(0.5)"'
+ }
+
+ def _format_node_options(self, options):
+ return ','.join(["%s=%s" % x for x in options.items()])
+ def _format_graph_options(self, options):
+ return ''.join(["%s=%s;\n" % x for x in options.items()])
+
+ def generate_dot(self, fd, name, parts=0, urls={},
+ graph_options={}, node_options={},
+ edge_options={}):
+ """
+ Generate a graphviz dot graph from the classes that
+ were passed in to __init__.
+
+ *fd* is a Python file-like object to write to.
+
+ *name* is the name of the graph
+
+ *urls* is a dictionary mapping class names to http urls
+
+ *graph_options*, *node_options*, *edge_options* are
+ dictionaries containing key/value pairs to pass on as graphviz
+ properties.
+ """
+ g_options = self.default_graph_options.copy()
+ g_options.update(graph_options)
+ n_options = self.default_node_options.copy()
+ n_options.update(node_options)
+ e_options = self.default_edge_options.copy()
+ e_options.update(edge_options)
+
+ fd.write('digraph %s {\n' % name)
+ fd.write(self._format_graph_options(g_options))
+
+ for cls in self.all_classes:
+ if not self.show_builtins and cls in __builtins__.values():
+ continue
+
+ name = self.class_name(cls, parts)
+
+ # Write the node
+ this_node_options = n_options.copy()
+ url = urls.get(self.class_name(cls))
+ if url is not None:
+ this_node_options['URL'] = '"%s"' % url
+ fd.write(' "%s" [%s];\n' %
+ (name, self._format_node_options(this_node_options)))
+
+ # Write the edges
+ for base in cls.__bases__:
+ if not self.show_builtins and base in __builtins__.values():
+ continue
+
+ base_name = self.class_name(base, parts)
+ fd.write(' "%s" -> "%s" [%s];\n' %
+ (base_name, name,
+ self._format_node_options(e_options)))
+ fd.write('}\n')
+
+ def run_dot(self, args, name, parts=0, urls={},
+ graph_options={}, node_options={}, edge_options={}):
+ """
+ Run graphviz 'dot' over this graph, returning whatever 'dot'
+ writes to stdout.
+
+ *args* will be passed along as commandline arguments.
+
+ *name* is the name of the graph
+
+ *urls* is a dictionary mapping class names to http urls
+
+ Raises DotException for any of the many os and
+ installation-related errors that may occur.
+ """
+ try:
+ dot = subprocess.Popen(['dot'] + list(args),
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ close_fds=True)
+ except OSError:
+ raise DotException("Could not execute 'dot'. Are you sure you have 'graphviz' installed?")
+ except ValueError:
+ raise DotException("'dot' called with invalid arguments")
+ except:
+ raise DotException("Unexpected error calling 'dot'")
+
+ self.generate_dot(dot.stdin, name, parts, urls, graph_options,
+ node_options, edge_options)
+ dot.stdin.close()
+ result = dot.stdout.read()
+ returncode = dot.wait()
+ if returncode != 0:
+ raise DotException("'dot' returned the errorcode %d" % returncode)
+ return result
+
+class inheritance_diagram(Body, Element):
+ """
+ A docutils node to use as a placeholder for the inheritance
+ diagram.
+ """
+ pass
+
+def inheritance_diagram_directive_run(class_names, options, state):
+ """
+ Run when the inheritance_diagram directive is first encountered.
+ """
+ node = inheritance_diagram()
+
+ # Create a graph starting with the list of classes
+ graph = InheritanceGraph(class_names)
+
+ # Create xref nodes for each target of the graph's image map and
+ # add them to the doc tree so that Sphinx can resolve the
+ # references to real URLs later. These nodes will eventually be
+ # removed from the doctree after we're done with them.
+ for name in graph.get_all_class_names():
+ refnodes, x = xfileref_role(
+ 'class', ':class:`%s`' % name, name, 0, state)
+ node.extend(refnodes)
+ # Store the graph object so we can use it to generate the
+ # dot file later
+ node['graph'] = graph
+ # Store the original content for use as a hash
+ node['parts'] = options.get('parts', 0)
+ node['content'] = " ".join(class_names)
+ return [node]
+
+def get_graph_hash(node):
+ return md5(node['content'] + str(node['parts'])).hexdigest()[-10:]
+
+def html_output_graph(self, node):
+ """
+ Output the graph for HTML. This will insert a PNG with clickable
+ image map.
+ """
+ graph = node['graph']
+ parts = node['parts']
+
+ graph_hash = get_graph_hash(node)
+ name = "inheritance%s" % graph_hash
+ png_path = os.path.join('_static', name + ".png")
+
+ path = '_static'
+ source = self.document.attributes['source']
+ count = source.split('/doc/')[-1].count('/')
+ for i in range(count):
+ if os.path.exists(path): break
+ path = '../'+path
+ path = '../'+path #specifically added for matplotlib
+
+ # Create a mapping from fully-qualified class names to URLs.
+ urls = {}
+ for child in node:
+ if child.get('refuri') is not None:
+ urls[child['reftitle']] = child.get('refuri')
+ elif child.get('refid') is not None:
+ urls[child['reftitle']] = '#' + child.get('refid')
+
+ # These arguments to dot will save a PNG file to disk and write
+ # an HTML image map to stdout.
+ image_map = graph.run_dot(['-Tpng', '-o%s' % png_path, '-Tcmapx'],
+ name, parts, urls)
+ return ('<img src="%s/%s.png" usemap="#%s" class="inheritance"/>%s' %
+ (path, name, name, image_map))
+
+def latex_output_graph(self, node):
+ """
+ Output the graph for LaTeX. This will insert a PDF.
+ """
+ graph = node['graph']
+ parts = node['parts']
+
+ graph_hash = get_graph_hash(node)
+ name = "inheritance%s" % graph_hash
+ pdf_path = os.path.join('_static', name + ".pdf")
+
+ graph.run_dot(['-Tpdf', '-o%s' % pdf_path],
+ name, parts, graph_options={'size': '"6.0,6.0"'})
+ return '\\includegraphics{../../%s}' % pdf_path
+
+def visit_inheritance_diagram(inner_func):
+ """
+ This is just a wrapper around html/latex_output_graph to make it
+ easier to handle errors and insert warnings.
+ """
+ def visitor(self, node):
+ try:
+ content = inner_func(self, node)
+ except DotException, e:
+ # Insert the exception as a warning in the document
+ warning = self.document.reporter.warning(str(e), line=node.line)
+ warning.parent = node
+ node.children = [warning]
+ else:
+ source = self.document.attributes['source']
+ self.body.append(content)
+ node.children = []
+ return visitor
+
+def do_nothing(self, node):
+ pass
+
+options_spec = {
+ 'parts': directives.nonnegative_int
+ }
+
+# Deal with the old and new way of registering directives
+try:
+ from docutils.parsers.rst import Directive
+except ImportError:
+ from docutils.parsers.rst.directives import _directives
+ def inheritance_diagram_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state,
+ state_machine):
+ return inheritance_diagram_directive_run(arguments, options, state)
+ inheritance_diagram_directive.__doc__ = __doc__
+ inheritance_diagram_directive.arguments = (1, 100, 0)
+ inheritance_diagram_directive.options = options_spec
+ inheritance_diagram_directive.content = 0
+ _directives['inheritance-diagram'] = inheritance_diagram_directive
+else:
+ class inheritance_diagram_directive(Directive):
+ has_content = False
+ required_arguments = 1
+ optional_arguments = 100
+ final_argument_whitespace = False
+ option_spec = options_spec
+
+ def run(self):
+ return inheritance_diagram_directive_run(
+ self.arguments, self.options, self.state)
+ inheritance_diagram_directive.__doc__ = __doc__
+
+ directives.register_directive('inheritance-diagram',
+ inheritance_diagram_directive)
+
+def setup(app):
+ app.add_node(inheritance_diagram)
+
+ HTMLTranslator.visit_inheritance_diagram = \
+ visit_inheritance_diagram(html_output_graph)
+ HTMLTranslator.depart_inheritance_diagram = do_nothing
+
+ LaTeXTranslator.visit_inheritance_diagram = \
+ visit_inheritance_diagram(latex_output_graph)
+ LaTeXTranslator.depart_inheritance_diagram = do_nothing
Modified: trunk/py4science/examples/sphinx_template/sphinxext/ipython_console_highlighting.py
===================================================================
--- trunk/py4science/examples/sphinx_template/sphinxext/ipython_console_highlighting.py 2008-08-12 18:01:52 UTC (rev 6026)
+++ trunk/py4science/examples/sphinx_template/sphinxext/ipython_console_highlighting.py 2008-08-12 18:35:53 UTC (rev 6027)
@@ -13,7 +13,7 @@
Tracebacks are not currently supported.
- .. sourcecode:: pycon
+ .. sourcecode:: ipython
In [1]: a = 'foo'
Modified: trunk/py4science/examples/sphinx_template/sphinxext/mathmpl.py
===================================================================
--- trunk/py4science/examples/sphinx_template/sphinxext/mathmpl.py 2008-08-12 18:01:52 UTC (rev 6026)
+++ trunk/py4science/examples/sphinx_template/sphinxext/mathmpl.py 2008-08-12 18:35:53 UTC (rev 6027)
@@ -5,21 +5,36 @@
from md5 import md5
from docutils import nodes
+from docutils.parsers.rst import directives
from docutils.writers.html4css1 import HTMLTranslator
from sphinx.latexwriter import LaTeXTranslator
+import warnings
# Define LaTeX math node:
class latex_math(nodes.General, nodes.Element):
pass
+def fontset_choice(arg):
+ return directives.choice(arg, ['cm', 'stix', 'stixsans'])
+
+options_spec = {'fontset': fontset_choice}
+
def math_role(role, rawtext, text, lineno, inliner,
options={}, content=[]):
i = rawtext.find('`')
latex = rawtext[i+1:-1]
node = latex_math(rawtext)
node['latex'] = latex
+ node['fontset'] = options.get('fontset', 'cm')
return [node], []
+math_role.options = options_spec
+def math_directive_run(content, block_text, options):
+ latex = ''.join(content)
+ node = latex_math(block_text)
+ node['latex'] = latex
+ node['fontset'] = options.get('fontset', 'cm')
+ return [node]
try:
from docutils.parsers.rst import Directive
@@ -28,22 +43,19 @@
from docutils.parsers.rst.directives import _directives
def math_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
- latex = ''.join(content)
- node = latex_math(block_text)
- node['latex'] = latex
- return [node]
+ return math_directive_run(content, block_text, options)
math_directive.arguments = None
- math_directive.options = {}
+ math_directive.options = options_spec
math_directive.content = 1
_directives['math'] = math_directive
else:
class math_directive(Directive):
has_content = True
+ option_spec = options_spec
+
def run(self):
- latex = ' '.join(self.content)
- node = latex_math(self.block_text)
- node['latex'] = latex
- return [node]
+ return math_directive_run(self.content, self.block_text,
+ self.options)
from docutils.parsers.rst import directives
directives.register_directive('math', math_directive)
@@ -74,25 +86,6 @@
LaTeXTranslator.visit_latex_math = visit_latex_math_latex
LaTeXTranslator.depart_latex_math = depart_latex_math_latex
-from os.path import isfile
-
-# This calls out to LaTeX to render the expression
-def latex2png(latex, name):
- f = open('math.tex', 'w')
- f.write(r"""\documentclass[12pt]{article}
- \pagestyle{empty}
- \begin{document}""")
- if inline:
- f.write('$%s$' % latex)
- else:
- f.write(r'\[ %s \]' % latex)
- f.write('\end{document}')
- f.close()
- os.system('latex --interaction=nonstopmode math.tex > /dev/null')
- os.system('dvipng -bgTransparent -Ttight --noghostscript -l10 ' +
- '-o %s math.dvi > /dev/null' % name)
-
-
from matplotlib import rcParams
from matplotlib.mathtext import MathTextParser
rcParams['mathtext.fontset'] = 'cm'
@@ -100,21 +93,30 @@
# This uses mathtext to render the expression
-def latex2png(latex, filename):
+def latex2png(latex, filename, fontset='cm'):
+ latex = "$%s$" % latex
+ orig_fontset = rcParams['mathtext.fontset']
+ rcParams['mathtext.fontset'] = fontset
if os.path.exists(filename):
- return
- mathtext_parser.to_png(filename, "$%s$" % latex, dpi=120)
+ depth = mathtext_parser.get_depth(latex, dpi=100)
+ else:
+ print latex.encode("ascii", "backslashreplace")
+ try:
+ depth = mathtext_parser.to_png(filename, latex, dpi=100)
+ except:
+ warnings.warn("Could not render math expression %s" % latex,
+ Warning)
+ depth = 0
+ rcParams['mathtext.fontset'] = orig_fontset
+ return depth
-
# LaTeX to HTML translation stuff:
def latex2html(node, source):
inline = isinstance(node.parent, nodes.TextElement)
latex = node['latex']
- print latex.encode("ascii", "backslashreplace")
name = 'math-%s' % md5(latex).hexdigest()[-10:]
dest = '_static/%s.png' % name
- if not isfile(dest):
- latex2png(latex, dest)
+ depth = latex2png(latex, dest, node.get('fontset', rcParams['mathtext.fontset']))
path = '_static'
count = source.split('/doc/')[-1].count('/')
@@ -122,13 +124,14 @@
if os.path.exists(path): break
path = '../'+path
path = '../'+path #specifically added for matplotlib
- if inline and '_' in latex:
- align = 'align="absmiddle" '
- else:
- align = ''
if inline:
cls = ''
else:
cls = 'class="center" '
- return '<img src="%s/%s.png" %s%s/>' % (path, name, align, cls)
+ if inline and depth != 0:
+ style = 'style="position: relative; bottom: -%dpx"' % (depth + 1)
+ else:
+ style = ''
+ return '<img src="%s/%s.png" %s%s/>' % (path, name, cls, style)
+
Added: trunk/py4science/examples/sphinx_template/sphinxext/only_directives.py
===================================================================
--- trunk/py4science/examples/sphinx_template/sphinxext/only_directives.py (rev 0)
+++ trunk/py4science/examples/sphinx_template/sphinxext/only_directives.py 2008-08-12 18:35:53 UTC (rev 6027)
@@ -0,0 +1,87 @@
+#
+# A pair of directives for inserting content that will only appear in
+# either html or latex.
+#
+
+from docutils.nodes import Body, Element
+from docutils.writers.html4css1 import HTMLTranslator
+from sphinx.latexwriter import LaTeXTranslator
+from docutils.parsers.rst import directives
+
+class html_only(Body, Element):
+ pass
+
+class latex_only(Body, Element):
+ pass
+
+def run(content, node_class, state, content_offset):
+ text = '\n'.join(content)
+ node = node_class(text)
+ state.nested_parse(content, content_offset, node)
+ return [node]
+
+try:
+ from docutils.parsers.rst import Directive
+except ImportError:
+ from docutils.parsers.rst.directives import _directives
+
+ def html_only_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ return run(content, html_only, state, content_offset)
+
+ def latex_only_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ return run(content, latex_only, state, content_offset)
+
+ for func in (html_only_directive, latex_only_directive):
+ func.content = 1
+ func.options = {}
+ func.arguments = None
+
+ _directives['htmlonly'] = html_only_directive
+ _directives['latexonly'] = latex_only_directive
+else:
+ class OnlyDirective(Directive):
+ has_content = True
+ required_arguments = 0
+ optional_arguments = 0
+ final_argument_whitespace = True
+ option_spec = {}
+
+ def run(self):
+ self.assert_has_content()
+ return run(self.content, self.node_class,
+ self.state, self.content_offset)
+
+ class HtmlOnlyDirective(OnlyDirective):
+ node_class = html_only
+
+ class LatexOnlyDirective(OnlyDirective):
+ node_class = latex_only
+
+ directives.register_directive('htmlonly', HtmlOnlyDirective)
+ directives.register_directive('latexonly', LatexOnlyDirective)
+
+def setup(app):
+ app.add_node(html_only)
+ app.add_node(latex_only)
+
+ # Add visit/depart methods to HTML-Translator:
+ def visit_perform(self, node):
+ pass
+ def depart_perform(self, node):
+ pass
+ def visit_ignore(self, node):
+ node.children = []
+ def depart_ignore(self, node):
+ node.children = []
+
+ HTMLTranslator.visit_html_only = visit_perform
+ HTMLTranslator.depart_html_only = depart_perform
+ HTMLTranslator.visit_latex_only = visit_ignore
+ HTMLTranslator.depart_latex_only = depart_ignore
+
+ LaTeXTranslator.visit_html_only = visit_ignore
+ LaTeXTranslator.depart_html_only = depart_ignore
+ LaTeXTranslator.visit_latex_only = visit_perform
+ LaTeXTranslator.depart_latex_only = depart_perform
Added: trunk/py4science/examples/sphinx_template/sphinxext/plot_directive.py
===================================================================
--- trunk/py4science/examples/sphinx_template/sphinxext/plot_directive.py (rev 0)
+++ trunk/py4science/examples/sphinx_template/sphinxext/plot_directive.py 2008-08-12 18:35:53 UTC (rev 6027)
@@ -0,0 +1,155 @@
+"""A special directive for including a matplotlib plot.
+
+Given a path to a .py file, it includes the source code inline, then:
+
+- On HTML, will include a .png with a link to a high-res .png.
+
+- On LaTeX, will include a .pdf
+
+This directive supports all of the options of the `image` directive,
+except for `target` (since plot will add its own target).
+
+Additionally, if the :include-source: option is provided, the literal
+source will be included inline, as well as a link to the source.
+"""
+
+import sys, os, glob, shutil
+from docutils.parsers.rst import directives
+
+try:
+ # docutils 0.4
+ from docutils.parsers.rst.directives.images import align
+except ImportError:
+ # docutils 0.5
+ from docutils.parsers.rst.directives.images import Image
+ align = Image.align
+
+
+import matplotlib
+import IPython.Shell
+matplotlib.use('Agg')
+import matplotlib.pyplot as plt
+
+mplshell = IPython.Shell.MatplotlibShell('mpl')
+
+options = {'alt': directives.unchanged,
+ 'height': directives.length_or_unitless,
+ 'width': directives.length_or_percentage_or_unitless,
+ 'scale': directives.nonnegative_int,
+ 'align': align,
+ 'class': directives.class_option,
+ 'include-source': directives.flag }
+
+template = """
+.. htmlonly::
+
+ [`source code <../%(srcdir)s/%(basename)s.py>`__,
+ `png <../%(srcdir)s/%(basename)s.hires.png>`__,
+ `pdf <../%(srcdir)s/%(basename)s.pdf>`__]
+
+ .. image:: ../%(srcdir)s/%(basename)s.png
+%(options)s
+
+.. latexonly::
+ .. image:: ../%(srcdir)s/%(basename)s.pdf
+%(options)s
+
+"""
+
+def makefig(fullpath, outdir):
+ """
+ run a pyplot script and save the low and high res PNGs and a PDF in _static
+ """
+
+ fullpath = str(fullpath) # todo, why is unicode breaking this
+ formats = [('png', 100),
+ ('hires.png', 200),
+ ('pdf', 72),
+ ]
+
+ basedir, fname = os.path.split(fullpath)
+ basename, ext = os.path.splitext(fname)
+ all_exists = True
+
+ if basedir != outdir:
+ shutil.copyfile(fullpath, os.path.join(outdir, fname))
+
+ for format, dpi in formats:
+ outname = os.path.join(outdir, '%s.%s' % (basename, format))
+ if not os.path.exists(outname):
+ all_exists = False
+ break
+
+ if all_exists:
+ print ' already have %s'%fullpath
+ return
+
+ print ' building %s'%fullpath
+ plt.close('all') # we need to clear between runs
+ matplotlib.rcdefaults()
+
+ mplshell.magic_run(fullpath)
+ for format, dpi in formats:
+ outname = os.path.join(outdir, '%s.%s' % (basename, format))
+ if os.path.exists(outname): continue
+ plt.savefig(outname, dpi=dpi)
+
+def run(arguments, options, state_machine, lineno):
+ reference = directives.uri(arguments[0])
+ basedir, fname = os.path.split(reference)
+ basename, ext = os.path.splitext(fname)
+
+ # todo - should we be using the _static dir for the outdir, I am
+ # not sure we want to corrupt that dir with autogenerated files
+ # since it also has permanent files in it which makes it difficult
+ # to clean (save an rm -rf followed by and svn up)
+ srcdir = 'pyplots'
+
+ makefig(os.path.join(srcdir, reference), srcdir)
+
+ # todo: it is not great design to assume the makefile is putting
+ # the figs into the right place, so we may want to do that here instead.
+
+ if options.has_key('include-source'):
+ lines = ['.. literalinclude:: ../pyplots/%(reference)s' % locals()]
+ del options['include-source']
+ else:
+ lines = []
+
+ options = [' :%s: %s' % (key, val) for key, val in
+ options.items()]
+ options = "\n".join(options)
+
+ lines.extend((template % locals()).split('\n'))
+
+ state_machine.insert_input(
+ lines, state_machine.input_lines.source(0))
+ return []
+
+
+try:
+ from docutils.parsers.rst import Directive
+except ImportError:
+ from docutils.parsers.rst.directives import _directives
+
+ def plot_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ return run(arguments, options, state_machine, lineno)
+ plot_directive.__doc__ = __doc__
+ plot_directive.arguments = (1, 0, 1)
+ plot_directive.options = options
+
+ _directives['plot'] = plot_directive
+else:
+ class plot_directive(Directive):
+ required_arguments = 1
+ optional_arguments = 0
+ final_argument_whitespace = True
+ option_spec = options
+ def run(self):
+ return run(self.arguments, self.options,
+ self.state_machine, self.lineno)
+ plot_directive.__doc__ = __doc__
+
+ directives.register_directive('plot', plot_directive)
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-12 18:01:55
|
Revision: 6026
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6026&view=rev
Author: mdboom
Date: 2008-08-12 18:01:52 +0000 (Tue, 12 Aug 2008)
Log Message:
-----------
Oops in last commit.
Modified Paths:
--------------
trunk/matplotlib/doc/conf.py
Modified: trunk/matplotlib/doc/conf.py
===================================================================
--- trunk/matplotlib/doc/conf.py 2008-08-12 17:58:00 UTC (rev 6025)
+++ trunk/matplotlib/doc/conf.py 2008-08-12 18:01:52 UTC (rev 6026)
@@ -28,7 +28,7 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['mathmpl', 'math_symbol_table', 'sphinx.ext.autodoc',
- 'only_directives', 'plot_directive', 'inheritance_diagram', 'toy']
+ 'only_directives', 'plot_directive', 'inheritance_diagram']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-12 17:58:03
|
Revision: 6025
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6025&view=rev
Author: mdboom
Date: 2008-08-12 17:58:00 +0000 (Tue, 12 Aug 2008)
Log Message:
-----------
Remove old dvipng support in mathmpl.py, since it is now in Sphinx core.
Modified Paths:
--------------
trunk/matplotlib/doc/sphinxext/mathmpl.py
Modified: trunk/matplotlib/doc/sphinxext/mathmpl.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/mathmpl.py 2008-08-12 17:57:14 UTC (rev 6024)
+++ trunk/matplotlib/doc/sphinxext/mathmpl.py 2008-08-12 17:58:00 UTC (rev 6025)
@@ -86,25 +86,6 @@
LaTeXTranslator.visit_latex_math = visit_latex_math_latex
LaTeXTranslator.depart_latex_math = depart_latex_math_latex
-from os.path import isfile
-
-# This calls out to LaTeX to render the expression
-def latex2png(latex, name):
- f = open('math.tex', 'w')
- f.write(r"""\documentclass[12pt]{article}
- \pagestyle{empty}
- \begin{document}""")
- if inline:
- f.write('$%s$' % latex)
- else:
- f.write(r'\[ %s \]' % latex)
- f.write('\end{document}')
- f.close()
- os.system('latex --interaction=nonstopmode math.tex > /dev/null')
- os.system('dvipng -bgTransparent -Ttight --noghostscript -l10 ' +
- '-o %s math.dvi > /dev/null' % name)
-
-
from matplotlib import rcParams
from matplotlib.mathtext import MathTextParser
rcParams['mathtext.fontset'] = 'cm'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-12 17:57:18
|
Revision: 6024
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6024&view=rev
Author: mdboom
Date: 2008-08-12 17:57:14 +0000 (Tue, 12 Aug 2008)
Log Message:
-----------
Rename mathpng to mathmpl
Modified Paths:
--------------
trunk/matplotlib/doc/conf.py
Added Paths:
-----------
trunk/matplotlib/doc/sphinxext/mathmpl.py
Removed Paths:
-------------
trunk/matplotlib/doc/sphinxext/mathpng.py
Modified: trunk/matplotlib/doc/conf.py
===================================================================
--- trunk/matplotlib/doc/conf.py 2008-08-12 17:54:48 UTC (rev 6023)
+++ trunk/matplotlib/doc/conf.py 2008-08-12 17:57:14 UTC (rev 6024)
@@ -27,8 +27,8 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['mathpng', 'math_symbol_table', 'sphinx.ext.autodoc',
- 'only_directives', 'plot_directive', 'inheritance_diagram']
+extensions = ['mathmpl', 'math_symbol_table', 'sphinx.ext.autodoc',
+ 'only_directives', 'plot_directive', 'inheritance_diagram', 'toy']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Copied: trunk/matplotlib/doc/sphinxext/mathmpl.py (from rev 6021, trunk/matplotlib/doc/sphinxext/mathpng.py)
===================================================================
--- trunk/matplotlib/doc/sphinxext/mathmpl.py (rev 0)
+++ trunk/matplotlib/doc/sphinxext/mathmpl.py 2008-08-12 17:57:14 UTC (rev 6024)
@@ -0,0 +1,156 @@
+import os
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
+from docutils import nodes
+from docutils.parsers.rst import directives
+from docutils.writers.html4css1 import HTMLTranslator
+from sphinx.latexwriter import LaTeXTranslator
+import warnings
+
+# Define LaTeX math node:
+class latex_math(nodes.General, nodes.Element):
+ pass
+
+def fontset_choice(arg):
+ return directives.choice(arg, ['cm', 'stix', 'stixsans'])
+
+options_spec = {'fontset': fontset_choice}
+
+def math_role(role, rawtext, text, lineno, inliner,
+ options={}, content=[]):
+ i = rawtext.find('`')
+ latex = rawtext[i+1:-1]
+ node = latex_math(rawtext)
+ node['latex'] = latex
+ node['fontset'] = options.get('fontset', 'cm')
+ return [node], []
+math_role.options = options_spec
+
+def math_directive_run(content, block_text, options):
+ latex = ''.join(content)
+ node = latex_math(block_text)
+ node['latex'] = latex
+ node['fontset'] = options.get('fontset', 'cm')
+ return [node]
+
+try:
+ from docutils.parsers.rst import Directive
+except ImportError:
+ # Register directive the old way:
+ from docutils.parsers.rst.directives import _directives
+ def math_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ return math_directive_run(content, block_text, options)
+ math_directive.arguments = None
+ math_directive.options = options_spec
+ math_directive.content = 1
+ _directives['math'] = math_directive
+else:
+ class math_directive(Directive):
+ has_content = True
+ option_spec = options_spec
+
+ def run(self):
+ return math_directive_run(self.content, self.block_text,
+ self.options)
+ from docutils.parsers.rst import directives
+ directives.register_directive('math', math_directive)
+
+def setup(app):
+ app.add_node(latex_math)
+ app.add_role('math', math_role)
+
+ # Add visit/depart methods to HTML-Translator:
+ def visit_latex_math_html(self, node):
+ source = self.document.attributes['source']
+ self.body.append(latex2html(node, source))
+ def depart_latex_math_html(self, node):
+ pass
+ HTMLTranslator.visit_latex_math = visit_latex_math_html
+ HTMLTranslator.depart_latex_math = depart_latex_math_html
+
+ # Add visit/depart methods to LaTeX-Translator:
+ def visit_latex_math_latex(self, node):
+ inline = isinstance(node.parent, nodes.TextElement)
+ if inline:
+ self.body.append('$%s$' % node['latex'])
+ else:
+ self.body.extend(['\\begin{equation}',
+ node['latex'],
+ '\\end{equation}'])
+ def depart_latex_math_latex(self, node):
+ pass
+ LaTeXTranslator.visit_latex_math = visit_latex_math_latex
+ LaTeXTranslator.depart_latex_math = depart_latex_math_latex
+
+from os.path import isfile
+
+# This calls out to LaTeX to render the expression
+def latex2png(latex, name):
+ f = open('math.tex', 'w')
+ f.write(r"""\documentclass[12pt]{article}
+ \pagestyle{empty}
+ \begin{document}""")
+ if inline:
+ f.write('$%s$' % latex)
+ else:
+ f.write(r'\[ %s \]' % latex)
+ f.write('\end{document}')
+ f.close()
+ os.system('latex --interaction=nonstopmode math.tex > /dev/null')
+ os.system('dvipng -bgTransparent -Ttight --noghostscript -l10 ' +
+ '-o %s math.dvi > /dev/null' % name)
+
+
+from matplotlib import rcParams
+from matplotlib.mathtext import MathTextParser
+rcParams['mathtext.fontset'] = 'cm'
+mathtext_parser = MathTextParser("Bitmap")
+
+
+# This uses mathtext to render the expression
+def latex2png(latex, filename, fontset='cm'):
+ latex = "$%s$" % latex
+ orig_fontset = rcParams['mathtext.fontset']
+ rcParams['mathtext.fontset'] = fontset
+ if os.path.exists(filename):
+ depth = mathtext_parser.get_depth(latex, dpi=100)
+ else:
+ print latex.encode("ascii", "backslashreplace")
+ try:
+ depth = mathtext_parser.to_png(filename, latex, dpi=100)
+ except:
+ warnings.warn("Could not render math expression %s" % latex,
+ Warning)
+ depth = 0
+ rcParams['mathtext.fontset'] = orig_fontset
+ return depth
+
+# LaTeX to HTML translation stuff:
+def latex2html(node, source):
+ inline = isinstance(node.parent, nodes.TextElement)
+ latex = node['latex']
+ name = 'math-%s' % md5(latex).hexdigest()[-10:]
+ dest = '_static/%s.png' % name
+ depth = latex2png(latex, dest, node['fontset'])
+
+ path = '_static'
+ count = source.split('/doc/')[-1].count('/')
+ for i in range(count):
+ if os.path.exists(path): break
+ path = '../'+path
+ path = '../'+path #specifically added for matplotlib
+ if inline:
+ cls = ''
+ else:
+ cls = 'class="center" '
+ if inline and depth != 0:
+ style = 'style="position: relative; bottom: -%dpx"' % (depth + 1)
+ else:
+ style = ''
+
+ return '<img src="%s/%s.png" %s%s/>' % (path, name, cls, style)
+
Deleted: trunk/matplotlib/doc/sphinxext/mathpng.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/mathpng.py 2008-08-12 17:54:48 UTC (rev 6023)
+++ trunk/matplotlib/doc/sphinxext/mathpng.py 2008-08-12 17:57:14 UTC (rev 6024)
@@ -1,156 +0,0 @@
-import os
-try:
- from hashlib import md5
-except ImportError:
- from md5 import md5
-
-from docutils import nodes
-from docutils.parsers.rst import directives
-from docutils.writers.html4css1 import HTMLTranslator
-from sphinx.latexwriter import LaTeXTranslator
-import warnings
-
-# Define LaTeX math node:
-class latex_math(nodes.General, nodes.Element):
- pass
-
-def fontset_choice(arg):
- return directives.choice(arg, ['cm', 'stix', 'stixsans'])
-
-options_spec = {'fontset': fontset_choice}
-
-def math_role(role, rawtext, text, lineno, inliner,
- options={}, content=[]):
- i = rawtext.find('`')
- latex = rawtext[i+1:-1]
- node = latex_math(rawtext)
- node['latex'] = latex
- node['fontset'] = options.get('fontset', 'cm')
- return [node], []
-math_role.options = options_spec
-
-def math_directive_run(content, block_text, options):
- latex = ''.join(content)
- node = latex_math(block_text)
- node['latex'] = latex
- node['fontset'] = options.get('fontset', 'cm')
- return [node]
-
-try:
- from docutils.parsers.rst import Directive
-except ImportError:
- # Register directive the old way:
- from docutils.parsers.rst.directives import _directives
- def math_directive(name, arguments, options, content, lineno,
- content_offset, block_text, state, state_machine):
- return math_directive_run(content, block_text, options)
- math_directive.arguments = None
- math_directive.options = options_spec
- math_directive.content = 1
- _directives['math'] = math_directive
-else:
- class math_directive(Directive):
- has_content = True
- option_spec = options_spec
-
- def run(self):
- return math_directive_run(self.content, self.block_text,
- self.options)
- from docutils.parsers.rst import directives
- directives.register_directive('math', math_directive)
-
-def setup(app):
- app.add_node(latex_math)
- app.add_role('math', math_role)
-
- # Add visit/depart methods to HTML-Translator:
- def visit_latex_math_html(self, node):
- source = self.document.attributes['source']
- self.body.append(latex2html(node, source))
- def depart_latex_math_html(self, node):
- pass
- HTMLTranslator.visit_latex_math = visit_latex_math_html
- HTMLTranslator.depart_latex_math = depart_latex_math_html
-
- # Add visit/depart methods to LaTeX-Translator:
- def visit_latex_math_latex(self, node):
- inline = isinstance(node.parent, nodes.TextElement)
- if inline:
- self.body.append('$%s$' % node['latex'])
- else:
- self.body.extend(['\\begin{equation}',
- node['latex'],
- '\\end{equation}'])
- def depart_latex_math_latex(self, node):
- pass
- LaTeXTranslator.visit_latex_math = visit_latex_math_latex
- LaTeXTranslator.depart_latex_math = depart_latex_math_latex
-
-from os.path import isfile
-
-# This calls out to LaTeX to render the expression
-def latex2png(latex, name):
- f = open('math.tex', 'w')
- f.write(r"""\documentclass[12pt]{article}
- \pagestyle{empty}
- \begin{document}""")
- if inline:
- f.write('$%s$' % latex)
- else:
- f.write(r'\[ %s \]' % latex)
- f.write('\end{document}')
- f.close()
- os.system('latex --interaction=nonstopmode math.tex > /dev/null')
- os.system('dvipng -bgTransparent -Ttight --noghostscript -l10 ' +
- '-o %s math.dvi > /dev/null' % name)
-
-
-from matplotlib import rcParams
-from matplotlib.mathtext import MathTextParser
-rcParams['mathtext.fontset'] = 'cm'
-mathtext_parser = MathTextParser("Bitmap")
-
-
-# This uses mathtext to render the expression
-def latex2png(latex, filename, fontset='cm'):
- latex = "$%s$" % latex
- orig_fontset = rcParams['mathtext.fontset']
- rcParams['mathtext.fontset'] = fontset
- if os.path.exists(filename):
- depth = mathtext_parser.get_depth(latex, dpi=100)
- else:
- print latex.encode("ascii", "backslashreplace")
- try:
- depth = mathtext_parser.to_png(filename, latex, dpi=100)
- except:
- warnings.warn("Could not render math expression %s" % latex,
- Warning)
- depth = 0
- rcParams['mathtext.fontset'] = orig_fontset
- return depth
-
-# LaTeX to HTML translation stuff:
-def latex2html(node, source):
- inline = isinstance(node.parent, nodes.TextElement)
- latex = node['latex']
- name = 'math-%s' % md5(latex).hexdigest()[-10:]
- dest = '_static/%s.png' % name
- depth = latex2png(latex, dest, node['fontset'])
-
- path = '_static'
- count = source.split('/doc/')[-1].count('/')
- for i in range(count):
- if os.path.exists(path): break
- path = '../'+path
- path = '../'+path #specifically added for matplotlib
- if inline:
- cls = ''
- else:
- cls = 'class="center" '
- if inline and depth != 0:
- style = 'style="position: relative; bottom: -%dpx"' % (depth + 1)
- else:
- style = ''
-
- return '<img src="%s/%s.png" %s%s/>' % (path, name, cls, style)
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-12 17:54:52
|
Revision: 6023
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6023&view=rev
Author: mdboom
Date: 2008-08-12 17:54:48 +0000 (Tue, 12 Aug 2008)
Log Message:
-----------
reorganization
Added Paths:
-----------
trunk/py4science/examples/sphinx_template/sphinxext/mathmpl.py
Removed Paths:
-------------
trunk/py4science/examples/sphinx_template/sphinxext/mathml.py
trunk/py4science/examples/sphinx_template/sphinxext/mathpng.py
Deleted: trunk/py4science/examples/sphinx_template/sphinxext/mathml.py
===================================================================
--- trunk/py4science/examples/sphinx_template/sphinxext/mathml.py 2008-08-12 16:03:19 UTC (rev 6022)
+++ trunk/py4science/examples/sphinx_template/sphinxext/mathml.py 2008-08-12 17:54:48 UTC (rev 6023)
@@ -1,552 +0,0 @@
-from docutils import nodes
-from docutils.writers.html4css1 import HTMLTranslator
-from sphinx.latexwriter import LaTeXTranslator
-
-# Define LaTeX math node:
-class latex_math(nodes.General, nodes.Element):
- pass
-
-def math_role(role, rawtext, text, lineno, inliner,
- options={}, content=[]):
- i = rawtext.find('`')
- latex = rawtext[i+1:-1]
- try:
- mathml_tree = parse_latex_math(latex, inline=True)
- except SyntaxError, msg:
- msg = inliner.reporter.error(msg, line=lineno)
- prb = inliner.problematic(rawtext, rawtext, msg)
- return [prb], [msg]
- node = latex_math(rawtext)
- node['latex'] = latex
- node['mathml_tree'] = mathml_tree
- return [node], []
-
-
-try:
- from docutils.parsers.rst import Directive
-except ImportError:
- # Register directive the old way:
- from docutils.parsers.rst.directives import _directives
- def math_directive(name, arguments, options, content, lineno,
- content_offset, block_text, state, state_machine):
- latex = ''.join(content)
- try:
- mathml_tree = parse_latex_math(latex, inline=False)
- except SyntaxError, msg:
- error = state_machine.reporter.error(
- msg, nodes.literal_block(block_text, block_text), line=lineno)
- return [error]
- node = latex_math(block_text)
- node['latex'] = latex
- node['mathml_tree'] = mathml_tree
- return [node]
- math_directive.arguments = None
- math_directive.options = {}
- math_directive.content = 1
- _directives['math'] = math_directive
-else:
- class math_directive(Directive):
- has_content = True
- def run(self):
- latex = ' '.join(self.content)
- try:
- mathml_tree = parse_latex_math(latex, inline=False)
- except SyntaxError, msg:
- error = self.state_machine.reporter.error(
- msg, nodes.literal_block(self.block_text, self.block_text),
- line=self.lineno)
- return [error]
- node = latex_math(self.block_text)
- node['latex'] = latex
- node['mathml_tree'] = mathml_tree
- return [node]
- from docutils.parsers.rst import directives
- directives.register_directive('math', math_directive)
-
-def setup(app):
- app.add_node(latex_math)
- app.add_role('math', math_role)
-
- # Add visit/depart methods to HTML-Translator:
- def visit_latex_math_html(self, node):
- mathml = ''.join(node['mathml_tree'].xml())
- self.body.append(mathml)
- def depart_latex_math_html(self, node):
- pass
- HTMLTranslator.visit_latex_math = visit_latex_math_html
- HTMLTranslator.depart_latex_math = depart_latex_math_html
-
- # Add visit/depart methods to LaTeX-Translator:
- def visit_latex_math_latex(self, node):
- inline = isinstance(node.parent, nodes.TextElement)
- if inline:
- self.body.append('$%s$' % node['latex'])
- else:
- self.body.extend(['\\begin{equation}',
- node['latex'],
- '\\end{equation}'])
- def depart_latex_math_latex(self, node):
- pass
- LaTeXTranslator.visit_latex_math = visit_latex_math_latex
- LaTeXTranslator.depart_latex_math = depart_latex_math_latex
-
-
-# LaTeX to MathML translation stuff:
-class math:
- """Base class for MathML elements."""
-
- nchildren = 1000000
- """Required number of children"""
-
- def __init__(self, children=None, inline=None):
- """math([children]) -> MathML element
-
- children can be one child or a list of children."""
-
- self.children = []
- if children is not None:
- if type(children) is list:
- for child in children:
- self.append(child)
- else:
- # Only one child:
- self.append(children)
-
- if inline is not None:
- self.inline = inline
-
- def __repr__(self):
- if hasattr(self, 'children'):
- return self.__class__.__name__ + '(%s)' % \
- ','.join([repr(child) for child in self.children])
- else:
- return self.__class__.__name__
-
- def full(self):
- """Room for more children?"""
-
- return len(self.children) >= self.nchildren
-
- def append(self, child):
- """append(child) -> element
-
- Appends child and returns self if self is not full or first
- non-full parent."""
-
- assert not self.full()
- self.children.append(child)
- child.parent = self
- node = self
- while node.full():
- node = node.parent
- return node
-
- def delete_child(self):
- """delete_child() -> child
-
- Delete last child and return it."""
-
- child = self.children[-1]
- del self.children[-1]
- return child
-
- def close(self):
- """close() -> parent
-
- Close element and return first non-full element."""
-
- parent = self.parent
- while parent.full():
- parent = parent.parent
- return parent
-
- def xml(self):
- """xml() -> xml-string"""
-
- return self.xml_start() + self.xml_body() + self.xml_end()
-
- def xml_start(self):
- if not hasattr(self, 'inline'):
- return ['<%s>' % self.__class__.__name__]
- xmlns = 'http://www.w3.org/1998/Math/MathML'
- if self.inline:
- return ['<math xmlns="%s">' % xmlns]
- else:
- return ['<math xmlns="%s" mode="display">' % xmlns]
-
- def xml_end(self):
- return ['</%s>' % self.__class__.__name__]
-
- def xml_body(self):
- xml = []
- for child in self.children:
- xml.extend(child.xml())
- return xml
-
-class mrow(math): pass
-class mtable(math): pass
-class mtr(mrow): pass
-class mtd(mrow): pass
-
-class mx(math):
- """Base class for mo, mi, and mn"""
-
- nchildren = 0
- def __init__(self, data):
- self.data = data
-
- def xml_body(self):
- return [self.data]
-
-class mo(mx):
- translation = {'<': '<', '>': '>'}
- def xml_body(self):
- return [self.translation.get(self.data, self.data)]
-
-class mi(mx): pass
-class mn(mx): pass
-
-class msub(math):
- nchildren = 2
-
-class msup(math):
- nchildren = 2
-
-class msqrt(math):
- nchildren = 1
-
-class mroot(math):
- nchildren = 2
-
-class mfrac(math):
- nchildren = 2
-
-class msubsup(math):
- nchildren = 3
- def __init__(self, children=None, reversed=False):
- self.reversed = reversed
- math.__init__(self, children)
-
- def xml(self):
- if self.reversed:
-## self.children[1:3] = self.children[2:0:-1]
- self.children[1:3] = [self.children[2], self.children[1]]
- self.reversed = False
- return math.xml(self)
-
-class mfenced(math):
- translation = {'\\{': '{', '\\langle': u'\u2329',
- '\\}': '}', '\\rangle': u'\u232A',
- '.': ''}
- def __init__(self, par):
- self.openpar = par
- math.__init__(self)
-
- def xml_start(self):
- open = self.translation.get(self.openpar, self.openpar)
- close = self.translation.get(self.closepar, self.closepar)
- return ['<mfenced open="%s" close="%s">' % (open, close)]
-
-class mspace(math):
- nchildren = 0
-
-class mstyle(math):
- def __init__(self, children=None, nchildren=None, **kwargs):
- if nchildren is not None:
- self.nchildren = nchildren
- math.__init__(self, children)
- self.attrs = kwargs
-
- def xml_start(self):
- return ['<mstyle '] + ['%s="%s"' % item
- for item in self.attrs.items()] + ['>']
-
-class mover(math):
- nchildren = 2
- def __init__(self, children=None, reversed=False):
- self.reversed = reversed
- math.__init__(self, children)
-
- def xml(self):
- if self.reversed:
- self.children.reverse()
- self.reversed = False
- return math.xml(self)
-
-class munder(math):
- nchildren = 2
-
-class munderover(math):
- nchildren = 3
- def __init__(self, children=None):
- math.__init__(self, children)
-
-class mtext(math):
- nchildren = 0
- def __init__(self, text):
- self.text = text
-
- def xml_body(self):
- return [self.text]
-
-
-over = {'tilde': '~',
- 'hat': '^',
- 'bar': '_',
- 'vec': u'\u2192'}
-
-Greek = {
- # Upper case greek letters:
- 'Phi': u'\u03a6', 'Xi': u'\u039e', 'Sigma': u'\u03a3', 'Psi': u'\u03a8', 'Delta': u'\u0394', 'Theta': u'\u0398', 'Upsilon': u'\u03d2', 'Pi': u'\u03a0', 'Omega': u'\u03a9', 'Gamma': u'\u0393', 'Lambda': u'\u039b'}
-greek = {
- # Lower case greek letters:
- 'tau': u'\u03c4', 'phi': u'\u03d5', 'xi': u'\u03be', 'iota': u'\u03b9', 'epsilon': u'\u03f5', 'varrho': u'\u03f1', 'varsigma': u'\u03c2', 'beta': u'\u03b2', 'psi': u'\u03c8', 'rho': u'\u03c1', 'delta': u'\u03b4', 'alpha': u'\u03b1', 'zeta': u'\u03b6', 'omega': u'\u03c9', 'varepsilon': u'\u03b5', 'kappa': u'\u03ba', 'vartheta': u'\u03d1', 'chi': u'\u03c7', 'upsilon': u'\u03c5', 'sigma': u'\u03c3', 'varphi': u'\u03c6', 'varpi': u'\u03d6', 'mu': u'\u03bc', 'eta': u'\u03b7', 'theta': u'\u03b8', 'pi': u'\u03c0', 'varkappa': u'\u03f0', 'nu': u'\u03bd', 'gamma': u'\u03b3', 'lambda': u'\u03bb'}
-
-special = {
- # Binary operation symbols:
- 'wedge': u'\u2227', 'diamond': u'\u22c4', 'star': u'\u22c6', 'amalg': u'\u2a3f', 'ast': u'\u2217', 'odot': u'\u2299', 'triangleleft': u'\u25c1', 'bigtriangleup': u'\u25b3', 'ominus': u'\u2296', 'ddagger': u'\u2021', 'wr': u'\u2240', 'otimes': u'\u2297', 'sqcup': u'\u2294', 'oplus': u'\u2295', 'bigcirc': u'\u25cb', 'oslash': u'\u2298', 'sqcap': u'\u2293', 'bullet': u'\u2219', 'cup': u'\u222a', 'cdot': u'\u22c5', 'cap': u'\u2229', 'bigtriangledown': u'\u25bd', 'times': u'\xd7', 'setminus': u'\u2216', 'circ': u'\u2218', 'vee': u'\u2228', 'uplus': u'\u228e', 'mp': u'\u2213', 'dagger': u'\u2020', 'triangleright': u'\u25b7', 'div': u'\xf7', 'pm': u'\xb1',
- # Relation symbols:
- 'subset': u'\u2282', 'propto': u'\u221d', 'geq': u'\u2265', 'ge': u'\u2265', 'sqsubset': u'\u228f', 'Join': u'\u2a1d', 'frown': u'\u2322', 'models': u'\u22a7', 'supset': u'\u2283', 'in': u'\u2208', 'doteq': u'\u2250', 'dashv': u'\u22a3', 'gg': u'\u226b', 'leq': u'\u2264', 'succ': u'\u227b', 'vdash': u'\u22a2', 'cong': u'\u2245', 'simeq': u'\u2243', 'subseteq': u'\u2286', 'parallel': u'\u2225', 'equiv': u'\u2261', 'ni': u'\u220b', 'le': u'\u2264', 'approx': u'\u2248', 'precsim': u'\u227e', 'sqsupset': u'\u2290', 'll': u'\u226a', 'sqsupseteq': u'\u2292', 'mid': u'\u2223', 'prec': u'\u227a', 'succsim': u'\u227f', 'bowtie': u'\u22c8', 'perp': u'\u27c2', 'sqsubseteq': u'\u2291', 'asymp': u'\u224d', 'smile': u'\u2323', 'supseteq': u'\u2287', 'sim': u'\u223c', 'neq': u'\u2260',
- # Arrow symbols:
- 'searrow': u'\u2198', 'updownarrow': u'\u2195', 'Uparrow': u'\u21d1', 'longleftrightarrow': u'\u27f7', 'Leftarrow': u'\u21d0', 'longmapsto': u'\u27fc', 'Longleftarrow': u'\u27f8', 'nearrow': u'\u2197', 'hookleftarrow': u'\u21a9', 'downarrow': u'\u2193', 'Leftrightarrow': u'\u21d4', 'longrightarrow': u'\u27f6', 'rightharpoondown': u'\u21c1', 'longleftarrow': u'\u27f5', 'rightarrow': u'\u2192', 'Updownarrow': u'\u21d5', 'rightharpoonup': u'\u21c0', 'Longleftrightarrow': u'\u27fa', 'leftarrow': u'\u2190', 'mapsto': u'\u21a6', 'nwarrow': u'\u2196', 'uparrow': u'\u2191', 'leftharpoonup': u'\u21bc', 'leftharpoondown': u'\u21bd', 'Downarrow': u'\u21d3', 'leftrightarrow': u'\u2194', 'Longrightarrow': u'\u27f9', 'swarrow': u'\u2199', 'hookrightarrow': u'\u21aa', 'Rightarrow': u'\u21d2',
- # Miscellaneous symbols:
- 'infty': u'\u221e', 'surd': u'\u221a', 'partial': u'\u2202', 'ddots': u'\u22f1', 'exists': u'\u2203', 'flat': u'\u266d', 'diamondsuit': u'\u2662', 'wp': u'\u2118', 'spadesuit': u'\u2660', 'Re': u'\u211c', 'vdots': u'\u22ee', 'aleph': u'\u2135', 'clubsuit': u'\u2663', 'sharp': u'\u266f', 'angle': u'\u2220', 'prime': u'\u2032', 'natural': u'\u266e', 'ell': u'\u2113', 'neg': u'\xac', 'top': u'\u22a4', 'nabla': u'\u2207', 'bot': u'\u22a5', 'heartsuit': u'\u2661', 'cdots': u'\u22ef', 'Im': u'\u2111', 'forall': u'\u2200', 'imath': u'\u0131', 'hbar': u'\u210f', 'emptyset': u'\u2205',
- # Variable-sized symbols:
- 'bigotimes': u'\u2a02', 'coprod': u'\u2210', 'int': u'\u222b', 'sum': u'\u2211', 'bigodot': u'\u2a00', 'bigcup': u'\u22c3', 'biguplus': u'\u2a04', 'bigcap': u'\u22c2', 'bigoplus': u'\u2a01', 'oint': u'\u222e', 'bigvee': u'\u22c1', 'bigwedge': u'\u22c0', 'prod': u'\u220f',
- # Braces:
- 'langle': u'\u2329', 'rangle': u'\u232A'}
-
-sumintprod = ''.join([special[symbol] for symbol in
- ['sum', 'int', 'oint', 'prod']])
-
-functions = ['arccos', 'arcsin', 'arctan', 'arg', 'cos', 'cosh',
- 'cot', 'coth', 'csc', 'deg', 'det', 'dim',
- 'exp', 'gcd', 'hom', 'inf', 'ker', 'lg',
- 'lim', 'liminf', 'limsup', 'ln', 'log', 'max',
- 'min', 'Pr', 'sec', 'sin', 'sinh', 'sup',
- 'tan', 'tanh',
- 'injlim', 'varinjlim', 'varlimsup',
- 'projlim', 'varliminf', 'varprojlim']
-
-
-def parse_latex_math(string, inline=True):
- """parse_latex_math(string [,inline]) -> MathML-tree
-
- Returns a MathML-tree parsed from string. inline=True is for
- inline math and inline=False is for displayed math.
-
- tree is the whole tree and node is the current element."""
-
- # Normalize white-space:
- string = ' '.join(string.split())
-
- if inline:
- node = mrow()
- tree = math(node, inline=True)
- else:
- node = mtd()
- tree = math(mtable(mtr(node)), inline=False)
-
- while len(string) > 0:
- n = len(string)
- c = string[0]
- skip = 1 # number of characters consumed
- if n > 1:
- c2 = string[1]
- else:
- c2 = ''
-## print n, string, c, c2, node.__class__.__name__
- if c == ' ':
- pass
- elif c == '\\':
- if c2 in '{}':
- node = node.append(mo(c2))
- skip = 2
- elif c2 == ' ':
- node = node.append(mspace())
- skip = 2
- elif c2.isalpha():
- # We have a LaTeX-name:
- i = 2
- while i < n and string[i].isalpha():
- i += 1
- name = string[1:i]
- node, skip = handle_keyword(name, node, string[i:])
- skip += i
- elif c2 == '\\':
- # End of a row:
- entry = mtd()
- row = mtr(entry)
- node.close().close().append(row)
- node = entry
- skip = 2
- else:
- raise SyntaxError('Syntax error: "%s%s"' % (c, c2))
- elif c.isalpha():
- node = node.append(mi(c))
- elif c.isdigit():
- node = node.append(mn(c))
- elif c in "+-/()[]|=<>,.!'":
- node = node.append(mo(c))
- elif c == '_':
- child = node.delete_child()
- if isinstance(child, msup):
- sub = msubsup(child.children, reversed=True)
- elif isinstance(child, mo) and child.data in sumintprod:
- sub = munder(child)
- else:
- sub = msub(child)
- node.append(sub)
- node = sub
- elif c == '^':
- child = node.delete_child()
- if isinstance(child, msub):
- sup = msubsup(child.children)
- elif isinstance(child, mo) and child.data in sumintprod:
- sup = mover(child)
- elif (isinstance(child, munder) and
- child.children[0].data in sumintprod):
- sup = munderover(child.children)
- else:
- sup = msup(child)
- node.append(sup)
- node = sup
- elif c == '{':
- row = mrow()
- node.append(row)
- node = row
- elif c == '}':
- node = node.close()
- elif c == '&':
- entry = mtd()
- node.close().append(entry)
- node = entry
- else:
- raise SyntaxError('Illegal character: "%s"' % c)
- string = string[skip:]
- return tree
-
-
-mathbb = {'A': u'\U0001D538',
- 'B': u'\U0001D539',
- 'C': u'\u2102',
- 'D': u'\U0001D53B',
- 'E': u'\U0001D53C',
- 'F': u'\U0001D53D',
- 'G': u'\U0001D53E',
- 'H': u'\u210D',
- 'I': u'\U0001D540',
- 'J': u'\U0001D541',
- 'K': u'\U0001D542',
- 'L': u'\U0001D543',
- 'M': u'\U0001D544',
- 'N': u'\u2115',
- 'O': u'\U0001D546',
- 'P': u'\u2119',
- 'Q': u'\u211A',
- 'R': u'\u211D',
- 'S': u'\U0001D54A',
- 'T': u'\U0001D54B',
- 'U': u'\U0001D54C',
- 'V': u'\U0001D54D',
- 'W': u'\U0001D54E',
- 'X': u'\U0001D54F',
- 'Y': u'\U0001D550',
- 'Z': u'\u2124'}
-
-negatables = {'=': u'\u2260',
- '\in': u'\u2209',
- '\equiv': u'\u2262'}
-
-
-def handle_keyword(name, node, string):
- skip = 0
- if len(string) > 0 and string[0] == ' ':
- string = string[1:]
- skip = 1
- if name == 'begin':
- if not string.startswith('{matrix}'):
- raise SyntaxError('Expected "\begin{matrix}"!')
- skip += 8
- entry = mtd()
- table = mtable(mtr(entry))
- node.append(table)
- node = entry
- elif name == 'end':
- if not string.startswith('{matrix}'):
- raise SyntaxError('Expected "\end{matrix}"!')
- skip += 8
- node = node.close().close().close()
- elif name == 'text':
- if string[0] != '{':
- raise SyntaxError('Expected "\text{...}"!')
- i = string.find('}')
- if i == -1:
- raise SyntaxError('Expected "\text{...}"!')
- node = node.append(mtext(string[1:i]))
- skip += i + 1
- elif name == 'sqrt':
- sqrt = msqrt()
- node.append(sqrt)
- node = sqrt
- elif name == 'frac':
- frac = mfrac()
- node.append(frac)
- node = frac
- elif name == 'left':
- for par in ['(', '[', '|', '\\{', '\\langle', '.']:
- if string.startswith(par):
- break
- else:
- raise SyntaxError('Missing left-brace!')
- fenced = mfenced(par)
- node.append(fenced)
- row = mrow()
- fenced.append(row)
- node = row
- skip += len(par)
- elif name == 'right':
- for par in [')', ']', '|', '\\}', '\\rangle', '.']:
- if string.startswith(par):
- break
- else:
- raise SyntaxError('Missing right-brace!')
- node = node.close()
- node.closepar = par
- node = node.close()
- skip += len(par)
- elif name == 'not':
- for operator in negatables:
- if string.startswith(operator):
- break
- else:
- raise SyntaxError('Expected something to negate: "\\not ..."!')
- node = node.append(mo(negatables[operator]))
- skip += len(operator)
- elif name == 'mathbf':
- style = mstyle(nchildren=1, fontweight='bold')
- node.append(style)
- node = style
- elif name == 'mathbb':
- if string[0] != '{' or not string[1].isupper() or string[2] != '}':
- raise SyntaxError('Expected something like "\mathbb{A}"!')
- node = node.append(mi(mathbb[string[1]]))
- skip += 3
- elif name in greek:
- node = node.append(mi(greek[name]))
- elif name in Greek:
- node = node.append(mo(Greek[name]))
- elif name in special:
- node = node.append(mo(special[name]))
- elif name in functions:
- node = node.append(mo(name))
- else:
- chr = over.get(name)
- if chr is not None:
- ovr = mover(mo(chr), reversed=True)
- node.append(ovr)
- node = ovr
- else:
- raise SyntaxError('Unknown LaTeX command: ' + name)
-
- return node, skip
Copied: trunk/py4science/examples/sphinx_template/sphinxext/mathmpl.py (from rev 6022, trunk/py4science/examples/sphinx_template/sphinxext/mathpng.py)
===================================================================
--- trunk/py4science/examples/sphinx_template/sphinxext/mathmpl.py (rev 0)
+++ trunk/py4science/examples/sphinx_template/sphinxext/mathmpl.py 2008-08-12 17:54:48 UTC (rev 6023)
@@ -0,0 +1,134 @@
+import os
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
+
+from docutils import nodes
+from docutils.writers.html4css1 import HTMLTranslator
+from sphinx.latexwriter import LaTeXTranslator
+
+# Define LaTeX math node:
+class latex_math(nodes.General, nodes.Element):
+ pass
+
+def math_role(role, rawtext, text, lineno, inliner,
+ options={}, content=[]):
+ i = rawtext.find('`')
+ latex = rawtext[i+1:-1]
+ node = latex_math(rawtext)
+ node['latex'] = latex
+ return [node], []
+
+
+try:
+ from docutils.parsers.rst import Directive
+except ImportError:
+ # Register directive the old way:
+ from docutils.parsers.rst.directives import _directives
+ def math_directive(name, arguments, options, content, lineno,
+ content_offset, block_text, state, state_machine):
+ latex = ''.join(content)
+ node = latex_math(block_text)
+ node['latex'] = latex
+ return [node]
+ math_directive.arguments = None
+ math_directive.options = {}
+ math_directive.content = 1
+ _directives['math'] = math_directive
+else:
+ class math_directive(Directive):
+ has_content = True
+ def run(self):
+ latex = ' '.join(self.content)
+ node = latex_math(self.block_text)
+ node['latex'] = latex
+ return [node]
+ from docutils.parsers.rst import directives
+ directives.register_directive('math', math_directive)
+
+def setup(app):
+ app.add_node(latex_math)
+ app.add_role('math', math_role)
+
+ # Add visit/depart methods to HTML-Translator:
+ def visit_latex_math_html(self, node):
+ source = self.document.attributes['source']
+ self.body.append(latex2html(node, source))
+ def depart_latex_math_html(self, node):
+ pass
+ HTMLTranslator.visit_latex_math = visit_latex_math_html
+ HTMLTranslator.depart_latex_math = depart_latex_math_html
+
+ # Add visit/depart methods to LaTeX-Translator:
+ def visit_latex_math_latex(self, node):
+ inline = isinstance(node.parent, nodes.TextElement)
+ if inline:
+ self.body.append('$%s$' % node['latex'])
+ else:
+ self.body.extend(['\\begin{equation}',
+ node['latex'],
+ '\\end{equation}'])
+ def depart_latex_math_latex(self, node):
+ pass
+ LaTeXTranslator.visit_latex_math = visit_latex_math_latex
+ LaTeXTranslator.depart_latex_math = depart_latex_math_latex
+
+from os.path import isfile
+
+# This calls out to LaTeX to render the expression
+def latex2png(latex, name):
+ f = open('math.tex', 'w')
+ f.write(r"""\documentclass[12pt]{article}
+ \pagestyle{empty}
+ \begin{document}""")
+ if inline:
+ f.write('$%s$' % latex)
+ else:
+ f.write(r'\[ %s \]' % latex)
+ f.write('\end{document}')
+ f.close()
+ os.system('latex --interaction=nonstopmode math.tex > /dev/null')
+ os.system('dvipng -bgTransparent -Ttight --noghostscript -l10 ' +
+ '-o %s math.dvi > /dev/null' % name)
+
+
+from matplotlib import rcParams
+from matplotlib.mathtext import MathTextParser
+rcParams['mathtext.fontset'] = 'cm'
+mathtext_parser = MathTextParser("Bitmap")
+
+
+# This uses mathtext to render the expression
+def latex2png(latex, filename):
+ if os.path.exists(filename):
+ return
+ mathtext_parser.to_png(filename, "$%s$" % latex, dpi=120)
+
+
+# LaTeX to HTML translation stuff:
+def latex2html(node, source):
+ inline = isinstance(node.parent, nodes.TextElement)
+ latex = node['latex']
+ print latex.encode("ascii", "backslashreplace")
+ name = 'math-%s' % md5(latex).hexdigest()[-10:]
+ dest = '_static/%s.png' % name
+ if not isfile(dest):
+ latex2png(latex, dest)
+
+ path = '_static'
+ count = source.split('/doc/')[-1].count('/')
+ for i in range(count):
+ if os.path.exists(path): break
+ path = '../'+path
+ path = '../'+path #specifically added for matplotlib
+ if inline and '_' in latex:
+ align = 'align="absmiddle" '
+ else:
+ align = ''
+ if inline:
+ cls = ''
+ else:
+ cls = 'class="center" '
+ return '<img src="%s/%s.png" %s%s/>' % (path, name, align, cls)
+
Deleted: trunk/py4science/examples/sphinx_template/sphinxext/mathpng.py
===================================================================
--- trunk/py4science/examples/sphinx_template/sphinxext/mathpng.py 2008-08-12 16:03:19 UTC (rev 6022)
+++ trunk/py4science/examples/sphinx_template/sphinxext/mathpng.py 2008-08-12 17:54:48 UTC (rev 6023)
@@ -1,134 +0,0 @@
-import os
-try:
- from hashlib import md5
-except ImportError:
- from md5 import md5
-
-from docutils import nodes
-from docutils.writers.html4css1 import HTMLTranslator
-from sphinx.latexwriter import LaTeXTranslator
-
-# Define LaTeX math node:
-class latex_math(nodes.General, nodes.Element):
- pass
-
-def math_role(role, rawtext, text, lineno, inliner,
- options={}, content=[]):
- i = rawtext.find('`')
- latex = rawtext[i+1:-1]
- node = latex_math(rawtext)
- node['latex'] = latex
- return [node], []
-
-
-try:
- from docutils.parsers.rst import Directive
-except ImportError:
- # Register directive the old way:
- from docutils.parsers.rst.directives import _directives
- def math_directive(name, arguments, options, content, lineno,
- content_offset, block_text, state, state_machine):
- latex = ''.join(content)
- node = latex_math(block_text)
- node['latex'] = latex
- return [node]
- math_directive.arguments = None
- math_directive.options = {}
- math_directive.content = 1
- _directives['math'] = math_directive
-else:
- class math_directive(Directive):
- has_content = True
- def run(self):
- latex = ' '.join(self.content)
- node = latex_math(self.block_text)
- node['latex'] = latex
- return [node]
- from docutils.parsers.rst import directives
- directives.register_directive('math', math_directive)
-
-def setup(app):
- app.add_node(latex_math)
- app.add_role('math', math_role)
-
- # Add visit/depart methods to HTML-Translator:
- def visit_latex_math_html(self, node):
- source = self.document.attributes['source']
- self.body.append(latex2html(node, source))
- def depart_latex_math_html(self, node):
- pass
- HTMLTranslator.visit_latex_math = visit_latex_math_html
- HTMLTranslator.depart_latex_math = depart_latex_math_html
-
- # Add visit/depart methods to LaTeX-Translator:
- def visit_latex_math_latex(self, node):
- inline = isinstance(node.parent, nodes.TextElement)
- if inline:
- self.body.append('$%s$' % node['latex'])
- else:
- self.body.extend(['\\begin{equation}',
- node['latex'],
- '\\end{equation}'])
- def depart_latex_math_latex(self, node):
- pass
- LaTeXTranslator.visit_latex_math = visit_latex_math_latex
- LaTeXTranslator.depart_latex_math = depart_latex_math_latex
-
-from os.path import isfile
-
-# This calls out to LaTeX to render the expression
-def latex2png(latex, name):
- f = open('math.tex', 'w')
- f.write(r"""\documentclass[12pt]{article}
- \pagestyle{empty}
- \begin{document}""")
- if inline:
- f.write('$%s$' % latex)
- else:
- f.write(r'\[ %s \]' % latex)
- f.write('\end{document}')
- f.close()
- os.system('latex --interaction=nonstopmode math.tex > /dev/null')
- os.system('dvipng -bgTransparent -Ttight --noghostscript -l10 ' +
- '-o %s math.dvi > /dev/null' % name)
-
-
-from matplotlib import rcParams
-from matplotlib.mathtext import MathTextParser
-rcParams['mathtext.fontset'] = 'cm'
-mathtext_parser = MathTextParser("Bitmap")
-
-
-# This uses mathtext to render the expression
-def latex2png(latex, filename):
- if os.path.exists(filename):
- return
- mathtext_parser.to_png(filename, "$%s$" % latex, dpi=120)
-
-
-# LaTeX to HTML translation stuff:
-def latex2html(node, source):
- inline = isinstance(node.parent, nodes.TextElement)
- latex = node['latex']
- print latex.encode("ascii", "backslashreplace")
- name = 'math-%s' % md5(latex).hexdigest()[-10:]
- dest = '_static/%s.png' % name
- if not isfile(dest):
- latex2png(latex, dest)
-
- path = '_static'
- count = source.split('/doc/')[-1].count('/')
- for i in range(count):
- if os.path.exists(path): break
- path = '../'+path
- path = '../'+path #specifically added for matplotlib
- if inline and '_' in latex:
- align = 'align="absmiddle" '
- else:
- align = ''
- if inline:
- cls = ''
- else:
- cls = 'class="center" '
- return '<img src="%s/%s.png" %s%s/>' % (path, name, align, cls)
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-08-12 16:03:22
|
Revision: 6022
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6022&view=rev
Author: jdh2358
Date: 2008-08-12 16:03:19 +0000 (Tue, 12 Aug 2008)
Log Message:
-----------
some legend fixes
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/legend.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-08-11 15:34:30 UTC (rev 6021)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-08-12 16:03:19 UTC (rev 6022)
@@ -6364,7 +6364,7 @@
for p in patch:
p.update(kwargs)
p.set_label(label)
- label = '_nolegend'
+ label = '_nolegend_'
if len(n)==1:
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py 2008-08-11 15:34:30 UTC (rev 6021)
+++ trunk/matplotlib/lib/matplotlib/legend.py 2008-08-12 16:03:19 UTC (rev 6022)
@@ -520,7 +520,8 @@
if isinstance(handle, Line2D):
ydata = y*np.ones(handle.get_xdata().shape, float)
handle.set_ydata(ydata+h/2.)
- handle._legmarker.set_ydata(ydata+h/2.)
+ if hasattr(handle, '_legmarker'):
+ handle._legmarker.set_ydata(ydata+h/2.)
elif isinstance(handle, Rectangle):
handle.set_y(y+1/4*h)
handle.set_height(h/2)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-08-11 15:34:37
|
Revision: 6021
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6021&view=rev
Author: jswhit
Date: 2008-08-11 15:34:30 +0000 (Mon, 11 Aug 2008)
Log Message:
-----------
up version number
Modified Paths:
--------------
trunk/toolkits/basemap/src/_geoslib.c
trunk/toolkits/basemap/src/_geoslib.pyx
Modified: trunk/toolkits/basemap/src/_geoslib.c
===================================================================
--- trunk/toolkits/basemap/src/_geoslib.c 2008-08-11 15:07:49 UTC (rev 6020)
+++ trunk/toolkits/basemap/src/_geoslib.c 2008-08-11 15:34:30 UTC (rev 6021)
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.9.8 on Mon Aug 11 09:07:15 2008 */
+/* Generated by Cython 0.9.8 on Mon Aug 11 09:34:06 2008 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -297,7 +297,7 @@
/* Implementation of _geoslib */
-static char __pyx_k_1[] = "0.1";
+static char __pyx_k_1[] = "0.2";
static char __pyx_k_is_valid[] = "is_valid";
static char __pyx_k_geom_type[] = "geom_type";
@@ -3480,7 +3480,7 @@
* import sys
* import numpy # <<<<<<<<<<<<<<
*
- * __version__ = "0.1"
+ * __version__ = "0.2"
*/
__pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1;}
if (PyObject_SetAttr(__pyx_m, __pyx_kp_numpy, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1;}
@@ -3489,7 +3489,7 @@
/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":4
* import numpy
*
- * __version__ = "0.1" # <<<<<<<<<<<<<<
+ * __version__ = "0.2" # <<<<<<<<<<<<<<
*
* # need some python C API functions for strings.
*/
Modified: trunk/toolkits/basemap/src/_geoslib.pyx
===================================================================
--- trunk/toolkits/basemap/src/_geoslib.pyx 2008-08-11 15:07:49 UTC (rev 6020)
+++ trunk/toolkits/basemap/src/_geoslib.pyx 2008-08-11 15:34:30 UTC (rev 6021)
@@ -1,7 +1,7 @@
import sys
import numpy
-__version__ = "0.1"
+__version__ = "0.2"
# need some python C API functions for strings.
cdef extern from "Python.h":
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-08-11 15:07:55
|
Revision: 6020
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6020&view=rev
Author: jswhit
Date: 2008-08-11 15:07:49 +0000 (Mon, 11 Aug 2008)
Log Message:
-----------
previous commit broke geos 2 compatibility
Modified Paths:
--------------
trunk/toolkits/basemap/src/_geoslib.c
trunk/toolkits/basemap/src/_geoslib.pyx
Modified: trunk/toolkits/basemap/src/_geoslib.c
===================================================================
--- trunk/toolkits/basemap/src/_geoslib.c 2008-08-11 13:01:47 UTC (rev 6019)
+++ trunk/toolkits/basemap/src/_geoslib.c 2008-08-11 15:07:49 UTC (rev 6020)
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.9.8 on Sat Aug 9 10:17:12 2008 */
+/* Generated by Cython 0.9.8 on Mon Aug 11 09:07:15 2008 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -228,7 +228,7 @@
/* Type declarations */
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":131
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":131
* initGEOS(notice_h, error_h)
*
* cdef class BaseGeometry: # <<<<<<<<<<<<<<
@@ -243,7 +243,7 @@
PyObject *boundary;
};
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":249
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":250
* return (self.__class__,(self.boundary,))
*
* cdef class Polygon(BaseGeometry): # <<<<<<<<<<<<<<
@@ -255,7 +255,7 @@
struct __pyx_obj_8_geoslib_BaseGeometry __pyx_base;
};
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":305
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":306
* return area
*
* cdef class LineString(BaseGeometry): # <<<<<<<<<<<<<<
@@ -267,7 +267,7 @@
struct __pyx_obj_8_geoslib_BaseGeometry __pyx_base;
};
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":337
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":338
* self.boundary = b
*
* cdef class Point(BaseGeometry): # <<<<<<<<<<<<<<
@@ -335,7 +335,7 @@
static PyObject *__pyx_kp_1;
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":102
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":102
* int GEOSCoordSeq_getSize(GEOSCoordSeq *s, unsigned int *size)
*
* cdef void notice_h(char *fmt, char*msg): # <<<<<<<<<<<<<<
@@ -364,7 +364,7 @@
__pyx_v_message = Py_None; Py_INCREF(Py_None);
__pyx_v_warn_msg = Py_None; Py_INCREF(Py_None);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":103
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":103
*
* cdef void notice_h(char *fmt, char*msg):
* format = PyString_FromString(fmt) # <<<<<<<<<<<<<<
@@ -376,7 +376,7 @@
__pyx_v_format = __pyx_1;
__pyx_1 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":104
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":104
* cdef void notice_h(char *fmt, char*msg):
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg) # <<<<<<<<<<<<<<
@@ -388,7 +388,7 @@
__pyx_v_message = __pyx_1;
__pyx_1 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":105
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":105
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
* try: # <<<<<<<<<<<<<<
@@ -397,7 +397,7 @@
*/
/*try:*/ {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":106
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":106
* message = PyString_FromString(msg)
* try:
* warn_msg = format % message # <<<<<<<<<<<<<<
@@ -413,7 +413,7 @@
__pyx_L2:;
Py_XDECREF(__pyx_1); __pyx_1 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":107
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":107
* try:
* warn_msg = format % message
* except: # <<<<<<<<<<<<<<
@@ -424,7 +424,7 @@
__Pyx_AddTraceback("_geoslib.notice_h");
if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1;}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":108
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":108
* warn_msg = format % message
* except:
* warn_msg = format # <<<<<<<<<<<<<<
@@ -441,7 +441,7 @@
}
__pyx_L3:;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":109
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":109
* except:
* warn_msg = format
* sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg) # <<<<<<<<<<<<<<
@@ -474,7 +474,7 @@
Py_DECREF(__pyx_v_warn_msg);
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":111
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":111
* sys.stdout.write('GEOS_NOTICE: %s\n' % warn_msg)
*
* cdef void error_h(char *fmt, char*msg): # <<<<<<<<<<<<<<
@@ -501,7 +501,7 @@
__pyx_v_message = Py_None; Py_INCREF(Py_None);
__pyx_v_warn_msg = Py_None; Py_INCREF(Py_None);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":112
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":112
*
* cdef void error_h(char *fmt, char*msg):
* format = PyString_FromString(fmt) # <<<<<<<<<<<<<<
@@ -513,7 +513,7 @@
__pyx_v_format = __pyx_1;
__pyx_1 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":113
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":113
* cdef void error_h(char *fmt, char*msg):
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg) # <<<<<<<<<<<<<<
@@ -525,7 +525,7 @@
__pyx_v_message = __pyx_1;
__pyx_1 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":114
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":114
* format = PyString_FromString(fmt)
* message = PyString_FromString(msg)
* try: # <<<<<<<<<<<<<<
@@ -534,7 +534,7 @@
*/
/*try:*/ {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":115
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":115
* message = PyString_FromString(msg)
* try:
* warn_msg = format % message # <<<<<<<<<<<<<<
@@ -550,7 +550,7 @@
__pyx_L2:;
Py_XDECREF(__pyx_1); __pyx_1 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":116
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":116
* try:
* warn_msg = format % message
* except: # <<<<<<<<<<<<<<
@@ -561,7 +561,7 @@
__Pyx_AddTraceback("_geoslib.error_h");
if (__Pyx_GetException(&__pyx_1, &__pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1;}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":117
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":117
* warn_msg = format % message
* except:
* warn_msg = format # <<<<<<<<<<<<<<
@@ -578,7 +578,7 @@
}
__pyx_L3:;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":118
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":118
* except:
* warn_msg = format
* sys.stderr.write('GEOS_ERROR: %s\n' % warn_msg) # <<<<<<<<<<<<<<
@@ -611,7 +611,7 @@
Py_DECREF(__pyx_v_warn_msg);
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":121
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":121
*
* # check library version
* cdef geos_version(): # <<<<<<<<<<<<<<
@@ -623,7 +623,7 @@
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":122
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":122
* # check library version
* cdef geos_version():
* return PyString_FromString(GEOSversion()) # <<<<<<<<<<<<<<
@@ -645,7 +645,7 @@
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":136
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":136
* cdef public object boundary
*
* def is_valid(self): # <<<<<<<<<<<<<<
@@ -659,7 +659,7 @@
PyObject *__pyx_r;
char __pyx_1;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":138
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":138
* def is_valid(self):
* cdef char valid
* valid = GEOSisValid(self._geom) # <<<<<<<<<<<<<<
@@ -668,7 +668,7 @@
*/
__pyx_v_valid = GEOSisValid(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":139
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":139
* cdef char valid
* valid = GEOSisValid(self._geom)
* if valid: # <<<<<<<<<<<<<<
@@ -678,7 +678,7 @@
__pyx_1 = __pyx_v_valid;
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":140
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":140
* valid = GEOSisValid(self._geom)
* if valid:
* return True # <<<<<<<<<<<<<<
@@ -692,7 +692,7 @@
}
/*else*/ {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":142
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":142
* return True
* else:
* return False # <<<<<<<<<<<<<<
@@ -710,7 +710,7 @@
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":144
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":144
* return False
*
* def geom_type(self): # <<<<<<<<<<<<<<
@@ -723,7 +723,7 @@
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":145
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":145
*
* def geom_type(self):
* return PyString_FromString(GEOSGeomType(self._geom)) # <<<<<<<<<<<<<<
@@ -745,7 +745,7 @@
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":147
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":147
* return PyString_FromString(GEOSGeomType(self._geom))
*
* def within(self, BaseGeometry geom): # <<<<<<<<<<<<<<
@@ -762,7 +762,7 @@
char __pyx_1;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1;}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":150
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":150
* cdef GEOSGeom *g1, *g2
* cdef char answer
* g1 = self._geom # <<<<<<<<<<<<<<
@@ -771,7 +771,7 @@
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":151
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":151
* cdef char answer
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
@@ -780,7 +780,7 @@
*/
__pyx_v_g2 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":152
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":152
* g1 = self._geom
* g2 = geom._geom
* answer = GEOSWithin(g1, g2) # <<<<<<<<<<<<<<
@@ -789,7 +789,7 @@
*/
__pyx_v_answer = GEOSWithin(__pyx_v_g1, __pyx_v_g2);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":153
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":153
* g2 = geom._geom
* answer = GEOSWithin(g1, g2)
* if answer: # <<<<<<<<<<<<<<
@@ -799,7 +799,7 @@
__pyx_1 = __pyx_v_answer;
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":154
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":154
* answer = GEOSWithin(g1, g2)
* if answer:
* return True # <<<<<<<<<<<<<<
@@ -813,7 +813,7 @@
}
/*else*/ {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":156
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":156
* return True
* else:
* return False # <<<<<<<<<<<<<<
@@ -835,7 +835,7 @@
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":158
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":158
* return False
*
* def simplify(self, tol): # <<<<<<<<<<<<<<
@@ -865,298 +865,311 @@
PyObject *__pyx_v_p;
PyObject *__pyx_v_type;
PyObject *__pyx_r;
- double __pyx_1;
- int __pyx_2;
+ int __pyx_1;
+ double __pyx_2;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
__pyx_v_b = Py_None; Py_INCREF(Py_None);
__pyx_v_p = Py_None; Py_INCREF(Py_None);
__pyx_v_type = Py_None; Py_INCREF(Py_None);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":162
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":162
* cdef double tolerance
* cdef int numgeoms, i, typeid
- * g1 = self._geom # <<<<<<<<<<<<<<
- * tolerance = tol
- * g3 = GEOSSimplify(g1,tolerance)
+ * if GEOS_VERSION_MAJOR > 2: # <<<<<<<<<<<<<<
+ * g1 = self._geom
+ * tolerance = tol
*/
- __pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
+ __pyx_1 = (GEOS_VERSION_MAJOR > 2);
+ if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":163
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":163
* cdef int numgeoms, i, typeid
- * g1 = self._geom
- * tolerance = tol # <<<<<<<<<<<<<<
- * g3 = GEOSSimplify(g1,tolerance)
- * typeid = GEOSGeomTypeId(g3)
+ * if GEOS_VERSION_MAJOR > 2:
+ * g1 = self._geom # <<<<<<<<<<<<<<
+ * tolerance = tol
+ * g3 = GEOSSimplify(g1,tolerance)
*/
- __pyx_1 = __pyx_PyFloat_AsDouble(__pyx_v_tol); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1;}
- __pyx_v_tolerance = __pyx_1;
+ __pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":164
- * g1 = self._geom
- * tolerance = tol
- * g3 = GEOSSimplify(g1,tolerance) # <<<<<<<<<<<<<<
- * typeid = GEOSGeomTypeId(g3)
- * if typeid == GEOS_POLYGON:
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":164
+ * if GEOS_VERSION_MAJOR > 2:
+ * g1 = self._geom
+ * tolerance = tol # <<<<<<<<<<<<<<
+ * g3 = GEOSSimplify(g1,tolerance)
+ * typeid = GEOSGeomTypeId(g3)
*/
- __pyx_v_g3 = GEOSSimplify(__pyx_v_g1, __pyx_v_tolerance);
+ __pyx_2 = __pyx_PyFloat_AsDouble(__pyx_v_tol); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_v_tolerance = __pyx_2;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":165
- * tolerance = tol
- * g3 = GEOSSimplify(g1,tolerance)
- * typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<<
- * if typeid == GEOS_POLYGON:
- * b = _get_coords(g3)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":165
+ * g1 = self._geom
+ * tolerance = tol
+ * g3 = GEOSSimplify(g1,tolerance) # <<<<<<<<<<<<<<
+ * typeid = GEOSGeomTypeId(g3)
+ * if typeid == GEOS_POLYGON:
*/
- __pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3);
+ __pyx_v_g3 = GEOSSimplify(__pyx_v_g1, __pyx_v_tolerance);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":166
- * g3 = GEOSSimplify(g1,tolerance)
- * typeid = GEOSGeomTypeId(g3)
- * if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<<
- * b = _get_coords(g3)
- * p = Polygon(b)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":166
+ * tolerance = tol
+ * g3 = GEOSSimplify(g1,tolerance)
+ * typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<<
+ * if typeid == GEOS_POLYGON:
+ * b = _get_coords(g3)
*/
- __pyx_2 = (__pyx_v_typeid == GEOS_POLYGON);
- if (__pyx_2) {
+ __pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":167
- * typeid = GEOSGeomTypeId(g3)
- * if typeid == GEOS_POLYGON:
- * b = _get_coords(g3) # <<<<<<<<<<<<<<
- * p = Polygon(b)
- * elif typeid == GEOS_LINESTRING:
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":167
+ * g3 = GEOSSimplify(g1,tolerance)
+ * typeid = GEOSGeomTypeId(g3)
+ * if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<<
+ * b = _get_coords(g3)
+ * p = Polygon(b)
*/
- __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_v_b);
- __pyx_v_b = __pyx_3;
- __pyx_3 = 0;
+ __pyx_1 = (__pyx_v_typeid == GEOS_POLYGON);
+ if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":168
- * if typeid == GEOS_POLYGON:
- * b = _get_coords(g3)
- * p = Polygon(b) # <<<<<<<<<<<<<<
- * elif typeid == GEOS_LINESTRING:
- * b = _get_coords(g3)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":168
+ * typeid = GEOSGeomTypeId(g3)
+ * if typeid == GEOS_POLYGON:
+ * b = _get_coords(g3) # <<<<<<<<<<<<<<
+ * p = Polygon(b)
+ * elif typeid == GEOS_LINESTRING:
*/
- __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_INCREF(__pyx_v_b);
- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
- __pyx_4 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
- Py_DECREF(__pyx_v_p);
- __pyx_v_p = __pyx_4;
- __pyx_4 = 0;
- goto __pyx_L4;
- }
+ __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_b);
+ __pyx_v_b = __pyx_3;
+ __pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":169
- * b = _get_coords(g3)
- * p = Polygon(b)
- * elif typeid == GEOS_LINESTRING: # <<<<<<<<<<<<<<
- * b = _get_coords(g3)
- * p = LineString(b)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":169
+ * if typeid == GEOS_POLYGON:
+ * b = _get_coords(g3)
+ * p = Polygon(b) # <<<<<<<<<<<<<<
+ * elif typeid == GEOS_LINESTRING:
+ * b = _get_coords(g3)
*/
- __pyx_2 = (__pyx_v_typeid == GEOS_LINESTRING);
- if (__pyx_2) {
+ __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_b);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
+ __pyx_4 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
+ Py_DECREF(__pyx_v_p);
+ __pyx_v_p = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L5;
+ }
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":170
- * p = Polygon(b)
- * elif typeid == GEOS_LINESTRING:
- * b = _get_coords(g3) # <<<<<<<<<<<<<<
- * p = LineString(b)
- * # for multi-geom structures, just return first one.
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":170
+ * b = _get_coords(g3)
+ * p = Polygon(b)
+ * elif typeid == GEOS_LINESTRING: # <<<<<<<<<<<<<<
+ * b = _get_coords(g3)
+ * p = LineString(b)
*/
- __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_v_b);
- __pyx_v_b = __pyx_3;
- __pyx_3 = 0;
+ __pyx_1 = (__pyx_v_typeid == GEOS_LINESTRING);
+ if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":171
- * elif typeid == GEOS_LINESTRING:
- * b = _get_coords(g3)
- * p = LineString(b) # <<<<<<<<<<<<<<
- * # for multi-geom structures, just return first one.
- * elif typeid == GEOS_MULTIPOLYGON:
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":171
+ * p = Polygon(b)
+ * elif typeid == GEOS_LINESTRING:
+ * b = _get_coords(g3) # <<<<<<<<<<<<<<
+ * p = LineString(b)
+ * # for multi-geom structures, just return first one.
*/
- __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_INCREF(__pyx_v_b);
- PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
- __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
- Py_DECREF(__pyx_v_p);
- __pyx_v_p = __pyx_3;
- __pyx_3 = 0;
- goto __pyx_L4;
- }
+ __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_b);
+ __pyx_v_b = __pyx_3;
+ __pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":173
- * p = LineString(b)
- * # for multi-geom structures, just return first one.
- * elif typeid == GEOS_MULTIPOLYGON: # <<<<<<<<<<<<<<
- * numgeoms = GEOSGetNumGeometries(g3)
- * gout = GEOSGetGeometryN(g3, 0)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":172
+ * elif typeid == GEOS_LINESTRING:
+ * b = _get_coords(g3)
+ * p = LineString(b) # <<<<<<<<<<<<<<
+ * # for multi-geom structures, just return first one.
+ * elif typeid == GEOS_MULTIPOLYGON:
*/
- __pyx_2 = (__pyx_v_typeid == GEOS_MULTIPOLYGON);
- if (__pyx_2) {
+ __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_b);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
+ __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
+ Py_DECREF(__pyx_v_p);
+ __pyx_v_p = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L5;
+ }
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":174
- * # for multi-geom structures, just return first one.
- * elif typeid == GEOS_MULTIPOLYGON:
- * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
- * gout = GEOSGetGeometryN(g3, 0)
- * b = _get_coords(gout)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":174
+ * p = LineString(b)
+ * # for multi-geom structures, just return first one.
+ * elif typeid == GEOS_MULTIPOLYGON: # <<<<<<<<<<<<<<
+ * numgeoms = GEOSGetNumGeometries(g3)
+ * gout = GEOSGetGeometryN(g3, 0)
*/
- __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
+ __pyx_1 = (__pyx_v_typeid == GEOS_MULTIPOLYGON);
+ if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":175
- * elif typeid == GEOS_MULTIPOLYGON:
- * numgeoms = GEOSGetNumGeometries(g3)
- * gout = GEOSGetGeometryN(g3, 0) # <<<<<<<<<<<<<<
- * b = _get_coords(gout)
- * p = Polygon(b)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":175
+ * # for multi-geom structures, just return first one.
+ * elif typeid == GEOS_MULTIPOLYGON:
+ * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout)
*/
- __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, 0);
+ __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":176
- * numgeoms = GEOSGetNumGeometries(g3)
- * gout = GEOSGetGeometryN(g3, 0)
- * b = _get_coords(gout) # <<<<<<<<<<<<<<
- * p = Polygon(b)
- * elif typeid == GEOS_MULTILINESTRING:
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":176
+ * elif typeid == GEOS_MULTIPOLYGON:
+ * numgeoms = GEOSGetNumGeometries(g3)
+ * gout = GEOSGetGeometryN(g3, 0) # <<<<<<<<<<<<<<
+ * b = _get_coords(gout)
+ * p = Polygon(b)
*/
- __pyx_4 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_v_b);
- __pyx_v_b = __pyx_4;
- __pyx_4 = 0;
+ __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, 0);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":177
- * gout = GEOSGetGeometryN(g3, 0)
- * b = _get_coords(gout)
- * p = Polygon(b) # <<<<<<<<<<<<<<
- * elif typeid == GEOS_MULTILINESTRING:
- * numgeoms = GEOSGetNumGeometries(g3)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":177
+ * numgeoms = GEOSGetNumGeometries(g3)
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout) # <<<<<<<<<<<<<<
+ * p = Polygon(b)
+ * elif typeid == GEOS_MULTILINESTRING:
*/
- __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_INCREF(__pyx_v_b);
- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
- __pyx_4 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
- Py_DECREF(__pyx_v_p);
- __pyx_v_p = __pyx_4;
- __pyx_4 = 0;
- goto __pyx_L4;
- }
+ __pyx_4 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_b);
+ __pyx_v_b = __pyx_4;
+ __pyx_4 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":178
- * b = _get_coords(gout)
- * p = Polygon(b)
- * elif typeid == GEOS_MULTILINESTRING: # <<<<<<<<<<<<<<
- * numgeoms = GEOSGetNumGeometries(g3)
- * gout = GEOSGetGeometryN(g3, 0)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":178
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout)
+ * p = Polygon(b) # <<<<<<<<<<<<<<
+ * elif typeid == GEOS_MULTILINESTRING:
+ * numgeoms = GEOSGetNumGeometries(g3)
*/
- __pyx_2 = (__pyx_v_typeid == GEOS_MULTILINESTRING);
- if (__pyx_2) {
+ __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_b);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
+ __pyx_4 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
+ Py_DECREF(__pyx_v_p);
+ __pyx_v_p = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L5;
+ }
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":179
- * p = Polygon(b)
- * elif typeid == GEOS_MULTILINESTRING:
- * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
- * gout = GEOSGetGeometryN(g3, 0)
- * b = _get_coords(gout)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":179
+ * b = _get_coords(gout)
+ * p = Polygon(b)
+ * elif typeid == GEOS_MULTILINESTRING: # <<<<<<<<<<<<<<
+ * numgeoms = GEOSGetNumGeometries(g3)
+ * gout = GEOSGetGeometryN(g3, 0)
*/
- __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
+ __pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING);
+ if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":180
- * elif typeid == GEOS_MULTILINESTRING:
- * numgeoms = GEOSGetNumGeometries(g3)
- * gout = GEOSGetGeometryN(g3, 0) # <<<<<<<<<<<<<<
- * b = _get_coords(gout)
- * p = LineString(b)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":180
+ * p = Polygon(b)
+ * elif typeid == GEOS_MULTILINESTRING:
+ * numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout)
*/
- __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, 0);
+ __pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":181
- * numgeoms = GEOSGetNumGeometries(g3)
- * gout = GEOSGetGeometryN(g3, 0)
- * b = _get_coords(gout) # <<<<<<<<<<<<<<
- * p = LineString(b)
- * else:
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":181
+ * elif typeid == GEOS_MULTILINESTRING:
+ * numgeoms = GEOSGetNumGeometries(g3)
+ * gout = GEOSGetGeometryN(g3, 0) # <<<<<<<<<<<<<<
+ * b = _get_coords(gout)
+ * p = LineString(b)
*/
- __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_v_b);
- __pyx_v_b = __pyx_3;
- __pyx_3 = 0;
+ __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, 0);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":182
- * gout = GEOSGetGeometryN(g3, 0)
- * b = _get_coords(gout)
- * p = LineString(b) # <<<<<<<<<<<<<<
- * else:
- * type = PyString_FromString(GEOSGeomType(g3))
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":182
+ * numgeoms = GEOSGetNumGeometries(g3)
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout) # <<<<<<<<<<<<<<
+ * p = LineString(b)
+ * else:
*/
- __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_INCREF(__pyx_v_b);
- PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
- __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
- Py_DECREF(__pyx_v_p);
- __pyx_v_p = __pyx_3;
- __pyx_3 = 0;
- goto __pyx_L4;
- }
- /*else*/ {
+ __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_b);
+ __pyx_v_b = __pyx_3;
+ __pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":184
- * p = LineString(b)
- * else:
- * type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<<
- * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
- * GEOSGeom_destroy(g3)
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":183
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout)
+ * p = LineString(b) # <<<<<<<<<<<<<<
+ * else:
+ * type = PyString_FromString(GEOSGeomType(g3))
*/
- __pyx_4 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_v_type);
- __pyx_v_type = __pyx_4;
- __pyx_4 = 0;
+ __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_b);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
+ __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
+ Py_DECREF(__pyx_v_p);
+ __pyx_v_p = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L5;
+ }
+ /*else*/ {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":185
- * else:
- * type = PyString_FromString(GEOSGeomType(g3))
- * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<<
- * GEOSGeom_destroy(g3)
- * return p
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":185
+ * p = LineString(b)
+ * else:
+ * type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<<
+ * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
+ * GEOSGeom_destroy(g3)
*/
- __pyx_3 = PyNumber_Remainder(__pyx_kp_5, __pyx_v_type); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
- __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
- PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
- __pyx_3 = 0;
- __pyx_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __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 = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
- }
- __pyx_L4:;
+ __pyx_4 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_type);
+ __pyx_v_type = __pyx_4;
+ __pyx_4 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":186
- * type = PyString_FromString(GEOSGeomType(g3))
- * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
- * GEOSGeom_destroy(g3) # <<<<<<<<<<<<<<
- * return p
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":186
+ * else:
+ * type = PyString_FromString(GEOSGeomType(g3))
+ * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<<
+ * GEOSGeom_destroy(g3)
+ * return p
+ */
+ __pyx_3 = PyNumber_Remainder(__pyx_kp_5, __pyx_v_type); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+ __pyx_3 = 0;
+ __pyx_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ }
+ __pyx_L5:;
+
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":187
+ * type = PyString_FromString(GEOSGeomType(g3))
+ * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
+ * GEOSGeom_destroy(g3) # <<<<<<<<<<<<<<
+ * return p
*
*/
- GEOSGeom_destroy(__pyx_v_g3);
+ GEOSGeom_destroy(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":187
- * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
- * GEOSGeom_destroy(g3)
- * return p # <<<<<<<<<<<<<<
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":188
+ * raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
+ * GEOSGeom_destroy(g3)
+ * return p # <<<<<<<<<<<<<<
*
* def intersects(self, BaseGeometry geom):
*/
- Py_INCREF(__pyx_v_p);
- __pyx_r = __pyx_v_p;
- goto __pyx_L0;
+ Py_INCREF(__pyx_v_p);
+ __pyx_r = __pyx_v_p;
+ goto __pyx_L0;
+ goto __pyx_L4;
+ }
+ __pyx_L4:;
__pyx_r = Py_None; Py_INCREF(Py_None);
goto __pyx_L0;
@@ -1172,8 +1185,8 @@
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":189
- * return p
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":190
+ * return p
*
* def intersects(self, BaseGeometry geom): # <<<<<<<<<<<<<<
* cdef GEOSGeom *g1, *g2
@@ -1187,9 +1200,9 @@
char __pyx_v_answer;
PyObject *__pyx_r;
char __pyx_1;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1;}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":192
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":193
* cdef GEOSGeom *g1, *g2
* cdef char answer
* g1 = self._geom # <<<<<<<<<<<<<<
@@ -1198,7 +1211,7 @@
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":193
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":194
* cdef char answer
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
@@ -1207,7 +1220,7 @@
*/
__pyx_v_g2 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":194
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":195
* g1 = self._geom
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2) # <<<<<<<<<<<<<<
@@ -1216,7 +1229,7 @@
*/
__pyx_v_answer = GEOSIntersects(__pyx_v_g1, __pyx_v_g2);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":195
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":196
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2)
* if answer: # <<<<<<<<<<<<<<
@@ -1226,7 +1239,7 @@
__pyx_1 = __pyx_v_answer;
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":196
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":197
* answer = GEOSIntersects(g1, g2)
* if answer:
* return True # <<<<<<<<<<<<<<
@@ -1240,7 +1253,7 @@
}
/*else*/ {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":198
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":199
* return True
* else:
* return False # <<<<<<<<<<<<<<
@@ -1262,7 +1275,7 @@
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":200
+/* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":201
* return False
*
* def intersection(self, BaseGeometry geom): # <<<<<<<<<<<<<<
@@ -1299,9 +1312,9 @@
__pyx_v_p = Py_None; Py_INCREF(Py_None);
__pyx_v_pout = Py_None; Py_INCREF(Py_None);
__pyx_v_type = Py_None; Py_INCREF(Py_None);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1;}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":204
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":205
* cdef char answer
* cdef int numgeoms, i, typeid
* g1 = self._geom # <<<<<<<<<<<<<<
@@ -1310,7 +1323,7 @@
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":205
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":206
* cdef int numgeoms, i, typeid
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
@@ -1319,7 +1332,7 @@
*/
__pyx_v_g2 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":206
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":207
* g1 = self._geom
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2) # <<<<<<<<<<<<<<
@@ -1328,7 +1341,7 @@
*/
__pyx_v_g3 = GEOSIntersection(__pyx_v_g1, __pyx_v_g2);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":207
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":208
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<<
@@ -1337,7 +1350,7 @@
*/
__pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":208
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":209
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<<
@@ -1347,42 +1360,42 @@
__pyx_1 = (__pyx_v_typeid == GEOS_POLYGON);
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":209
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":210
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = Polygon(b)
* pout = [p]
*/
- __pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":210
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":211
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
* p = Polygon(b) # <<<<<<<<<<<<<<
* pout = [p]
* elif typeid == GEOS_LINESTRING:
*/
- __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
- __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":211
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":212
* b = _get_coords(g3)
* p = Polygon(b)
* pout = [p] # <<<<<<<<<<<<<<
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
*/
- __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_p);
PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p);
Py_DECREF(__pyx_v_pout);
@@ -1391,7 +1404,7 @@
goto __pyx_L4;
}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":212
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":213
* p = Polygon(b)
* pout = [p]
* elif typeid == GEOS_LINESTRING: # <<<<<<<<<<<<<<
@@ -1401,42 +1414,42 @@
__pyx_1 = (__pyx_v_typeid == GEOS_LINESTRING);
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":213
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":214
* pout = [p]
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = LineString(b)
* pout = [p]
*/
- __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":214
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":215
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
* p = LineString(b) # <<<<<<<<<<<<<<
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON:
*/
- __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
- __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":215
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":216
* b = _get_coords(g3)
* p = LineString(b)
* pout = [p] # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
*/
- __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_p);
PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p);
Py_DECREF(__pyx_v_pout);
@@ -1445,7 +1458,7 @@
goto __pyx_L4;
}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":216
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":217
* p = LineString(b)
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON: # <<<<<<<<<<<<<<
@@ -1455,7 +1468,7 @@
__pyx_1 = (__pyx_v_typeid == GEOS_MULTIPOLYGON);
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":217
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":218
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
@@ -1464,19 +1477,19 @@
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":218
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":219
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
* pout = [] # <<<<<<<<<<<<<<
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
*/
- __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_3);
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":219
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":220
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
* for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
@@ -1485,7 +1498,7 @@
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":220
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":221
* pout = []
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<<
@@ -1494,48 +1507,48 @@
*/
__pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, __pyx_v_i);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":221
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":222
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = Polygon(b)
* pout.append(p)
*/
- __pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":222
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":223
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
* p = Polygon(b) # <<<<<<<<<<<<<<
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING:
*/
- __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
- __pyx_2 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_2;
__pyx_2 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":223
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":224
* b = _get_coords(gout)
* p = Polygon(b)
* pout.append(p) # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
*/
- __pyx_3 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
goto __pyx_L4;
}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":224
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":225
* p = Polygon(b)
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING: # <<<<<<<<<<<<<<
@@ -1545,7 +1558,7 @@
__pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING);
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":225
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":226
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
@@ -1554,19 +1567,19 @@
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":226
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":227
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
* pout = [] # <<<<<<<<<<<<<<
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
*/
- __pyx_2 = PyList_New(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyList_New(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_2);
__pyx_2 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":227
+ /* "/Volumes/User/jwhitaker/matplotlib/basemap/src/_geoslib.pyx":228
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
* for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
@@ -1575,7 +1588,7 @@
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
- /* "/Users/jsw/python/matplotlib/...
[truncated message content] |
|
From: <md...@us...> - 2008-08-11 13:01:52
|
Revision: 6019
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6019&view=rev
Author: mdboom
Date: 2008-08-11 13:01:47 +0000 (Mon, 11 Aug 2008)
Log Message:
-----------
Snapping bug in last commit.
Modified Paths:
--------------
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-08-11 12:48:50 UTC (rev 6018)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-08-11 13:01:47 UTC (rev 6019)
@@ -387,7 +387,7 @@
double x0, y0, x1, y1;
unsigned code;
- if (!path.should_simplify() || path.total_vertices() > 15)
+ if (path.total_vertices() > 15)
return false;
code = path.vertex(&x0, &y0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-08-11 12:48:59
|
Revision: 6018
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6018&view=rev
Author: mdboom
Date: 2008-08-11 12:48:50 +0000 (Mon, 11 Aug 2008)
Log Message:
-----------
Does simplify paths when NaN/inf is present.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/path.py
trunk/matplotlib/src/_backend_agg.cpp
trunk/matplotlib/src/_path.cpp
trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-08-11 07:09:16 UTC (rev 6017)
+++ trunk/matplotlib/CHANGELOG 2008-08-11 12:48:50 UTC (rev 6018)
@@ -1,3 +1,9 @@
+2008-08-11 Fix more bugs in NaN/inf handling. In particular, path simplification
+ (which does not handle NaNs or infs) will be turned off automatically
+ when infs or NaNs are present. Also masked arrays are now converted
+ to arrays with NaNs for consistent handling of masks and NaNs
+ - MGD and EF
+
=================================================================
2008-08-03 Released 0.98.3 at svn r5947
Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py 2008-08-11 07:09:16 UTC (rev 6017)
+++ trunk/matplotlib/lib/matplotlib/path.py 2008-08-11 12:48:50 UTC (rev 6018)
@@ -56,6 +56,11 @@
:class:`Path` objects, as an optimization, do not store a *codes*
at all, but have a default one provided for them by
:meth:`iter_segments`.
+
+ Note also that the vertices and codes arrays should be treated as
+ immutable -- there are a number of optimizations and assumptions
+ made up front in the constructor that will not change when the
+ data changes.
"""
# Path codes
@@ -84,46 +89,29 @@
dimension.
If *codes* is None, *vertices* will be treated as a series of
- line segments. If *vertices* contains masked values, the
- resulting path will be compressed, with ``MOVETO`` codes
- inserted in the correct places to jump over the masked
- regions.
+ line segments.
+
+ If *vertices* contains masked values, they will be converted
+ to NaNs which are then handled correctly by the Agg
+ PathIterator and other consumers of path data, such as
+ :meth:`iter_segments`.
"""
if ma.isMaskedArray(vertices):
- is_mask = True
- mask = ma.getmask(vertices)
+ vertices = vertices.astype(np.float_).filled(np.nan)
else:
- is_mask = False
vertices = np.asarray(vertices, np.float_)
- mask = ma.nomask
if codes is not None:
codes = np.asarray(codes, self.code_type)
assert codes.ndim == 1
assert len(codes) == len(vertices)
- # The path being passed in may have masked values. However,
- # the backends (and any affine transformations in matplotlib
- # itself), are not expected to deal with masked arrays, so we
- # must remove them from the array (using compressed), and add
- # MOVETO commands to the codes array accordingly.
- if is_mask:
- if mask is not ma.nomask:
- mask1d = np.logical_or.reduce(mask, axis=1)
- gmask1d = np.invert(mask1d)
- if codes is None:
- codes = np.empty((len(vertices)), self.code_type)
- codes.fill(self.LINETO)
- codes[0] = self.MOVETO
- vertices = vertices[gmask1d].filled() # ndarray
- codes[np.roll(mask1d, 1)] = self.MOVETO
- codes = codes[gmask1d] # np.compress is much slower
- else:
- vertices = np.asarray(vertices, np.float_)
-
assert vertices.ndim == 2
assert vertices.shape[1] == 2
+ self.should_simplify = (codes is None and
+ np.all(np.isfinite(vertices)) and
+ len(vertices) >= 128)
self.codes = codes
self.vertices = vertices
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-08-11 07:09:16 UTC (rev 6017)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-08-11 12:48:50 UTC (rev 6018)
@@ -387,7 +387,7 @@
double x0, y0, x1, y1;
unsigned code;
- if (path.total_vertices() > 15)
+ if (!path.should_simplify() || path.total_vertices() > 15)
return false;
code = path.vertex(&x0, &y0);
@@ -420,11 +420,6 @@
return true;
}
-template<class Path>
-bool should_simplify(Path& path) {
- return !path.has_curves() && path.total_vertices() >= 128;
-}
-
Py::Object
RendererAgg::copy_from_bbox(const Py::Tuple& args) {
//copy region in bbox to buffer and return swig/agg buffer object
@@ -938,7 +933,7 @@
trans *= agg::trans_affine_scaling(1.0, -1.0);
trans *= agg::trans_affine_translation(0.0, (double)height);
bool snap = should_snap(path, trans);
- bool simplify = should_simplify(path) && !face.first;
+ bool simplify = path.should_simplify() && !face.first;
transformed_path_t tpath(path, trans);
simplify_t simplified(tpath, snap, simplify, width, height);
@@ -1236,6 +1231,10 @@
inline unsigned total_vertices() {
return 5;
}
+
+ inline bool should_simplify() {
+ return false;
+ }
};
public:
Modified: trunk/matplotlib/src/_path.cpp
===================================================================
--- trunk/matplotlib/src/_path.cpp 2008-08-11 07:09:16 UTC (rev 6017)
+++ trunk/matplotlib/src/_path.cpp 2008-08-11 12:48:50 UTC (rev 6018)
@@ -1120,7 +1120,7 @@
double width = Py::Float(args[2]);
double height = Py::Float(args[3]);
- bool simplify = !path.has_curves() && width != 0.0 && height != 0.0;
+ bool simplify = path.should_simplify() && width != 0.0 && height != 0.0;
transformed_path_t tpath(path, trans);
simplify_t simplified(tpath, false, simplify, width, height);
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2008-08-11 07:09:16 UTC (rev 6017)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-08-11 12:48:50 UTC (rev 6018)
@@ -15,6 +15,7 @@
PyArrayObject* m_codes;
size_t m_iterator;
size_t m_total_vertices;
+ bool m_should_simplify;
public:
PathIterator(const Py::Object& path_obj) :
@@ -22,6 +23,7 @@
{
Py::Object vertices_obj = path_obj.getAttr("vertices");
Py::Object codes_obj = path_obj.getAttr("codes");
+ Py::Object should_simplify_obj = path_obj.getAttr("should_simplify");
m_vertices = (PyArrayObject*)PyArray_FromObject
(vertices_obj.ptr(), PyArray_DOUBLE, 2, 2);
@@ -38,6 +40,7 @@
throw Py::ValueError("Invalid codes array.");
}
+ m_should_simplify = bool(Py::Int(should_simplify_obj));
m_total_vertices = m_vertices->dimensions[0];
}
@@ -100,9 +103,9 @@
return m_total_vertices;
}
- inline bool has_curves()
+ inline bool should_simplify()
{
- return m_codes;
+ return m_should_simplify;
}
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-08-11 07:09:22
|
Revision: 6017
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6017&view=rev
Author: efiring
Date: 2008-08-11 07:09:16 +0000 (Mon, 11 Aug 2008)
Log Message:
-----------
Eliminate duplicate Path instantiation
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/transforms.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-08-10 23:49:21 UTC (rev 6016)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-08-11 07:09:16 UTC (rev 6017)
@@ -1282,8 +1282,9 @@
line._remove_method = lambda h: self.lines.remove(h)
def _update_line_limits(self, line):
- xydata = line.get_xydata()
- self.update_datalim( xydata )
+ self.dataLim.update_from_path(line.get_path(),
+ self.ignore_existing_data_limits)
+ self.ignore_existing_data_limits = False
def add_patch(self, p):
"""
@@ -1307,12 +1308,11 @@
# the auto-scaling
if isinstance(p, mpatches.Rectangle) and (p.get_width()==0. or p.get_height()==0.):
return
-
vertices = p.get_patch_transform().transform(p.get_path().vertices)
if p.get_data_transform() != self.transData:
transform = p.get_data_transform() + self.transData.inverted()
xys = transform.transform(vertices)
-
+ # Something is wrong--xys is never used.
self.update_datalim(vertices)
def add_table(self, tab):
@@ -1327,6 +1327,8 @@
def relim(self):
'recompute the data limits based on current artists'
+ # Collections are deliberately not supported (yet); see
+ # the TODO note in artists.py.
self.dataLim.ignore(True)
self.ignore_existing_data_limits = True
for line in self.lines:
Modified: trunk/matplotlib/lib/matplotlib/transforms.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/transforms.py 2008-08-10 23:49:21 UTC (rev 6016)
+++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-08-11 07:09:16 UTC (rev 6017)
@@ -786,12 +786,12 @@
xy = np.hstack((x.reshape((len(x), 1)), y.reshape((len(y), 1))))
return self.update_from_data_xy(xy, ignore)
- def update_from_data_xy(self, xy, ignore=None):
+ def update_from_path(self, path, ignore=None):
"""
Update the bounds of the :class:`Bbox` based on the passed in
data.
- xy: a numpy array of 2D points
+ path: a Path instance
ignore:
- when True, ignore the existing bounds of the Bbox.
@@ -801,20 +801,33 @@
if ignore is None:
ignore = self._ignore
- if len(xy) == 0:
- return
- xym = ma.masked_invalid(xy) # maybe add copy=False
- if (xym.count(axis=1)!=2).all():
- return
-
points, minpos, changed = update_path_extents(
- Path(xym), None, self._points, self._minpos, ignore)
+ path, None, self._points, self._minpos, ignore)
if changed:
self._points = points
self._minpos = minpos
self.invalidate()
+
+ def update_from_data_xy(self, xy, ignore=None):
+ """
+ Update the bounds of the :class:`Bbox` based on the passed in
+ data.
+
+ xy: a numpy array of 2D points
+
+ ignore:
+ - when True, ignore the existing bounds of the Bbox.
+ - when False, include the existing bounds of the Bbox.
+ - when None, use the last value passed to :meth:`ignore`.
+ """
+ if len(xy) == 0:
+ return
+
+ path = Path(xy)
+ self.update_from_path(path, ignore=ignore)
+
def _set_x0(self, val):
self._points[0, 0] = val
self.invalidate()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-08-10 23:49:24
|
Revision: 6016
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6016&view=rev
Author: efiring
Date: 2008-08-10 23:49:21 +0000 (Sun, 10 Aug 2008)
Log Message:
-----------
Fix MPL_notisfinite64
Modified Paths:
--------------
trunk/matplotlib/src/MPL_isnan.h
Modified: trunk/matplotlib/src/MPL_isnan.h
===================================================================
--- trunk/matplotlib/src/MPL_isnan.h 2008-08-09 16:26:16 UTC (rev 6015)
+++ trunk/matplotlib/src/MPL_isnan.h 2008-08-10 23:49:21 UTC (rev 6016)
@@ -73,10 +73,10 @@
#if !defined(MPL_notisfinite64)
#if !defined(_MSC_VER)
#define MPL_notisfinite64(u) \
- ( (( MPL_U64(u) & 0x7ff0000000000000LL) != 0x7ff0000000000000LL)) ? 0:1
+ ( (( MPL_U64(u) & 0x7ff0000000000000LL) == 0x7ff0000000000000LL)) ? 1:0
#else
#define MPL_notisfinite64(u) \
- ( (( MPL_U64(u) & 0x7ff0000000000000i64) != 0x7ff0000000000000i64)) ? 0:1
+ ( (( MPL_U64(u) & 0x7ff0000000000000i64) == 0x7ff0000000000000i64)) ? 1:0
#endif
#endif /* MPL_notisfinite64 */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-08-09 16:26:19
|
Revision: 6015
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6015&view=rev
Author: jswhit
Date: 2008-08-09 16:26:16 +0000 (Sat, 09 Aug 2008)
Log Message:
-----------
added NetCDFFile test
Modified Paths:
--------------
trunk/toolkits/basemap/MANIFEST.in
Modified: trunk/toolkits/basemap/MANIFEST.in
===================================================================
--- trunk/toolkits/basemap/MANIFEST.in 2008-08-09 16:25:22 UTC (rev 6014)
+++ trunk/toolkits/basemap/MANIFEST.in 2008-08-09 16:26:16 UTC (rev 6015)
@@ -66,6 +66,7 @@
include examples/show_colormaps.py
include examples/plotprecip.py
include examples/nws_precip_conus_20061222.nc
+include examples/NetCDFFile_tst.py
include examples/README
include lib/mpl_toolkits/__init__.py
include lib/mpl_toolkits/basemap/__init__.py
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-08-09 16:25:27
|
Revision: 6014
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6014&view=rev
Author: jswhit
Date: 2008-08-09 16:25:22 +0000 (Sat, 09 Aug 2008)
Log Message:
-----------
added NetCDFFile test
Added Paths:
-----------
trunk/toolkits/basemap/examples/NetCDFFile_tst.py
Added: trunk/toolkits/basemap/examples/NetCDFFile_tst.py
===================================================================
--- trunk/toolkits/basemap/examples/NetCDFFile_tst.py (rev 0)
+++ trunk/toolkits/basemap/examples/NetCDFFile_tst.py 2008-08-09 16:25:22 UTC (rev 6014)
@@ -0,0 +1,65 @@
+import sys
+import unittest
+import os
+import tempfile
+from numpy import ma
+from numpy.testing import assert_array_equal, assert_array_almost_equal
+from numpy.random.mtrand import uniform
+from mpl_toolkits.basemap import NetCDFFile
+
+# test automatic conversion of masked arrays, and
+# packing/unpacking of short ints.
+
+FILE_NAME = tempfile.mktemp(".nc")
+ndim = 10
+ranarr = 100.*uniform(size=(ndim))
+packeddata = 10.*uniform(size=(ndim))
+missing_value = -9999.
+ranarr[::2] = missing_value
+maskedarr = ma.masked_values(ranarr,-9999.)
+scale_factor = (packeddata.max()-packeddata.min())/(2.*32766.)
+add_offset = 0.5*(packeddata.max()+packeddata.min())
+packeddata2 = ((packeddata-add_offset)/scale_factor).astype('i2')
+
+class TestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.file = FILE_NAME
+ file = NetCDFFile(self.file,'w')
+ file.createDimension('n', None) # use unlimited dim.
+ foo = file.createVariable('maskeddata', 'f8', ('n',))
+ foo.missing_value = missing_value
+ bar = file.createVariable('packeddata', 'i2', ('n',))
+ bar.scale_factor = scale_factor
+ bar.add_offset = add_offset
+ foo[0:ndim] = maskedarr
+ bar[0:ndim] = packeddata
+ file.close()
+
+ def tearDown(self):
+ # Remove the temporary files
+ os.remove(self.file)
+
+ def runTest(self):
+ """testing auto-conversion of masked arrays and packed integers"""
+ # no auto-conversion.
+ file = NetCDFFile(self.file,maskandscale=False)
+ datamasked = file.variables['maskeddata']
+ datapacked = file.variables['packeddata']
+ # check missing_value, scale_factor and add_offset attributes.
+ assert datamasked.missing_value == missing_value
+ assert datapacked.scale_factor == scale_factor
+ assert datapacked.add_offset == add_offset
+ assert_array_equal(datapacked[:],packeddata2)
+ assert_array_almost_equal(datamasked[:],ranarr)
+ file.close()
+ # auto-conversion
+ file = NetCDFFile(self.file)
+ datamasked = file.variables['maskeddata']
+ datapacked = file.variables['packeddata']
+ assert_array_almost_equal(datamasked[:].filled(),ranarr)
+ assert_array_almost_equal(datapacked[:],packeddata,decimal=4)
+ file.close()
+
+if __name__ == '__main__':
+ unittest.main()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-08-09 16:18:23
|
Revision: 6013
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6013&view=rev
Author: jswhit
Date: 2008-08-09 16:18:19 +0000 (Sat, 09 Aug 2008)
Log Message:
-----------
simplify treatment of dodgy geometries in GEOS 3
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
trunk/toolkits/basemap/src/_geoslib.c
trunk/toolkits/basemap/src/_geoslib.pyx
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-09 14:49:42 UTC (rev 6012)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-08-09 16:18:19 UTC (rev 6013)
@@ -985,7 +985,7 @@
# found non-noded intersection between ..."
# with geos 3.0.0
if _geoslib.__geos_major_version__ > 2:
- poly = poly.simplify(1.e-10)[0]
+ poly = poly.simplify(1.e-10)
# if geometry instersects map projection
# region, and doesn't have any invalid points, process it.
if goodmask.all() and poly.intersects(boundarypolyxy):
Modified: trunk/toolkits/basemap/src/_geoslib.c
===================================================================
--- trunk/toolkits/basemap/src/_geoslib.c 2008-08-09 14:49:42 UTC (rev 6012)
+++ trunk/toolkits/basemap/src/_geoslib.c 2008-08-09 16:18:19 UTC (rev 6013)
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.9.8 on Fri Aug 8 06:11:34 2008 */
+/* Generated by Cython 0.9.8 on Sat Aug 9 10:17:12 2008 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -181,6 +181,8 @@
static void __Pyx_WriteUnraisable(const char *name); /*proto*/
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
if (likely(PyList_CheckExact(L))) {
if (PyList_Append(L, x) < 0) return NULL;
@@ -192,8 +194,6 @@
}
}
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) {
@@ -243,7 +243,7 @@
PyObject *boundary;
};
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":259
+/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":249
* return (self.__class__,(self.boundary,))
*
* cdef class Polygon(BaseGeometry): # <<<<<<<<<<<<<<
@@ -255,7 +255,7 @@
struct __pyx_obj_8_geoslib_BaseGeometry __pyx_base;
};
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":315
+/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":305
* return area
*
* cdef class LineString(BaseGeometry): # <<<<<<<<<<<<<<
@@ -267,7 +267,7 @@
struct __pyx_obj_8_geoslib_BaseGeometry __pyx_base;
};
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":347
+/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":337
* self.boundary = b
*
* cdef class Point(BaseGeometry): # <<<<<<<<<<<<<<
@@ -843,10 +843,8 @@
* cdef double tolerance
*/
-static char __pyx_k_append[] = "append";
static char __pyx_k_NotImplementedError[] = "NotImplementedError";
-static PyObject *__pyx_kp_append;
static PyObject *__pyx_kp_NotImplementedError;
static PyObject *__pyx_kp_5;
@@ -862,421 +860,302 @@
GEOSGeom *__pyx_v_gout;
double __pyx_v_tolerance;
int __pyx_v_numgeoms;
- int __pyx_v_i;
int __pyx_v_typeid;
PyObject *__pyx_v_b;
PyObject *__pyx_v_p;
- PyObject *__pyx_v_pout;
PyObject *__pyx_v_type;
PyObject *__pyx_r;
- int __pyx_1;
- double __pyx_2;
+ double __pyx_1;
+ int __pyx_2;
PyObject *__pyx_3 = 0;
PyObject *__pyx_4 = 0;
__pyx_v_b = Py_None; Py_INCREF(Py_None);
__pyx_v_p = Py_None; Py_INCREF(Py_None);
- __pyx_v_pout = Py_None; Py_INCREF(Py_None);
__pyx_v_type = Py_None; Py_INCREF(Py_None);
/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":162
* cdef double tolerance
* cdef int numgeoms, i, typeid
* g1 = self._geom # <<<<<<<<<<<<<<
- * if GEOS_VERSION_MAJOR > 2:
- * tolerance = tol
+ * tolerance = tol
+ * g3 = GEOSSimplify(g1,tolerance)
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":163
* cdef int numgeoms, i, typeid
* g1 = self._geom
- * if GEOS_VERSION_MAJOR > 2: # <<<<<<<<<<<<<<
- * tolerance = tol
- * g3 = GEOSSimplify(g1, tolerance)
+ * tolerance = tol # <<<<<<<<<<<<<<
+ * g3 = GEOSSimplify(g1,tolerance)
+ * typeid = GEOSGeomTypeId(g3)
*/
- __pyx_1 = (GEOS_VERSION_MAJOR > 2);
- if (__pyx_1) {
+ __pyx_1 = __pyx_PyFloat_AsDouble(__pyx_v_tol); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_v_tolerance = __pyx_1;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":164
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":164
* g1 = self._geom
- * if GEOS_VERSION_MAJOR > 2:
- * tolerance = tol # <<<<<<<<<<<<<<
- * g3 = GEOSSimplify(g1, tolerance)
- * else:
- */
- __pyx_2 = __pyx_PyFloat_AsDouble(__pyx_v_tol); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1;}
- __pyx_v_tolerance = __pyx_2;
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":165
- * if GEOS_VERSION_MAJOR > 2:
- * tolerance = tol
- * g3 = GEOSSimplify(g1, tolerance) # <<<<<<<<<<<<<<
- * else:
- * g3 = g1
- */
- __pyx_v_g3 = GEOSSimplify(__pyx_v_g1, __pyx_v_tolerance);
- goto __pyx_L4;
- }
- /*else*/ {
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":167
- * g3 = GEOSSimplify(g1, tolerance)
- * else:
- * g3 = g1 # <<<<<<<<<<<<<<
+ * tolerance = tol
+ * g3 = GEOSSimplify(g1,tolerance) # <<<<<<<<<<<<<<
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON:
*/
- __pyx_v_g3 = __pyx_v_g1;
- }
- __pyx_L4:;
+ __pyx_v_g3 = GEOSSimplify(__pyx_v_g1, __pyx_v_tolerance);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":168
- * else:
- * g3 = g1
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":165
+ * tolerance = tol
+ * g3 = GEOSSimplify(g1,tolerance)
* typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<<
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
*/
__pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":169
- * g3 = g1
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":166
+ * g3 = GEOSSimplify(g1,tolerance)
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<<
* b = _get_coords(g3)
* p = Polygon(b)
*/
- __pyx_1 = (__pyx_v_typeid == GEOS_POLYGON);
- if (__pyx_1) {
+ __pyx_2 = (__pyx_v_typeid == GEOS_POLYGON);
+ if (__pyx_2) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":170
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":167
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = Polygon(b)
- * pout = [p]
+ * elif typeid == GEOS_LINESTRING:
*/
- __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":171
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":168
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
* p = Polygon(b) # <<<<<<<<<<<<<<
- * pout = [p]
* elif typeid == GEOS_LINESTRING:
+ * b = _get_coords(g3)
*/
- __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
- __pyx_4 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_4 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_4;
__pyx_4 = 0;
+ goto __pyx_L4;
+ }
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":172
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":169
* b = _get_coords(g3)
* p = Polygon(b)
- * pout = [p] # <<<<<<<<<<<<<<
- * elif typeid == GEOS_LINESTRING:
- * b = _get_coords(g3)
- */
- __pyx_3 = PyList_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_INCREF(__pyx_v_p);
- PyList_SET_ITEM(__pyx_3, 0, __pyx_v_p);
- Py_DECREF(__pyx_v_pout);
- __pyx_v_pout = ((PyObject *)__pyx_3);
- __pyx_3 = 0;
- goto __pyx_L5;
- }
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":173
- * p = Polygon(b)
- * pout = [p]
* elif typeid == GEOS_LINESTRING: # <<<<<<<<<<<<<<
* b = _get_coords(g3)
* p = LineString(b)
*/
- __pyx_1 = (__pyx_v_typeid == GEOS_LINESTRING);
- if (__pyx_1) {
+ __pyx_2 = (__pyx_v_typeid == GEOS_LINESTRING);
+ if (__pyx_2) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":174
- * pout = [p]
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":170
+ * p = Polygon(b)
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = LineString(b)
- * pout = [p]
+ * # for multi-geom structures, just return first one.
*/
- __pyx_4 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
- __pyx_v_b = __pyx_4;
- __pyx_4 = 0;
+ __pyx_v_b = __pyx_3;
+ __pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":175
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":171
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
* p = LineString(b) # <<<<<<<<<<<<<<
- * pout = [p]
+ * # for multi-geom structures, just return first one.
* elif typeid == GEOS_MULTIPOLYGON:
*/
- __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
- __pyx_4 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
+ __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
Py_DECREF(__pyx_v_p);
- __pyx_v_p = __pyx_4;
- __pyx_4 = 0;
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":176
- * b = _get_coords(g3)
- * p = LineString(b)
- * pout = [p] # <<<<<<<<<<<<<<
- * elif typeid == GEOS_MULTIPOLYGON:
- * numgeoms = GEOSGetNumGeometries(g3)
- */
- __pyx_3 = PyList_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_INCREF(__pyx_v_p);
- PyList_SET_ITEM(__pyx_3, 0, __pyx_v_p);
- Py_DECREF(__pyx_v_pout);
- __pyx_v_pout = ((PyObject *)__pyx_3);
+ __pyx_v_p = __pyx_3;
__pyx_3 = 0;
- goto __pyx_L5;
+ goto __pyx_L4;
}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":177
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":173
* p = LineString(b)
- * pout = [p]
+ * # for multi-geom structures, just return first one.
* elif typeid == GEOS_MULTIPOLYGON: # <<<<<<<<<<<<<<
* numgeoms = GEOSGetNumGeometries(g3)
- * pout = []
+ * gout = GEOSGetGeometryN(g3, 0)
*/
- __pyx_1 = (__pyx_v_typeid == GEOS_MULTIPOLYGON);
- if (__pyx_1) {
+ __pyx_2 = (__pyx_v_typeid == GEOS_MULTIPOLYGON);
+ if (__pyx_2) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":178
- * pout = [p]
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":174
+ * # for multi-geom structures, just return first one.
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
- * pout = []
- * for i from 0 <= i < numgeoms:
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout)
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":179
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":175
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
- * pout = [] # <<<<<<<<<<<<<<
- * for i from 0 <= i < numgeoms:
- * gout = GEOSGetGeometryN(g3, i)
+ * gout = GEOSGetGeometryN(g3, 0) # <<<<<<<<<<<<<<
+ * b = _get_coords(gout)
+ * p = Polygon(b)
*/
- __pyx_4 = PyList_New(0); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_v_pout);
- __pyx_v_pout = ((PyObject *)__pyx_4);
- __pyx_4 = 0;
+ __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, 0);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":180
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":176
* numgeoms = GEOSGetNumGeometries(g3)
- * pout = []
- * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
- * gout = GEOSGetGeometryN(g3, i)
- * b = _get_coords(gout)
- */
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":181
- * pout = []
- * for i from 0 <= i < numgeoms:
- * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<<
- * b = _get_coords(gout)
- * p = Polygon(b)
- */
- __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, __pyx_v_i);
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":182
- * for i from 0 <= i < numgeoms:
- * gout = GEOSGetGeometryN(g3, i)
- * b = _get_coords(gout) # <<<<<<<<<<<<<<
- * p = Polygon(b)
- * pout.append(p)
- */
- __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_v_b);
- __pyx_v_b = __pyx_3;
- __pyx_3 = 0;
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":183
- * gout = GEOSGetGeometryN(g3, i)
- * b = _get_coords(gout)
- * p = Polygon(b) # <<<<<<<<<<<<<<
- * pout.append(p)
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout) # <<<<<<<<<<<<<<
+ * p = Polygon(b)
* elif typeid == GEOS_MULTILINESTRING:
*/
- __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_INCREF(__pyx_v_b);
- PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
- __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
- Py_DECREF(__pyx_v_p);
- __pyx_v_p = __pyx_3;
- __pyx_3 = 0;
+ __pyx_4 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_b);
+ __pyx_v_b = __pyx_4;
+ __pyx_4 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":184
- * b = _get_coords(gout)
- * p = Polygon(b)
- * pout.append(p) # <<<<<<<<<<<<<<
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":177
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout)
+ * p = Polygon(b) # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
*/
- __pyx_4 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_4); __pyx_4 = 0;
- }
- goto __pyx_L5;
+ __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_b);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
+ __pyx_4 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
+ Py_DECREF(__pyx_v_p);
+ __pyx_v_p = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L4;
}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":185
- * p = Polygon(b)
- * pout.append(p)
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":178
+ * b = _get_coords(gout)
+ * p = Polygon(b)
* elif typeid == GEOS_MULTILINESTRING: # <<<<<<<<<<<<<<
* numgeoms = GEOSGetNumGeometries(g3)
- * pout = []
+ * gout = GEOSGetGeometryN(g3, 0)
*/
- __pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING);
- if (__pyx_1) {
+ __pyx_2 = (__pyx_v_typeid == GEOS_MULTILINESTRING);
+ if (__pyx_2) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":186
- * pout.append(p)
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":179
+ * p = Polygon(b)
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
- * pout = []
- * for i from 0 <= i < numgeoms:
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout)
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":187
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":180
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
- * pout = [] # <<<<<<<<<<<<<<
- * for i from 0 <= i < numgeoms:
- * gout = GEOSGetGeometryN(g3, i)
+ * gout = GEOSGetGeometryN(g3, 0) # <<<<<<<<<<<<<<
+ * b = _get_coords(gout)
+ * p = LineString(b)
*/
- __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_v_pout);
- __pyx_v_pout = ((PyObject *)__pyx_3);
- __pyx_3 = 0;
+ __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, 0);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":188
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":181
* numgeoms = GEOSGetNumGeometries(g3)
- * pout = []
- * for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
- * gout = GEOSGetGeometryN(g3, i)
- * b = _get_coords(gout)
- */
- for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":189
- * pout = []
- * for i from 0 <= i < numgeoms:
- * gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<<
- * b = _get_coords(gout)
- * p = LineString(b)
- */
- __pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, __pyx_v_i);
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":190
- * for i from 0 <= i < numgeoms:
- * gout = GEOSGetGeometryN(g3, i)
- * b = _get_coords(gout) # <<<<<<<<<<<<<<
- * p = LineString(b)
- * pout.append(p)
- */
- __pyx_4 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_v_b);
- __pyx_v_b = __pyx_4;
- __pyx_4 = 0;
-
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":191
- * gout = GEOSGetGeometryN(g3, i)
- * b = _get_coords(gout)
- * p = LineString(b) # <<<<<<<<<<<<<<
- * pout.append(p)
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout) # <<<<<<<<<<<<<<
+ * p = LineString(b)
* else:
*/
- __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_INCREF(__pyx_v_b);
- PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
- __pyx_4 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
- Py_DECREF(__pyx_v_p);
- __pyx_v_p = __pyx_4;
- __pyx_4 = 0;
+ __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_b);
+ __pyx_v_b = __pyx_3;
+ __pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":192
- * b = _get_coords(gout)
- * p = LineString(b)
- * pout.append(p) # <<<<<<<<<<<<<<
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":182
+ * gout = GEOSGetGeometryN(g3, 0)
+ * b = _get_coords(gout)
+ * p = LineString(b) # <<<<<<<<<<<<<<
* else:
* type = PyString_FromString(GEOSGeomType(g3))
*/
- __pyx_3 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1;}
- Py_DECREF(__pyx_3); __pyx_3 = 0;
- }
- goto __pyx_L5;
+ __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_b);
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_b);
+ __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0;
+ Py_DECREF(__pyx_v_p);
+ __pyx_v_p = __pyx_3;
+ __pyx_3 = 0;
+ goto __pyx_L4;
}
/*else*/ {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":194
- * pout.append(p)
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":184
+ * p = LineString(b)
* else:
* type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<<
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
*/
- __pyx_4 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_4 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_type);
__pyx_v_type = __pyx_4;
__pyx_4 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":195
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":185
* else:
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<<
* GEOSGeom_destroy(g3)
- * return pout
+ * return p
*/
- __pyx_3 = PyNumber_Remainder(__pyx_kp_5, __pyx_v_type); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1;}
- __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyNumber_Remainder(__pyx_kp_5, __pyx_v_type); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
__pyx_3 = 0;
- __pyx_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __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 = 195; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1;}
}
- __pyx_L5:;
+ __pyx_L4:;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":196
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":186
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3) # <<<<<<<<<<<<<<
- * return pout
+ * return p
*
*/
GEOSGeom_destroy(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":197
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":187
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
- * return pout # <<<<<<<<<<<<<<
+ * return p # <<<<<<<<<<<<<<
*
* def intersects(self, BaseGeometry geom):
*/
- Py_INCREF(__pyx_v_pout);
- __pyx_r = __pyx_v_pout;
+ Py_INCREF(__pyx_v_p);
+ __pyx_r = __pyx_v_p;
goto __pyx_L0;
__pyx_r = Py_None; Py_INCREF(Py_None);
@@ -1289,13 +1168,12 @@
__pyx_L0:;
Py_DECREF(__pyx_v_b);
Py_DECREF(__pyx_v_p);
- Py_DECREF(__pyx_v_pout);
Py_DECREF(__pyx_v_type);
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":199
- * return pout
+/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":189
+ * return p
*
* def intersects(self, BaseGeometry geom): # <<<<<<<<<<<<<<
* cdef GEOSGeom *g1, *g2
@@ -1309,9 +1187,9 @@
char __pyx_v_answer;
PyObject *__pyx_r;
char __pyx_1;
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1;}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":202
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":192
* cdef GEOSGeom *g1, *g2
* cdef char answer
* g1 = self._geom # <<<<<<<<<<<<<<
@@ -1320,7 +1198,7 @@
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":203
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":193
* cdef char answer
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
@@ -1329,7 +1207,7 @@
*/
__pyx_v_g2 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":204
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":194
* g1 = self._geom
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2) # <<<<<<<<<<<<<<
@@ -1338,7 +1216,7 @@
*/
__pyx_v_answer = GEOSIntersects(__pyx_v_g1, __pyx_v_g2);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":205
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":195
* g2 = geom._geom
* answer = GEOSIntersects(g1, g2)
* if answer: # <<<<<<<<<<<<<<
@@ -1348,7 +1226,7 @@
__pyx_1 = __pyx_v_answer;
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":206
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":196
* answer = GEOSIntersects(g1, g2)
* if answer:
* return True # <<<<<<<<<<<<<<
@@ -1362,7 +1240,7 @@
}
/*else*/ {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":208
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":198
* return True
* else:
* return False # <<<<<<<<<<<<<<
@@ -1384,7 +1262,7 @@
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":210
+/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":200
* return False
*
* def intersection(self, BaseGeometry geom): # <<<<<<<<<<<<<<
@@ -1392,6 +1270,10 @@
* cdef char answer
*/
+static char __pyx_k_append[] = "append";
+
+static PyObject *__pyx_kp_append;
+
static PyObject *__pyx_kp_6;
static char __pyx_k_6[] = "intersections of type '%s' not yet implemented";
@@ -1417,9 +1299,9 @@
__pyx_v_p = Py_None; Py_INCREF(Py_None);
__pyx_v_pout = Py_None; Py_INCREF(Py_None);
__pyx_v_type = Py_None; Py_INCREF(Py_None);
- if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_geom), __pyx_ptype_8_geoslib_BaseGeometry, 1, "geom", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1;}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":214
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":204
* cdef char answer
* cdef int numgeoms, i, typeid
* g1 = self._geom # <<<<<<<<<<<<<<
@@ -1428,7 +1310,7 @@
*/
__pyx_v_g1 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":215
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":205
* cdef int numgeoms, i, typeid
* g1 = self._geom
* g2 = geom._geom # <<<<<<<<<<<<<<
@@ -1437,7 +1319,7 @@
*/
__pyx_v_g2 = ((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_geom)->_geom;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":216
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":206
* g1 = self._geom
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2) # <<<<<<<<<<<<<<
@@ -1446,7 +1328,7 @@
*/
__pyx_v_g3 = GEOSIntersection(__pyx_v_g1, __pyx_v_g2);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":217
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":207
* g2 = geom._geom
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3) # <<<<<<<<<<<<<<
@@ -1455,7 +1337,7 @@
*/
__pyx_v_typeid = GEOSGeomTypeId(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":218
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":208
* g3 = GEOSIntersection(g1, g2)
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON: # <<<<<<<<<<<<<<
@@ -1465,42 +1347,42 @@
__pyx_1 = (__pyx_v_typeid == GEOS_POLYGON);
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":219
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":209
* typeid = GEOSGeomTypeId(g3)
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = Polygon(b)
* pout = [p]
*/
- __pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":220
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":210
* if typeid == GEOS_POLYGON:
* b = _get_coords(g3)
* p = Polygon(b) # <<<<<<<<<<<<<<
* pout = [p]
* elif typeid == GEOS_LINESTRING:
*/
- __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
- __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":221
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":211
* b = _get_coords(g3)
* p = Polygon(b)
* pout = [p] # <<<<<<<<<<<<<<
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
*/
- __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_p);
PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p);
Py_DECREF(__pyx_v_pout);
@@ -1509,7 +1391,7 @@
goto __pyx_L4;
}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":222
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":212
* p = Polygon(b)
* pout = [p]
* elif typeid == GEOS_LINESTRING: # <<<<<<<<<<<<<<
@@ -1519,42 +1401,42 @@
__pyx_1 = (__pyx_v_typeid == GEOS_LINESTRING);
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":223
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":213
* pout = [p]
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3) # <<<<<<<<<<<<<<
* p = LineString(b)
* pout = [p]
*/
- __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_g3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":224
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":214
* elif typeid == GEOS_LINESTRING:
* b = _get_coords(g3)
* p = LineString(b) # <<<<<<<<<<<<<<
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON:
*/
- __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
- __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":225
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":215
* b = _get_coords(g3)
* p = LineString(b)
* pout = [p] # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
*/
- __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_p);
PyList_SET_ITEM(__pyx_2, 0, __pyx_v_p);
Py_DECREF(__pyx_v_pout);
@@ -1563,7 +1445,7 @@
goto __pyx_L4;
}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":226
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":216
* p = LineString(b)
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON: # <<<<<<<<<<<<<<
@@ -1573,7 +1455,7 @@
__pyx_1 = (__pyx_v_typeid == GEOS_MULTIPOLYGON);
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":227
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":217
* pout = [p]
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
@@ -1582,19 +1464,19 @@
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":228
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":218
* elif typeid == GEOS_MULTIPOLYGON:
* numgeoms = GEOSGetNumGeometries(g3)
* pout = [] # <<<<<<<<<<<<<<
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
*/
- __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyList_New(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_3);
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":229
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":219
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
* for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
@@ -1603,7 +1485,7 @@
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":230
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":220
* pout = []
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<<
@@ -1612,48 +1494,48 @@
*/
__pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, __pyx_v_i);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":231
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":221
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = Polygon(b)
* pout.append(p)
*/
- __pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_2;
__pyx_2 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":232
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":222
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
* p = Polygon(b) # <<<<<<<<<<<<<<
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING:
*/
- __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_b);
- __pyx_2 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_Polygon), ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_2;
__pyx_2 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":233
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":223
* b = _get_coords(gout)
* p = Polygon(b)
* pout.append(p) # <<<<<<<<<<<<<<
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
*/
- __pyx_3 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;
}
goto __pyx_L4;
}
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":234
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":224
* p = Polygon(b)
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING: # <<<<<<<<<<<<<<
@@ -1663,7 +1545,7 @@
__pyx_1 = (__pyx_v_typeid == GEOS_MULTILINESTRING);
if (__pyx_1) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":235
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":225
* pout.append(p)
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3) # <<<<<<<<<<<<<<
@@ -1672,19 +1554,19 @@
*/
__pyx_v_numgeoms = GEOSGetNumGeometries(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":236
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":226
* elif typeid == GEOS_MULTILINESTRING:
* numgeoms = GEOSGetNumGeometries(g3)
* pout = [] # <<<<<<<<<<<<<<
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
*/
- __pyx_2 = PyList_New(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyList_New(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_pout);
__pyx_v_pout = ((PyObject *)__pyx_2);
__pyx_2 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":237
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":227
* numgeoms = GEOSGetNumGeometries(g3)
* pout = []
* for i from 0 <= i < numgeoms: # <<<<<<<<<<<<<<
@@ -1693,7 +1575,7 @@
*/
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_numgeoms; __pyx_v_i++) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":238
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":228
* pout = []
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i) # <<<<<<<<<<<<<<
@@ -1702,80 +1584,80 @@
*/
__pyx_v_gout = GEOSGetGeometryN(__pyx_v_g3, __pyx_v_i);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":239
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":229
* for i from 0 <= i < numgeoms:
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout) # <<<<<<<<<<<<<<
* p = LineString(b)
* pout.append(p)
*/
- __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = __pyx_f_8_geoslib__get_coords(__pyx_v_gout); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_b);
__pyx_v_b = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":240
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":230
* gout = GEOSGetGeometryN(g3, i)
* b = _get_coords(gout)
* p = LineString(b) # <<<<<<<<<<<<<<
* pout.append(p)
* else:
*/
- __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_INCREF(__pyx_v_b);
PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_b);
- __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_8_geoslib_LineString), ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
Py_DECREF(__pyx_v_p);
__pyx_v_p = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":241
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":231
* b = _get_coords(gout)
* p = LineString(b)
* pout.append(p) # <<<<<<<<<<<<<<
* else:
* type = PyString_FromString(GEOSGeomType(g3))
*/
- __pyx_2 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = __Pyx_PyObject_Append(__pyx_v_pout, __pyx_v_p); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_2); __pyx_2 = 0;
}
goto __pyx_L4;
}
/*else*/ {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":243
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":233
* pout.append(p)
* else:
* type = PyString_FromString(GEOSGeomType(g3)) # <<<<<<<<<<<<<<
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
*/
- __pyx_3 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyString_FromString(GEOSGeomType(__pyx_v_g3)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(__pyx_v_type);
__pyx_v_type = __pyx_3;
__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":244
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":234
* else:
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type)) # <<<<<<<<<<<<<<
* GEOSGeom_destroy(g3)
* return pout
*/
- __pyx_2 = PyNumber_Remainder(__pyx_kp_6, __pyx_v_type); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1;}
- __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_kp_6, __pyx_v_type); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1;}
PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
__pyx_2 = 0;
- __pyx_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
__Pyx_Raise(__pyx_2, 0, 0);
Py_DECREF(__pyx_2); __pyx_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1;}
}
__pyx_L4:;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":245
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":235
* type = PyString_FromString(GEOSGeomType(g3))
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3) # <<<<<<<<<<<<<<
@@ -1784,7 +1666,7 @@
*/
GEOSGeom_destroy(__pyx_v_g3);
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":246
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":236
* raise NotImplementedError("intersections of type '%s' not yet implemented" % (type))
* GEOSGeom_destroy(g3)
* return pout # <<<<<<<<<<<<<<
@@ -1810,7 +1692,7 @@
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":248
+/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":238
* return pout
*
* def get_coords(self): # <<<<<<<<<<<<<<
@@ -1823,14 +1705,14 @@
PyObject *__pyx_r;
PyObject *__pyx_1 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":249
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":239
*
* def get_coords(self):
* return _get_coords(self._geom) # <<<<<<<<<<<<<<
*
* def __dealloc__(self):
*/
- __pyx_1 = __pyx_f_8_geoslib__get_coords(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1;}
+ __pyx_1 = __pyx_f_8_geoslib__get_coords(((struct __pyx_obj_8_geoslib_BaseGeometry *)__pyx_v_self)->_geom); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_r = __pyx_1;
__pyx_1 = 0;
goto __pyx_L0;
@@ -1845,7 +1727,7 @@
return __pyx_r;
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":251
+/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":241
* return _get_coords(self._geom)
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
@@ -1857,7 +1739,7 @@
static char __pyx_doc_8_geoslib_12BaseGeometry___dealloc__[] = "destroy GEOS geometry";
static void __pyx_pf_8_geoslib_12BaseGeometry___dealloc__(PyObject *__pyx_v_self) {
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":253
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":243
* def __dealloc__(self):
* """destroy GEOS geometry"""
* GEOSGeom_destroy(self._geom) # <<<<<<<<<<<<<<
@@ -1868,7 +1750,7 @@
}
-/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":255
+/* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":245
* GEOSGeom_destroy(self._geom)
*
* def __reduce__(self): # <<<<<<<<<<<<<<
@@ -1888,18 +1770,18 @@
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;
- /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":257
+ /* "/Users/jsw/python/matplotlib/trunk/toolkits/basemap/src/_geoslib.pyx":247
* def __reduce__(self):
* """special method that allows geos instance to be pickled"""
* return (self.__class__,(self.boundary,)) # <<<<<<<<<<<<<<
*
* cdef class Polygon(BaseGeometry):
*/
- __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp___class__); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0];...
[truncated message content] |
|
From: <js...@us...> - 2008-08-09 14:49:45
|
Revision: 6012
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6012&view=rev
Author: jswhit
Date: 2008-08-09 14:49:42 +0000 (Sat, 09 Aug 2008)
Log Message:
-----------
print proj4string attribute.
Modified Paths:
--------------
trunk/toolkits/basemap/examples/test.py
Modified: trunk/toolkits/basemap/examples/test.py
===================================================================
--- trunk/toolkits/basemap/examples/test.py 2008-08-09 12:58:30 UTC (rev 6011)
+++ trunk/toolkits/basemap/examples/test.py 2008-08-09 14:49:42 UTC (rev 6012)
@@ -51,7 +51,7 @@
m.drawmeridians(meridians,labels=[1,0,0,1])
plt.title('Cylindrical Equidistant')
print 'plotting Cylindrical Equidistant example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -71,7 +71,7 @@
m.drawmeridians(meridians,labels=[1,1,1,1])
plt.title('Miller Cylindrical',y=1.1)
print 'plotting Miller Cylindrical example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -95,7 +95,7 @@
m.drawmeridians(meridians,labels=[1,1,1,1])
plt.title('Mercator',y=1.1)
print 'plotting Mercator example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -127,7 +127,7 @@
m.drawmeridians(meridians,labels=[1,0,0,1],fontsize=10)
plt.title('Cassini-Soldner Projection')
print 'plotting Cassini-Soldner example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -160,7 +160,7 @@
m.drawmeridians(meridians,labels=[1,0,0,1],fontsize=10)
plt.title('Gnomonic Projection')
print 'plotting Gnomonic example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -192,7 +192,7 @@
m.drawmeridians(meridians,labels=[1,0,0,0],fontsize=10)
plt.title('Transverse Mercator Projection')
print 'plotting Transverse Mercator example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -221,7 +221,7 @@
m.drawmeridians(np.arange(-180,181,30),labels=[0,0,0,1],fontsize=10)
plt.title('Oblique Mercator Projection')
print 'plotting Oblique Mercator example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -254,7 +254,7 @@
m.drawmeridians(meridians,labels=[1,0,0,1],fontsize=10)
plt.title('Polyconic Projection')
print 'plotting Polyconic example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -287,7 +287,7 @@
m.drawmeridians(meridians,labels=[0,0,0,1])
plt.title('Equidistant Conic')
print 'plotting Equidistant Conic example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -321,7 +321,7 @@
m.drawmeridians(meridians,labels=[1,1,0,1])
plt.title('Lambert Conformal Conic')
print 'plotting Lambert Conformal example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -354,7 +354,7 @@
m.drawmeridians(meridians,labels=[1,1,1,1])
plt.title('Albers Equal Area Conic',y=1.075)
print 'plotting Albers Equal Area example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -385,7 +385,7 @@
m.drawmeridians(meridians,labels=[1,1,1,1])
plt.title('Polar Stereographic',y=1.075)
print 'plotting Stereographic example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -417,7 +417,7 @@
m.drawmeridians(meridians,labels=[1,1,1,1])
plt.title('Lambert Azimuthal Equal Area',y=1.075)
print 'plotting Lambert Azimuthal example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -449,7 +449,7 @@
m.drawmeridians(meridians,labels=[1,1,1,1])
plt.title('Azimuthal Equidistant',y=1.075)
print 'plotting Azimuthal Equidistant example ...'
-print m.srs
+print m.proj4string
# projections with elliptical boundaries (orthographic, sinusoidal,
# mollweide and robinson)
@@ -492,7 +492,7 @@
m.drawmapboundary()
plt.title('Orthographic')
print 'plotting Orthographic example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -533,7 +533,7 @@
m.drawmapboundary()
plt.title('Geostationary')
print 'plotting Geostationary example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -560,7 +560,7 @@
m.drawmapboundary()
plt.title('Sinusoidal')
print 'plotting Sinusoidal example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -587,7 +587,7 @@
m.drawmapboundary()
plt.title('Mollweide')
print 'plotting Mollweide example ...'
-print m.srs
+print m.proj4string
# create new figure
fig=plt.figure()
@@ -614,7 +614,7 @@
m.drawmapboundary()
plt.title('Robinson')
print 'plotting Robinson example ...'
-print m.srs
+print m.proj4string
plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|