SF.net SVN: matplotlib: [4701] branches/transforms/lib/matplotlib/patches. py

2007-12-12 Thread mdboom
Revision: 4701
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4701&view=rev
Author:   mdboom
Date: 2007-12-12 05:48:09 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Make the arc edge detection algorithm be dynamic based on the size of
the ellipse, rather than always on (that was just for debugging).

Modified Paths:
--
branches/transforms/lib/matplotlib/patches.py

Modified: branches/transforms/lib/matplotlib/patches.py
===
--- branches/transforms/lib/matplotlib/patches.py   2007-12-12 00:15:23 UTC 
(rev 4700)
+++ branches/transforms/lib/matplotlib/patches.py   2007-12-12 13:48:09 UTC 
(rev 4701)
@@ -989,7 +989,7 @@
 (self._width, self._height))
 inv_error = (1.0 / 1.89818e-6)
 
-if width < inv_error and height < inv_error and False:
+if width < inv_error and height < inv_error:
 self._path = Path.arc(self._theta1, self._theta2)
 return Patch.draw(self, renderer)
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4702] branches/transforms/lib/matplotlib/backends

2007-12-12 Thread mdboom
Revision: 4702
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4702&view=rev
Author:   mdboom
Date: 2007-12-12 05:54:56 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Fix a bad merge.

Modified Paths:
--
branches/transforms/lib/matplotlib/backends/backend_cairo.py
branches/transforms/lib/matplotlib/backends/backend_svg.py

Modified: branches/transforms/lib/matplotlib/backends/backend_cairo.py
===
--- branches/transforms/lib/matplotlib/backends/backend_cairo.py
2007-12-12 13:48:09 UTC (rev 4701)
+++ branches/transforms/lib/matplotlib/backends/backend_cairo.py
2007-12-12 13:54:56 UTC (rev 4702)
@@ -34,7 +34,6 @@
 backend_version = cairo.version
 del _version_required
 
-from matplotlib import agg
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
  FigureManagerBase, FigureCanvasBase
 from matplotlib.cbookimport enumerate, izip, is_string_like

Modified: branches/transforms/lib/matplotlib/backends/backend_svg.py
===
--- branches/transforms/lib/matplotlib/backends/backend_svg.py  2007-12-12 
13:48:09 UTC (rev 4701)
+++ branches/transforms/lib/matplotlib/backends/backend_svg.py  2007-12-12 
13:54:56 UTC (rev 4702)
@@ -2,7 +2,6 @@
 
 import os, codecs, base64, tempfile, urllib, gzip
 
-from matplotlib import agg
 from matplotlib import verbose, __version__, rcParams
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
  FigureManagerBase, FigureCanvasBase


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4703] branches/transforms/src/_path.cpp

2007-12-12 Thread mdboom
Revision: 4703
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4703&view=rev
Author:   mdboom
Date: 2007-12-12 05:55:12 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Layout fix.

Modified Paths:
--
branches/transforms/src/_path.cpp

Modified: branches/transforms/src/_path.cpp
===
--- branches/transforms/src/_path.cpp   2007-12-12 13:54:56 UTC (rev 4702)
+++ branches/transforms/src/_path.cpp   2007-12-12 13:55:12 UTC (rev 4703)
@@ -141,7 +141,7 @@
 
 // The following cases denote the beginning on a new subpath
 if (code == agg::path_cmd_stop ||
-(code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
+   (code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
 {
 x = sx;
 y = sy;
@@ -184,7 +184,7 @@
 vty1 = y;
 }
 while (code != agg::path_cmd_stop &&
-   (code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly);
+  (code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly);
 
 yflag1 = (vty1 >= ty);
 if (yflag0 != yflag1)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4704] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/pupynere.py

2007-12-12 Thread jswhit
Revision: 4704
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4704&view=rev
Author:   jswhit
Date: 2007-12-12 06:00:04 -0800 (Wed, 12 Dec 2007)

Log Message:
---
make sure masked arrays have correct fill_value

Modified Paths:
--
trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py

Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py
===
--- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py  
2007-12-12 13:55:12 UTC (rev 4703)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py  
2007-12-12 14:00:04 UTC (rev 4704)
@@ -96,9 +96,9 @@
  
 def _maskandscale(var,datout):
 if hasattr(var, 'missing_value') and (datout == var.missing_value).any():
-datout = ma.masked_values(datout, var.missing_value)
+datout = ma.masked_array(datout, mask = datout == var.missing_value, 
fill_value=var.missing_value)
 elif hasattr(var, '_FillValue') and (datout == var._FillValue).any():
-datout = ma.masked_values(datout, var._FillValue)
+datout = ma.masked_array(datout, mask = datout == var._FillValue, 
fill_value=var._FillValue)
 try:
 datout = var.scale_factor*datout + var.add_offset
 except:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4705] trunk/toolkits/basemap/examples/plotsst.py

2007-12-12 Thread jswhit
Revision: 4705
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4705&view=rev
Author:   jswhit
Date: 2007-12-12 06:04:57 -0800 (Wed, 12 Dec 2007)

Log Message:
---
new example

Added Paths:
---
trunk/toolkits/basemap/examples/plotsst.py

Added: trunk/toolkits/basemap/examples/plotsst.py
===
--- trunk/toolkits/basemap/examples/plotsst.py  (rev 0)
+++ trunk/toolkits/basemap/examples/plotsst.py  2007-12-12 14:04:57 UTC (rev 
4705)
@@ -0,0 +1,26 @@
+from matplotlib.toolkits.basemap import Basemap, NetCDFFile
+import pylab, numpy
+# read in sea-surface temperature data
+# can be a local file, a URL for a remote opendap dataset,
+# or (if PyNIO is installed) a GRIB or HDF file.
+ncfile = 
NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/2007/AVHRR/sst4-navy-eot.20071201.nc')
+sst = ncfile.variables['sst'][:]
+lats = ncfile.variables['lat'][:]
+lons = ncfile.variables['lon'][:]
+# create Basemap instance for mollweide projection.
+# coastlines not used, so resolution set to None to skip
+# continent processing (this speeds things up a bit)
+m = Basemap(projection='moll',lon_0=lons.mean(),lat_0=0,resolution=None)
+# compute map projection coordinates of grid.
+x, y = m(*numpy.meshgrid(lons, lats))
+m.drawmapboundary(fill_color='k')
+# plot with pcolor
+im = m.pcolormesh(x,y,sst,shading='flat',cmap=pylab.cm.gist_ncar)
+# draw parallels and meridians, but don't bother labelling them.
+m.drawparallels(numpy.arange(-90.,120.,30.))
+m.drawmeridians(numpy.arange(0.,420.,60.))
+# draw line around map projection limb.
+# color map region background black (missing values will be this color)
+# draw horizontal colorbar.
+pylab.colorbar(orientation='horizontal')
+pylab.show()


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4706] trunk/matplotlib

2007-12-12 Thread mdboom
Revision: 4706
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4706&view=rev
Author:   mdboom
Date: 2007-12-12 06:08:15 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Support alpha-blended text in the Agg and Svg backends.

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
trunk/matplotlib/src/_backend_agg.cpp

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-12-12 
14:04:57 UTC (rev 4705)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-12-12 
14:08:15 UTC (rev 4706)
@@ -286,7 +286,7 @@
 color = rgb2hex(gc.get_rgb())
 
 if rcParams['svg.embed_char_paths']:
-svg = ['a = src->v;
+  dst->a = ((unsigned int)_color.a * (unsigned int)src->v) >> 8;
   ++src;
   ++dst;
 } while (--len);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4707] trunk/matplotlib/lib/matplotlib/text.py

2007-12-12 Thread mdboom
Revision: 4707
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4707&view=rev
Author:   mdboom
Date: 2007-12-12 06:52:01 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Support fontconfig syntax in Text constructor.

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/text.py

Modified: trunk/matplotlib/lib/matplotlib/text.py
===
--- trunk/matplotlib/lib/matplotlib/text.py 2007-12-12 14:08:15 UTC (rev 
4706)
+++ trunk/matplotlib/lib/matplotlib/text.py 2007-12-12 14:52:01 UTC (rev 
4707)
@@ -675,6 +675,8 @@
 
 ACCEPTS: a matplotlib.font_manager.FontProperties instance
 """
+if is_string_like(fp):
+fp = FontProperties(fp)
 self._fontproperties = fp
 
 artist.kwdocd['Text'] = artist.kwdoc(Text)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4708] branches/transforms

2007-12-12 Thread mdboom
Revision: 4708
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4708&view=rev
Author:   mdboom
Date: 2007-12-12 07:01:20 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Merged revisions 4689-4706 via svnmerge from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib


  r4697 | pkienzle | 2007-12-11 12:14:44 -0500 (Tue, 11 Dec 2007) | 1 line
  
  remove wx specific gui_repaint comment

  r4698 | jdh2358 | 2007-12-11 16:17:59 -0500 (Tue, 11 Dec 2007) | 2 lines
  
  fixed text with dash bug

  r4706 | mdboom | 2007-12-12 09:08:15 -0500 (Wed, 12 Dec 2007) | 2 lines
  
  Support alpha-blended text in the Agg and Svg backends.


Modified Paths:
--
branches/transforms/examples/dashpointlabel.py
branches/transforms/examples/lasso_demo.py
branches/transforms/lib/matplotlib/backend_bases.py
branches/transforms/lib/matplotlib/backends/backend_svg.py
branches/transforms/lib/matplotlib/cbook.py
branches/transforms/lib/matplotlib/patches.py
branches/transforms/lib/matplotlib/text.py
branches/transforms/src/_backend_agg.cpp

Property Changed:

branches/transforms/


Property changes on: branches/transforms
___
Name: svnmerge-integrated
   - /trunk/matplotlib:1-4688
   + /trunk/matplotlib:1-4706

Modified: branches/transforms/examples/dashpointlabel.py
===
--- branches/transforms/examples/dashpointlabel.py  2007-12-12 14:52:01 UTC 
(rev 4707)
+++ branches/transforms/examples/dashpointlabel.py  2007-12-12 15:01:20 UTC 
(rev 4708)
@@ -1,4 +1,4 @@
-from matplotlib import pylab
+import pylab
 
 DATA = ((1, 3),
 (2, 4),
@@ -15,26 +15,27 @@
 (1, 20, 30, 60, 10),
 )
 
-def test_dashpointlabel(save=False):
-pylab.clf()
-(x,y) = zip(*DATA)
-pylab.plot(x, y, marker='o')
-for i in xrange(len(DATA)):
-(x,y) = DATA[i]
-(dd, dl, r, dr, dp) = dash_style[i]
-pylab.text(x, y, str((x,y)), withdash=True,
-   dashdirection=dd,
-   dashlength=dl,
-   rotation=r,
-   dashrotation=dr,
-   dashpush=dp,
-   )
-axis = pylab.gca()
-axis.set_xlim((0.0, 5.0))
-axis.set_ylim((0.0, 5.0))
-if save:
-pylab.savefig('dashpointlabel')
-pylab.show()
+fig = pylab.figure()
+ax = fig.add_subplot(111)
 
-if __name__ == '__main__':
-test_dashpointlabel()
+
+(x,y) = zip(*DATA)
+ax.plot(x, y, marker='o')
+for i in xrange(len(DATA)):
+(x,y) = DATA[i]
+(dd, dl, r, dr, dp) = dash_style[i]
+#print 'dashlen call', dl
+t = ax.text(x, y, str((x,y)), withdash=True,
+   dashdirection=dd,
+   dashlength=dl,
+   rotation=r,
+   dashrotation=dr,
+   dashpush=dp,
+   )
+
+ax.set_xlim((0.0, 5.0))
+ax.set_ylim((0.0, 5.0))
+#if save:
+#pylab.savefig('dashpointlabel')
+pylab.show()
+

Modified: branches/transforms/examples/lasso_demo.py
===
--- branches/transforms/examples/lasso_demo.py  2007-12-12 14:52:01 UTC (rev 
4707)
+++ branches/transforms/examples/lasso_demo.py  2007-12-12 15:01:20 UTC (rev 
4708)
@@ -59,6 +59,7 @@
 self.canvas.draw_idle()
 self.canvas.widgetlock.release(self.lasso)
 del self.lasso
+
 def onpress(self, event):
 if self.canvas.widgetlock.locked(): return
 if event.inaxes is None: return

Modified: branches/transforms/lib/matplotlib/backend_bases.py
===
--- branches/transforms/lib/matplotlib/backend_bases.py 2007-12-12 14:52:01 UTC 
(rev 4707)
+++ branches/transforms/lib/matplotlib/backend_bases.py 2007-12-12 15:01:20 UTC 
(rev 4708)
@@ -843,7 +843,6 @@
 a.set_facecolor('lightblue')
 else: self._active[a] = None
 self.draw_idle()
-#self.gui_repaint()
 
 def pick(self, mouseevent):
 if not self.widgetlock.locked():

Modified: branches/transforms/lib/matplotlib/backends/backend_svg.py
===
--- branches/transforms/lib/matplotlib/backends/backend_svg.py  2007-12-12 
14:52:01 UTC (rev 4707)
+++ branches/transforms/lib/matplotlib/backends/backend_svg.py  2007-12-12 
15:01:20 UTC (rev 4708)
@@ -296,7 +296,7 @@
 color = rgb2hex(gc.get_rgb()[:3])
 
 if rcParams['svg.embed_char_paths']:
-svg = ['>> g = grouper.Grouper()
 >>> g.join('a', 'b')
 >>> g.join('b', 'c')
@@ -989,7 +989,7 @@
 True
 >>> g.joined('a', 'd')
 False
-"""   
+"""
 def __init__(self, init=[]):
mapping = self._mapping = {}
for x in init:
@@ -997,7 +997,7 @@
 
 def __contains__(self, item):
 return

SF.net SVN: matplotlib: [4710] trunk/toolkits/basemap/setup.py

2007-12-12 Thread jswhit
Revision: 4710
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4710&view=rev
Author:   jswhit
Date: 2007-12-12 08:43:29 -0800 (Wed, 12 Dec 2007)

Log Message:
---
install dap client anyway if installed version is older.

Modified Paths:
--
trunk/toolkits/basemap/setup.py

Modified: trunk/toolkits/basemap/setup.py
===
--- trunk/toolkits/basemap/setup.py 2007-12-12 16:25:57 UTC (rev 4709)
+++ trunk/toolkits/basemap/setup.py 2007-12-12 16:43:29 UTC (rev 4710)
@@ -112,11 +112,20 @@
 
 # install dap and httplib2, if not already available.
 # only a subset of dap is installed (the client, not the server)
+__dapversion__ = None
 try:
-from dap import client
+from dap.lib import __version__ as __dapversion__
 except ImportError:
 packages = packages + ['dap','dap.util','dap.parsers']
 package_dirs['dap'] = os.path.join('lib','dap')
+# install dap client anyway if installed version is older than
+# version provided here.
+if __dapversion__ is not None:
+__dapversion__ = [repr(v)+'.' for v in __dapversion__]
+__dapversion__ = ''.join(__dapversion__)[:-1]
+if __dapversion__ < '2.2.6.2':
+packages = packages + ['dap','dap.util','dap.parsers']
+package_dirs['dap'] = os.path.join('lib','dap')
 try:
 import httplib2
 except ImportError:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4709] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/pupynere.py

2007-12-12 Thread jswhit
Revision: 4709
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4709&view=rev
Author:   jswhit
Date: 2007-12-12 08:25:57 -0800 (Wed, 12 Dec 2007)

Log Message:
---
break some long lines

Modified Paths:
--
trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py

Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py
===
--- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py  
2007-12-12 15:01:20 UTC (rev 4708)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/pupynere.py  
2007-12-12 16:25:57 UTC (rev 4709)
@@ -96,9 +96,11 @@
  
 def _maskandscale(var,datout):
 if hasattr(var, 'missing_value') and (datout == var.missing_value).any():
-datout = ma.masked_array(datout, mask = datout == var.missing_value, 
fill_value=var.missing_value)
+datout = ma.masked_array(datout,mask=datout==var.missing_value,
+ fill_value=var.missing_value)
 elif hasattr(var, '_FillValue') and (datout == var._FillValue).any():
-datout = ma.masked_array(datout, mask = datout == var._FillValue, 
fill_value=var._FillValue)
+datout = ma.masked_array(datout,mask=datout==var._FillValue,
+ fill_value=var._FillValue)
 try:
 datout = var.scale_factor*datout + var.add_offset
 except:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4711] trunk/toolkits/basemap

2007-12-12 Thread jswhit
Revision: 4711
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4711&view=rev
Author:   jswhit
Date: 2007-12-12 08:57:09 -0800 (Wed, 12 Dec 2007)

Log Message:
---
add plotsst.py example.

Modified Paths:
--
trunk/toolkits/basemap/MANIFEST.in
trunk/toolkits/basemap/examples/README
trunk/toolkits/basemap/examples/run_all.py

Modified: trunk/toolkits/basemap/MANIFEST.in
===
--- trunk/toolkits/basemap/MANIFEST.in  2007-12-12 16:43:29 UTC (rev 4710)
+++ trunk/toolkits/basemap/MANIFEST.in  2007-12-12 16:57:09 UTC (rev 4711)
@@ -43,6 +43,7 @@
 include examples/geos_demo_2.py
 include examples/200706041200-msg-ch01-SAfrica.jpg
 include examples/fcstmaps.py
+include examples/plotsst.py
 include examples/wiki_example.py
 include examples/fillstates.py
 include examples/run_all.py

Modified: trunk/toolkits/basemap/examples/README
===
--- trunk/toolkits/basemap/examples/README  2007-12-12 16:43:29 UTC (rev 
4710)
+++ trunk/toolkits/basemap/examples/README  2007-12-12 16:57:09 UTC (rev 
4711)
@@ -13,6 +13,9 @@
 customticks.py shows how to create custom tick labels for a cylindrical
 projection.
 
+plotcities.py shows how to read and plot data from a shapefile containing
+Point data.
+
 plotmap.py is the example on the matplotlib 'screenshots' page (included
 in test.py) which shows the ETOPO topography as an image on a Lambert
 Conformal projection (using imshow).
@@ -52,6 +55,9 @@
 fcstmaps.py is a sample multi-panel plot that accesses
 data over http using the dap module. An internet connection is required.
 
+plotsst.py also uses dap client to access the data, and also illustrates
+how the NetCDFFile function deals with missing values.
+
 wiki_example.py is the example from the MatplotlibCookbook scipy wiki page
 (http://www.scipy.org/wikis/topical_software/MatplotlibCookbook/wikipage_view).
 

Modified: trunk/toolkits/basemap/examples/run_all.py
===
--- trunk/toolkits/basemap/examples/run_all.py  2007-12-12 16:43:29 UTC (rev 
4710)
+++ trunk/toolkits/basemap/examples/run_all.py  2007-12-12 16:57:09 UTC (rev 
4711)
@@ -2,6 +2,7 @@
 test_files = glob.glob('*.py')
 test_files.remove('run_all.py')
 test_files.remove('fcstmaps.py')
+test_files.remove('plotsst.py')
 test_files.remove('testgdal.py')
 test_files.remove('pnganim.py')
 test_files.remove('warpimage.py')


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4712] trunk/toolkits/basemap/examples/plotsst.py

2007-12-12 Thread jswhit
Revision: 4712
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4712&view=rev
Author:   jswhit
Date: 2007-12-12 10:24:56 -0800 (Wed, 12 Dec 2007)

Log Message:
---
fix up a bit.

Modified Paths:
--
trunk/toolkits/basemap/examples/plotsst.py

Modified: trunk/toolkits/basemap/examples/plotsst.py
===
--- trunk/toolkits/basemap/examples/plotsst.py  2007-12-12 16:57:09 UTC (rev 
4711)
+++ trunk/toolkits/basemap/examples/plotsst.py  2007-12-12 18:24:56 UTC (rev 
4712)
@@ -4,23 +4,38 @@
 # can be a local file, a URL for a remote opendap dataset,
 # or (if PyNIO is installed) a GRIB or HDF file.
 ncfile = 
NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/2007/AVHRR/sst4-navy-eot.20071201.nc')
+# read sst.  Will automatically create a masked array using
+# missing_value variable attribute.
 sst = ncfile.variables['sst'][:]
+# read lats and lons (representing centers of grid boxes).
 lats = ncfile.variables['lat'][:]
 lons = ncfile.variables['lon'][:]
+# shift lats, lons so values represent edges of grid boxes
+# (as pcolor expects).
+delon = lons[1]-lons[0]
+delat = lats[1]-lats[0]
+lons = (lons - 0.5*delon).tolist()
+lons.append(lons[-1]+delon)
+lons = numpy.array(lons,numpy.float64)
+lats = (lats - 0.5*delat).tolist()
+lats.append(lats[-1]+delat)
+lats = numpy.array(lats,numpy.float64)
 # create Basemap instance for mollweide projection.
 # coastlines not used, so resolution set to None to skip
 # continent processing (this speeds things up a bit)
 m = Basemap(projection='moll',lon_0=lons.mean(),lat_0=0,resolution=None)
 # compute map projection coordinates of grid.
 x, y = m(*numpy.meshgrid(lons, lats))
-m.drawmapboundary(fill_color='k')
+# draw line around map projection limb.
+# color background of map projection region.
+# missing values over land will show up this color.
+m.drawmapboundary(fill_color='0.3')
 # plot with pcolor
-im = m.pcolormesh(x,y,sst,shading='flat',cmap=pylab.cm.gist_ncar)
+im = m.pcolor(x,y,sst,shading='flat',cmap=pylab.cm.gist_ncar)
 # draw parallels and meridians, but don't bother labelling them.
 m.drawparallels(numpy.arange(-90.,120.,30.))
 m.drawmeridians(numpy.arange(0.,420.,60.))
-# draw line around map projection limb.
-# color map region background black (missing values will be this color)
 # draw horizontal colorbar.
 pylab.colorbar(orientation='horizontal')
+# display the plot.
 pylab.show()


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4715] branches/transforms

2007-12-12 Thread mdboom
Revision: 4715
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4715&view=rev
Author:   mdboom
Date: 2007-12-12 11:15:46 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Merged revisions 4707-4714 via svnmerge from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib


  r4707 | mdboom | 2007-12-12 09:52:01 -0500 (Wed, 12 Dec 2007) | 2 lines
  
  Support fontconfig syntax in Text constructor.

  r4713 | mdboom | 2007-12-12 14:07:03 -0500 (Wed, 12 Dec 2007) | 2 lines
  
  Fix reference-counting leak when saving an Agg Png to a file-like object.


Modified Paths:
--
branches/transforms/src/_backend_agg.cpp

Property Changed:

branches/transforms/


Property changes on: branches/transforms
___
Name: svnmerge-integrated
   - /trunk/matplotlib:1-4706
   + /trunk/matplotlib:1-4714

Modified: branches/transforms/src/_backend_agg.cpp
===
--- branches/transforms/src/_backend_agg.cpp2007-12-12 19:11:44 UTC (rev 
4714)
+++ branches/transforms/src/_backend_agg.cpp2007-12-12 19:15:46 UTC (rev 
4715)
@@ -1289,17 +1289,21 @@
 static void write_png_data(png_structp png_ptr, png_bytep data, png_size_t 
length) {
   PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
   PyObject* write_method = PyObject_GetAttrString(py_file_obj, "write");
-  PyObject_CallFunction(write_method, "s#", data, length);
-
-  // MGDTODO: Check NULL on failure
+  PyObject* result = NULL;
+  if (write_method)
+result = PyObject_CallFunction(write_method, "s#", data, length);
+  Py_XDECREF(write_method);
+  Py_XDECREF(result);
 }
 
 static void flush_png_data(png_structp png_ptr) {
   PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
   PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "flush");
-  if (flush_method) {
-PyObject_CallFunction(flush_method, "");
-  }
+  PyObject* result = NULL;
+  if (flush_method)
+result = PyObject_CallFunction(flush_method, "");
+  Py_XDECREF(flush_method);
+  Py_XDECREF(result);
 }
 
 // this code is heavily adapted from the paint license, which is in
@@ -1322,8 +1326,11 @@
   }
   else {
 PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write");
-if (!(write_method && PyCallable_Check(write_method)))
+if (!(write_method && PyCallable_Check(write_method))) {
+  Py_XDECREF(write_method);
   throw Py::TypeError("Object does not appear to be a path or a Python 
file-like object");
+}
+Py_XDECREF(write_method);
   }
 
   png_bytep *row_pointers = NULL;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4713] trunk/matplotlib/src/_backend_agg.cpp

2007-12-12 Thread mdboom
Revision: 4713
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4713&view=rev
Author:   mdboom
Date: 2007-12-12 11:07:03 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Fix reference-counting leak when saving an Agg Png to a file-like object.

Modified Paths:
--
trunk/matplotlib/src/_backend_agg.cpp

Modified: trunk/matplotlib/src/_backend_agg.cpp
===
--- trunk/matplotlib/src/_backend_agg.cpp   2007-12-12 18:24:56 UTC (rev 
4712)
+++ trunk/matplotlib/src/_backend_agg.cpp   2007-12-12 19:07:03 UTC (rev 
4713)
@@ -2261,17 +2261,21 @@
 static void write_png_data(png_structp png_ptr, png_bytep data, png_size_t 
length) {
   PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
   PyObject* write_method = PyObject_GetAttrString(py_file_obj, "write");
-  PyObject_CallFunction(write_method, "s#", data, length);
-
-  // MGDTODO: Check NULL on failure
+  PyObject* result = NULL;
+  if (write_method)
+result = PyObject_CallFunction(write_method, "s#", data, length);
+  Py_XDECREF(write_method);
+  Py_XDECREF(result);
 }
 
 static void flush_png_data(png_structp png_ptr) {
   PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
   PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "flush");
-  if (flush_method) {
-PyObject_CallFunction(flush_method, "");
-  }
+  PyObject* result = NULL;
+  if (flush_method)
+result = PyObject_CallFunction(flush_method, "");
+  Py_XDECREF(flush_method);
+  Py_XDECREF(result);
 }
 
 // this code is heavily adapted from the paint license, which is in
@@ -2294,8 +2298,11 @@
   }
   else {
 PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write");
-if (!(write_method && PyCallable_Check(write_method)))
+if (!(write_method && PyCallable_Check(write_method))) {
+  Py_XDECREF(write_method);
   throw Py::TypeError("Object does not appear to be a path or a Python 
file-like object");
+}
+Py_XDECREF(write_method);
   }
 
   png_bytep *row_pointers = NULL;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4714] branches/transforms/lib/matplotlib/patches. py

2007-12-12 Thread mdboom
Revision: 4714
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4714&view=rev
Author:   mdboom
Date: 2007-12-12 11:11:44 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Code cleanup

Modified Paths:
--
branches/transforms/lib/matplotlib/patches.py

Modified: branches/transforms/lib/matplotlib/patches.py
===
--- branches/transforms/lib/matplotlib/patches.py   2007-12-12 19:07:03 UTC 
(rev 4713)
+++ branches/transforms/lib/matplotlib/patches.py   2007-12-12 19:11:44 UTC 
(rev 4714)
@@ -993,15 +993,6 @@
 self._path = Path.arc(self._theta1, self._theta2)
 return Patch.draw(self, renderer)
 
-# Transforms the axes box_path so that it is relative to the unit
-# circle in the same way that it is relative to the desired
-# ellipse.
-box_path = Path.unit_rectangle()
-box_path_transform = transforms.BboxTransformTo(self.axes.bbox) + \
-self.get_transform().inverted()
-box_path = box_path.transformed(box_path_transform)
-vertices = []
-
 def iter_circle_intersect_on_line(x0, y0, x1, y1):
 dx = x1 - x0
 dy = y1 - y0
@@ -1046,6 +1037,15 @@
 if x >= x0e and x <= x1e and y >= y0e and y <= y1e:
 yield x, y
 
+
+# Transforms the axes box_path so that it is relative to the unit
+# circle in the same way that it is relative to the desired
+# ellipse.
+box_path = Path.unit_rectangle()
+box_path_transform = transforms.BboxTransformTo(self.axes.bbox) + \
+self.get_transform().inverted()
+box_path = box_path.transformed(box_path_transform)
+
 PI = npy.pi
 TWOPI = PI * 2.0
 RAD2DEG = 180.0 / PI


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4717] branches/transforms/lib/matplotlib/backends/ backend_svg.py

2007-12-12 Thread mdboom
Revision: 4717
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4717&view=rev
Author:   mdboom
Date: 2007-12-12 12:13:52 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Somehow this fix didn't get merged from trunk...  (Saving gzipped Svg files)

Modified Paths:
--
branches/transforms/lib/matplotlib/backends/backend_svg.py

Modified: branches/transforms/lib/matplotlib/backends/backend_svg.py
===
--- branches/transforms/lib/matplotlib/backends/backend_svg.py  2007-12-12 
20:06:30 UTC (rev 4716)
+++ branches/transforms/lib/matplotlib/backends/backend_svg.py  2007-12-12 
20:13:52 UTC (rev 4717)
@@ -517,9 +517,15 @@
 return self._print_svg(filename, svgwriter, fh_to_close)
 
 def print_svgz(self, filename, *args, **kwargs):
-gzipwriter = gzip.GzipFile(filename, 'w')
-svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8')
-return self._print_svg(filename, svgwriter)
+if is_string_like(filename):
+gzipwriter = gzip.GzipFile(filename, 'w')
+fh_to_close = svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8')
+elif is_writable_file_like(filename):
+fh_to_close = gzipwriter = gzip.GzipFile(fileobj=filename, 
mode='w')
+svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8')
+else:
+raise ValueError("filename must be a path or a file-like object")
+return self._print_svg(filename, svgwriter, fh_to_close)
 
 def _print_svg(self, filename, svgwriter, fh_to_close=None):
 self.figure.set_dpi(72.0)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4716] branches/transforms

2007-12-12 Thread mdboom
Revision: 4716
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4716&view=rev
Author:   mdboom
Date: 2007-12-12 12:06:30 -0800 (Wed, 12 Dec 2007)

Log Message:
---
Save images to Svg files without writing the image data out as a
temporary file.

Modified Paths:
--
branches/transforms/lib/matplotlib/backends/backend_svg.py
branches/transforms/src/_image.cpp

Modified: branches/transforms/lib/matplotlib/backends/backend_svg.py
===
--- branches/transforms/lib/matplotlib/backends/backend_svg.py  2007-12-12 
19:15:46 UTC (rev 4715)
+++ branches/transforms/lib/matplotlib/backends/backend_svg.py  2007-12-12 
20:06:30 UTC (rev 4716)
@@ -245,30 +245,33 @@
 
 h,w = im.get_size_out()
 
+self._svgwriter.write (
+'\n'%(x/trans[0], (self.height-y)/trans[3]-h, 
w, h, hrefstr, transstr)
-)
+self._svgwriter.write('"/>\n')
 
 def draw_text(self, gc, x, y, s, prop, angle, ismath):
 if ismath:

Modified: branches/transforms/src/_image.cpp
===
--- branches/transforms/src/_image.cpp  2007-12-12 19:15:46 UTC (rev 4715)
+++ branches/transforms/src/_image.cpp  2007-12-12 20:06:30 UTC (rev 4716)
@@ -575,7 +575,25 @@
 
 }
 
+static void write_png_data(png_structp png_ptr, png_bytep data, png_size_t 
length) {
+  PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
+  PyObject* write_method = PyObject_GetAttrString(py_file_obj, "write");
+  PyObject* result = NULL;
+  if (write_method)
+result = PyObject_CallFunction(write_method, "s#", data, length);
+  Py_XDECREF(write_method);
+  Py_XDECREF(result);
+}
 
+static void flush_png_data(png_structp png_ptr) {
+  PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
+  PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "flush");
+  PyObject* result = NULL;
+  if (flush_method)
+result = PyObject_CallFunction(flush_method, "");
+  Py_XDECREF(flush_method);
+  Py_XDECREF(result);
+}
 
 // this code is heavily adapted from the paint license, which is in
 // the file paint.license (BSD compatible) included in this
@@ -593,79 +611,90 @@
 
   args.verify_length(1);
 
-  std::pair bufpair = _get_output_buffer();
+  FILE *fp = NULL;
+  Py::Object py_fileobj = Py::Object(args[0]);
+  if (py_fileobj.isString()) {
+std::string fileName = Py::String(py_fileobj);
+const char *file_name = fileName.c_str();
+if ((fp = fopen(file_name, "wb")) == NULL)
+  throw Py::RuntimeError( Printf("Could not open file %s", 
file_name).str() );
+  }
+  else {
+PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write");
+if (!(write_method && PyCallable_Check(write_method))) {
+  Py_XDECREF(write_method);
+  throw Py::TypeError("Object does not appear to be a path or a Python 
file-like object");
+}
+Py_XDECREF(write_method);
+  }
 
-  std::string fileName = Py::String(args[0]);
-  const char *file_name = fileName.c_str();
-  FILE *fp;
   png_structp png_ptr;
   png_infop info_ptr;
-  structpng_color_8_struct sig_bit;
+  struct png_color_8_struct sig_bit;
   png_uint_32 row=0;
 
   //todo: allocate on heap
-  png_bytep *row_pointers = new png_bytep[rowsOut];
+  png_bytep *row_pointers = NULL;
+  std::pair bufpair;
+  bufpair.first = NULL;
+  bufpair.second = false;
 
-  for (row = 0; row < rowsOut; ++row)
-row_pointers[row] = bufpair.first + row * colsOut * 4;
+  try {
+row_pointers = new png_bytep[rowsOut];
+if (!row_pointers)
+  throw Py::RuntimeError("Out of memory");
 
-  fp = fopen(file_name, "wb");
-  if (fp == NULL) {
-if (bufpair.second) delete [] bufpair.first;
-delete [] row_pointers;
-throw Py::RuntimeError(Printf("Could not open file %s", file_name).str());
-  }
+bufpair = _get_output_buffer();
+for (row = 0; row < rowsOut; ++row)
+  row_pointers[row] = bufpair.first + row * colsOut * 4;
 
+png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+if (png_ptr == NULL)
+  throw Py::RuntimeError("Could not create write struct");
 
-  png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-  if (png_ptr == NULL) {
-if (bufpair.second) delete [] bufpair.first;
-fclose(fp);
-delete [] row_pointers;
-throw Py::RuntimeError("Could not create write struct");
-  }
+info_ptr = png_create_info_struct(png_ptr);
+if (info_ptr == NULL)
+  throw Py::RuntimeError("Could not create info struct");
 
-  info_ptr = png_create_info_struct(png_ptr);
-  if (info_ptr == NULL) {
-if (bufpair.second) delete [] bufpair.first;
-fclose(fp);
+if (setjmp(png_ptr->jmpbuf))
+  throw Py::RuntimeError("Error building image");
+
+if (fp) {
+  png_init_io(png_ptr, fp);
+} else {
+  png_set_write_fn(png_ptr, (void*)py_fileobj.ptr(),
+  &write_png_dat