Skip to content

Commit 5dcac8c

Browse files
Micah CochranMicah Cochran
authored andcommitted
Merge remote-tracking branch 'refs/remotes/matplotlib/master'
2 parents 24336eb + c8aeba4 commit 5dcac8c

File tree

6 files changed

+100
-9
lines changed

6 files changed

+100
-9
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ install:
4646
- python setup.py install
4747

4848
script:
49-
- python lib/mpl_toolkits/basemap/test.py
49+
- python lib/mpl_toolkits/basemap/test.py --verbose
5050

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using matplotlib.
55

66
##Requirements
77

8-
* python 2.5 (or higher)
8+
* Python 2.6 (or higher)
99

1010
* matplotlib
1111

@@ -18,18 +18,21 @@ using matplotlib.
1818
* The GEOS (Geometry Engine - Open Source) library (version 3.1.1 or higher).
1919
Source code is included in the geos-3.3.3 directory.
2020

21-
* [PIL](http://pythonware.com/products/pil) is optional (only
22-
needed for Basemap warpimage and bluemarble methods).
23-
2421
* On linux, if your python was installed via a package management system, make
2522
sure the corresponding "python-dev" package is also installed. Otherwise, you
2623
may not have the python header (Python.h), which is required to build python
2724
C extensions.
2825

29-
##Copyright
26+
###Optional
27+
28+
* [OWSLib](https://github.com/geopython/OWSLib) (optional) It is needed
29+
for the BaseMap.wmsimage function.
3030

31-
source code from [proj.4](http://trac.osgeo.org/proj/) is included in the
32-
'src' directory under the terms given in LICENSE_proj4.
31+
* [Pillow](https://python-pillow.github.io/) (optional) It is
32+
needed for Basemap warpimage, bluemarble, shadedrelief, and etop methods.
33+
PIL should work on Python 2.x. Pillow is a maintained fork of PIL.
34+
35+
##Copyright
3336

3437
source code for the GEOS library is
3538
included in the 'geos-3.3.3' directory under the terms given in
@@ -39,7 +42,7 @@ the land-sea mask, coastline, lake, river and political boundary data are extrac
3942
from datasets provided with the [Generic Mapping Tools (GMT)](http://gmt.soest.hawaii.edu)
4043
and are included under the terms given in LICENSE_data.
4144

42-
Everything else (including src/_proj.pyx, src/_proj.c, src/_geos.c, and src/_geos.pyx):
45+
Everything else (including src/_geos.c, and src/_geos.pyx):
4346

4447
copyright (c) 2011 by Jeffrey Whitaker.
4548

examples/run_all.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212
test_files.remove('plothighsandlows.py') # requires scipy
1313
test_files.remove('lic_demo.py')
1414
test_files.remove('testwmsimage.py')
15+
try:
16+
from netCDF4 import Dataset
17+
except ImportError:
18+
# remove tests requiring netCDF4
19+
sys.stdout.write("Could not import netCDF4, skipping tests that require netCDF4.\n")
20+
test_files.remove('streamplot_demo.py')
21+
test_files.remove('plotprecip.py')
22+
test_files.remove('test_rotpole.py')
23+
test_files.remove('ccsm_popgrid.py')
24+
test_files.remove('ploticos.py')
25+
1526
py_path = os.environ.get('PYTHONPATH')
1627
if py_path is None:
1728
py_path = '.'

lib/mpl_toolkits/basemap/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,8 @@ def _readboundarydata(self,name,as_polygons=False):
14601460
if not as_polygons or len(b) > 4:
14611461
polygons.append(list(zip(b[:,0],b[:,1])))
14621462
polygon_types.append(typ)
1463+
bdatfile.close()
1464+
bdatmetafile.close()
14631465
return polygons, polygon_types
14641466

14651467
def _getmapboundary(self):
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""
2+
These are diagnostic and debugging functions for basemap.
3+
"""
4+
5+
def package_versions():
6+
"""
7+
Gives version information for dependent packages.
8+
9+
returns namedtuple BasemapPackageVersions
10+
"""
11+
from collections import namedtuple
12+
from sys import version as sys_version
13+
14+
from matplotlib import __version__ as matplotlib_version
15+
from numpy import __version__ as numpy_version
16+
import pyproj
17+
from shapefile import __version__ as pyshp_version
18+
19+
import _geoslib
20+
from mpl_toolkits.basemap import __version__ as basemap_version
21+
22+
# import optional dependencies
23+
try:
24+
from OWSLib import __version__ as OWSLib_version
25+
except ImportError:
26+
OWSLib_version = 'not installed'
27+
28+
try:
29+
from PIL import VERSION as pil_version
30+
try:
31+
from PIL import PILLOW_VERSION as pillow_version
32+
except ImportError:
33+
pillow_version = 'not installed'
34+
except ImportError:
35+
pil_version = 'not installed'
36+
pillow_version = 'not installed'
37+
38+
# Get PROJ.4 version info in a floating point number
39+
proj_ver_num = pyproj.Proj(init='epsg:4326').proj_version
40+
# reformats floating point number into string (4.90 becomes '4.9.0')
41+
proj4_version = '.'.join(list(str(int(proj_ver_num*100))))
42+
43+
BasemapPackageVersions = namedtuple(
44+
'BasemapPackageVersions',
45+
"""Python, basemap, matplotlib,
46+
numpy, pyproj, pyshp, PROJ4, GEOS,
47+
OWSLib, PIL, Pillow""")
48+
49+
return BasemapPackageVersions(
50+
Python = sys_version,
51+
basemap = basemap_version,
52+
matplotlib = matplotlib_version,
53+
numpy = numpy_version,
54+
pyproj = pyproj.__version__,
55+
pyshp = pyshp_version,
56+
PROJ4 = proj4_version,
57+
GEOS = _geoslib.__geos_version__,
58+
# optional dependencies below
59+
OWSLib = OWSLib_version,
60+
PIL = pil_version,
61+
Pillow = pillow_version)

lib/mpl_toolkits/basemap/test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,19 @@ def test():
206206

207207

208208
if __name__ == '__main__':
209+
# When called with the -v / --verbose commandline parameter, it will
210+
# give package dependent version information:
211+
# $ python test.py --verbose
212+
213+
import sys
209214
import unittest
215+
216+
from mpl_toolkits.basemap.diagnostic import package_versions
217+
218+
if '--verbose' in sys.argv or '-v' in sys.argv:
219+
pkg_vers = package_versions()
220+
print('Basemaps installed package versions:')
221+
print('{0}\n'.format(pkg_vers))
222+
210223
unittest.main()
224+

0 commit comments

Comments
 (0)