SF.net SVN: matplotlib: [4746] trunk/toolkits/basemap/README
Revision: 4746 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4746&view=rev Author: jswhit Date: 2007-12-16 05:45:45 -0800 (Sun, 16 Dec 2007) Log Message: --- refine install instructions. Modified Paths: -- trunk/toolkits/basemap/README Modified: trunk/toolkits/basemap/README === --- trunk/toolkits/basemap/README 2007-12-15 21:33:38 UTC (rev 4745) +++ trunk/toolkits/basemap/README 2007-12-16 13:45:45 UTC (rev 4746) @@ -87,12 +87,16 @@ 4) To test, cd to the examples directory and run 'python simpletest.py'. On linux, if you get an import error (with a message about not finding libgeos.so) you may need to set the LD_LIBRARY_PATH environment -to include $GEOS_DIR/lib. +to include $GEOS_DIR/lib. To run all the examples (except those that +have extra dependenices or require an internet connection), execute +'python run_all.py'. 5) if you want the full-resolution coastlines, download basemap-data-fullres-X.Y.Z.tar.gz (about 70 mb), untar it, cd into basemap-data-fullres-X.Y.Z and -run 'python setup-data.py install'. +run 'python setup-data.py install'. The fullres dataset does not +change with every basemap release, so you may need to look back +a couple of releases on the download page to find it. **Contact** 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: [4747] trunk/matplotlib/unit/mlab_unit.py
Revision: 4747
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4747&view=rev
Author: astraw
Date: 2007-12-16 11:28:46 -0800 (Sun, 16 Dec 2007)
Log Message:
---
Add test for rec2csv and csv2rec roundtrip not losing precision.
Added Paths:
---
trunk/matplotlib/unit/mlab_unit.py
Added: trunk/matplotlib/unit/mlab_unit.py
===
--- trunk/matplotlib/unit/mlab_unit.py (rev 0)
+++ trunk/matplotlib/unit/mlab_unit.py 2007-12-16 19:28:46 UTC (rev 4747)
@@ -0,0 +1,38 @@
+import unittest
+import matplotlib.mlab as mlab
+import numpy
+import StringIO
+
+class TestMlab(unittest.TestCase):
+def test_csv2rec_closefile(self):
+# If passed a file-like object, rec2csv should not close it.
+ra=numpy.rec.array([(123, 1197346475.0137341), (456, 123.456)],
+ dtype=[('a', '=
+# 1.0.5.
+ra=numpy.rec.array([(123, 1197346475.0137341), (456, 123.456)],
+ dtype=[('a', '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: [4748] trunk/matplotlib
Revision: 4748
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4748&view=rev
Author: astraw
Date: 2007-12-16 12:53:35 -0800 (Sun, 16 Dec 2007)
Log Message:
---
rec2csv does not close filehandles passed in open
Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/cbook.py
trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG 2007-12-16 19:28:46 UTC (rev 4747)
+++ trunk/matplotlib/CHANGELOG 2007-12-16 20:53:35 UTC (rev 4748)
@@ -1,3 +1,6 @@
+2007-12-16 rec2csv saves doubles without losing precision. Also, it
+ does not close filehandles passed in open. - JDH,ADS
+
2007-12-13 Moved rec2gtk to matplotlib.toolkits.gtktools and rec2excel
to matplotlib.toolkits.exceltools - JDH
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===
--- trunk/matplotlib/lib/matplotlib/cbook.py2007-12-16 19:28:46 UTC (rev
4747)
+++ trunk/matplotlib/lib/matplotlib/cbook.py2007-12-16 20:53:35 UTC (rev
4748)
@@ -224,7 +224,7 @@
except TypeError: return False
else: return True
-def to_filehandle(fname, flag='r'):
+def to_filehandle(fname, flag='r', return_opened=False):
"""
fname can be a filename or a file handle. Support for gzipped
files is automatic, if the filename ends in .gz. flag is a
@@ -236,10 +236,14 @@
fh = gzip.open(fname, flag)
else:
fh = file(fname, flag)
+opened = True
elif hasattr(fname, 'seek'):
fh = fname
+opened = False
else:
raise ValueError('fname must be a string or file handle')
+if return_opened:
+return fh, opened
return fh
def flatten(seq, scalarp=is_scalar):
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===
--- trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-16 19:28:46 UTC (rev
4747)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-16 20:53:35 UTC (rev
4748)
@@ -2335,13 +2335,14 @@
for i, name in enumerate(r.dtype.names):
funcs.append(csvformat_factory(formatd[name]).tostr)
-fh = cbook.to_filehandle(fname, 'w')
+fh, opened = cbook.to_filehandle(fname, 'w', return_opened=True)
writer = csv.writer(fh, delimiter=delimiter)
header = r.dtype.names
writer.writerow(header)
for row in r:
writer.writerow([func(val) for func, val in zip(funcs, row)])
-fh.close()
+if opened:
+fh.close()
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: [4749] trunk/matplotlib
Revision: 4749
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4749&view=rev
Author: astraw
Date: 2007-12-16 15:19:59 -0800 (Sun, 16 Dec 2007)
Log Message:
---
fix csv2rec roundtrip for funky strings, too
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/mlab.py
trunk/matplotlib/unit/mlab_unit.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===
--- trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-16 20:53:35 UTC (rev
4748)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-16 23:19:59 UTC (rev
4749)
@@ -2236,11 +2236,15 @@
return repr(x)
+class FormatString2(FormatObj):
+def tostr(self, x):
+val = repr(x)
+return val[1:-1]
+
class FormatString(FormatObj):
def tostr(self, x):
return '"%r"'%self.toval(x)
-
class FormatFormatStr(FormatObj):
def __init__(self, fmt):
self.fmt = fmt
@@ -2297,7 +2301,7 @@
npy.float32 : FormatFloat(),
npy.float64 : FormatFloat(),
npy.object_ : FormatObj(),
-npy.string_ : FormatObj(),
+npy.string_ : FormatString2(),
}
def get_formatd(r, formatd=None):
Modified: trunk/matplotlib/unit/mlab_unit.py
===
--- trunk/matplotlib/unit/mlab_unit.py 2007-12-16 20:53:35 UTC (rev 4748)
+++ trunk/matplotlib/unit/mlab_unit.py 2007-12-16 23:19:59 UTC (rev 4749)
@@ -13,25 +13,34 @@
self.failIf( fh.closed )
def test_csv2rec_roundtrip(self):
-# Make sure double-precision floats pass through.
+# Make sure double-precision floats and strings pass through a
+# roundtrip unaltered.
+
# A bug in numpy (fixed in r4602) meant that numpy scalars
# lost precision when passing through repr(). csv2rec was
# affected by this. This test will only pass on numpy >=
# 1.0.5.
-ra=numpy.rec.array([(123, 1197346475.0137341), (456, 123.456)],
- dtype=[('a', '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: [4750] trunk/toolkits/basemap/lib/matplotlib/ toolkits/__init__.py
Revision: 4750
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4750&view=rev
Author: jswhit
Date: 2007-12-16 15:28:33 -0800 (Sun, 16 Dec 2007)
Log Message:
---
not needed
Removed Paths:
-
trunk/toolkits/basemap/lib/matplotlib/toolkits/__init__.py
Deleted: trunk/toolkits/basemap/lib/matplotlib/toolkits/__init__.py
===
--- trunk/toolkits/basemap/lib/matplotlib/toolkits/__init__.py 2007-12-16
23:19:59 UTC (rev 4749)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/__init__.py 2007-12-16
23:28:33 UTC (rev 4750)
@@ -1,4 +0,0 @@
-#try:
-#__import__('pkg_resources').declare_namespace(__name__)
-#except ImportError:
-#pass # must not have setuptools
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: [4751] trunk/toolkits/basemap/MANIFEST.in
Revision: 4751 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4751&view=rev Author: jswhit Date: 2007-12-16 15:28:59 -0800 (Sun, 16 Dec 2007) Log Message: --- remove un-needed file Modified Paths: -- trunk/toolkits/basemap/MANIFEST.in Modified: trunk/toolkits/basemap/MANIFEST.in === --- trunk/toolkits/basemap/MANIFEST.in 2007-12-16 23:28:33 UTC (rev 4750) +++ trunk/toolkits/basemap/MANIFEST.in 2007-12-16 23:28:59 UTC (rev 4751) @@ -66,7 +66,6 @@ include examples/plotprecip.py include examples/nws_precip_conus_20061222.nc include examples/README -include lib/matplotlib/toolkits/__init__.py include lib/matplotlib/toolkits/basemap/__init__.py include lib/matplotlib/toolkits/basemap/basemap.py include lib/matplotlib/toolkits/basemap/proj.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://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: [4752] trunk/toolkits/basemap/setup.py
Revision: 4752
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4752&view=rev
Author: jswhit
Date: 2007-12-16 17:53:39 -0800 (Sun, 16 Dec 2007)
Log Message:
---
forgot that setuptools still needed for package_data in python 2.3
Modified Paths:
--
trunk/toolkits/basemap/setup.py
Modified: trunk/toolkits/basemap/setup.py
===
--- trunk/toolkits/basemap/setup.py 2007-12-16 23:28:59 UTC (rev 4751)
+++ trunk/toolkits/basemap/setup.py 2007-12-17 01:53:39 UTC (rev 4752)
@@ -1,5 +1,16 @@
import sys, glob, os
from distutils.core import setup
+major, minor1, minor2, s, tmp = sys.version_info
+if major==2 and minor1<=3:
+# setuptools monkeypatches distutils.core.Distribution to support
+# package_data
+try: import setuptools
+except ImportError:
+raise SystemExit("""
+matplotlib requires setuptools for installation. Please download
+http://peak.telecommunity.com/dist/ez_setup.py and run it (as su if
+you are doing a system wide install) to install the proper version of
+setuptools for your system""")
from distutils.core import Extension
from distutils.util import convert_path
import numpy
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: [4753] trunk/toolkits/basemap/README
Revision: 4753 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4753&view=rev Author: jswhit Date: 2007-12-16 18:12:31 -0800 (Sun, 16 Dec 2007) Log Message: --- update requirements. Modified Paths: -- trunk/toolkits/basemap/README Modified: trunk/toolkits/basemap/README === --- trunk/toolkits/basemap/README 2007-12-17 01:53:39 UTC (rev 4752) +++ trunk/toolkits/basemap/README 2007-12-17 02:12:31 UTC (rev 4753) @@ -5,6 +5,8 @@ **Requirements** +python 2.3 (or higher) + matplotlib 0.90 (or higher) numpy 1.0 (or higher) @@ -12,6 +14,8 @@ The GEOS (Geometry Engine - Open Source) library (version 2.2.3). Source code is included in the geos-2.2.3 directory. +setuptools (only if your are using python 2.3) + **Copyright** source code from proj.4 (http://proj.maptools.org) is included in the 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: [4754] trunk/toolkits/basemap/examples/plotsst.py
Revision: 4754
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4754&view=rev
Author: jswhit
Date: 2007-12-16 18:57:17 -0800 (Sun, 16 Dec 2007)
Log Message:
---
enter a date on command line.
Modified Paths:
--
trunk/toolkits/basemap/examples/plotsst.py
Modified: trunk/toolkits/basemap/examples/plotsst.py
===
--- trunk/toolkits/basemap/examples/plotsst.py 2007-12-17 02:12:31 UTC (rev
4753)
+++ trunk/toolkits/basemap/examples/plotsst.py 2007-12-17 02:57:17 UTC (rev
4754)
@@ -1,10 +1,16 @@
from matplotlib.toolkits.basemap import Basemap, NetCDFFile
-import pylab, numpy
+import pylab, numpy, sys
# read in sea-surface temperature and ice data
# can be a local file, a URL for a remote opendap dataset,
# or (if PyNIO is installed) a GRIB or HDF file.
-date = '20071214'
-ncfile =
NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-navy-eot.'+date+'.nc')
+if len(sys.argv) == 1:
+date = '20071215'
+else:
+date = sys.argv[1]
+if date[4] > '2005':
+ncfile =
NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-navy-eot.'+date+'.nc')
+else:
+ncfile =
NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/'+date[0:4]+'/AVHRR/sst4-path-eot.'+date+'.nc')
# read sst. Will automatically create a masked array using
# missing_value variable attribute.
sst = ncfile.variables['sst'][:]
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: [4755] trunk/matplotlib
Revision: 4755
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4755&view=rev
Author: jdh2358
Date: 2007-12-16 20:37:38 -0800 (Sun, 16 Dec 2007)
Log Message:
---
mods to support dates in csv2rec and friends
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/mlab.py
trunk/matplotlib/unit/mlab_unit.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===
--- trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-17 02:57:17 UTC (rev
4754)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-12-17 04:37:38 UTC (rev
4755)
@@ -2129,6 +2129,7 @@
process_skiprows(reader)
+dateparser = dateutil.parser.parse
def myfloat(x):
if x==missing:
@@ -2136,9 +2137,18 @@
else:
return float(x)
+def mydate(x):
+# try and return a date object
+d = dateparser(x)
+
+if d.hour>0 or d.minute>0 or d.second>0:
+raise ValueError('not a date')
+return d.date()
+
+
def get_func(item, func):
# promote functions in this order
-funcmap = {int:myfloat, myfloat:dateutil.parser.parse,
dateutil.parser.parse:str}
+funcmap = {int:myfloat, myfloat:mydate, mydate:dateparser,
dateparser:str}
try: func(item)
except:
if func==str:
@@ -2233,17 +2243,17 @@
return self.toval(x)
def toval(self, x):
-return repr(x)
+return str(x)
-class FormatString2(FormatObj):
+class FormatString(FormatObj):
def tostr(self, x):
val = repr(x)
return val[1:-1]
-class FormatString(FormatObj):
-def tostr(self, x):
-return '"%r"'%self.toval(x)
+#class FormatString(FormatObj):
+#def tostr(self, x):
+#return '"%r"'%self.toval(x)
class FormatFormatStr(FormatObj):
def __init__(self, fmt):
@@ -2301,7 +2311,7 @@
npy.float32 : FormatFloat(),
npy.float64 : FormatFloat(),
npy.object_ : FormatObj(),
-npy.string_ : FormatString2(),
+npy.string_ : FormatString(),
}
def get_formatd(r, formatd=None):
Modified: trunk/matplotlib/unit/mlab_unit.py
===
--- trunk/matplotlib/unit/mlab_unit.py 2007-12-17 02:57:17 UTC (rev 4754)
+++ trunk/matplotlib/unit/mlab_unit.py 2007-12-17 04:37:38 UTC (rev 4755)
@@ -1,7 +1,6 @@
-import unittest
+import datetime, StringIO, unittest
import matplotlib.mlab as mlab
import numpy
-import StringIO
class TestMlab(unittest.TestCase):
def test_csv2rec_closefile(self):
@@ -21,11 +20,22 @@
# lost precision when passing through repr(). csv2rec was
# affected by this. This test will only pass on numpy >=
# 1.0.5.
-ra=numpy.rec.array([(123, 1197346475.0137341, 'a,bc'),
-(456, 123.456, 'd\'ef'),
-(789, 0.1, 'ghi'),
+delta = datetime.timedelta(days=1)
+date0 = datetime.date(2007,12,16)
+date1 = date0 + delta
+date2 = date1 + delta
+
+delta = datetime.timedelta(days=1)
+datetime0 = datetime.datetime(2007,12,16,22,29,34,924122)
+datetime1 = datetime0 + delta
+datetime2 = datetime1 + delta
+ra=numpy.rec.fromrecords([
+(123, date0, datetime0, 1197346475.0137341, 'a,bc'),
+(456, date1, datetime1, 123.456, 'd\'ef'),
+(789, date2, datetime2, 0.1, 'ghi'),
],
- dtype=[('a', '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
