python - Matplotlib basemap reading shapefile is very slow -


i trying plot simple 'merc' map boundary shape file. total size of shape file ne_10m_admin_0_countries_lakes.shp 8mb. simple mslp surface plot gfs data took more 28 sec think much. after investigation found reading of shape file consuming around 10 sec. simple code demonstrate issue shown below:-

import matplotlib matplotlib.use('agg') import matplotlib.pyplot plt mpl_toolkits.basemap import basemap   south = 0 north = 5 west = 70 east = 85  m = basemap(projection='merc', llcrnrlat=south, urcrnrlat=north,         llcrnrlon=west, urcrnrlon=east, resolution='c') m.readshapefile('data/gis-data/world_countries/'     'ne_10m_admin_0_countries_lakes', 'ne_10m_admin_0_countries_lakes', linewidth=0.7)  plt.savefig('map.png') 

to show problem facing, have run above code , without commenting path shape file. here time script took after reading shape file:-

$ time python test.py  real    0m18.234s user    0m17.832s sys 0m1.020s 

here result without reading shape file:-

$ time python test.py  real    0m2.506s user    0m2.360s sys 0m0.324s 

is there way read shape file quickly? there solution/trick issue?

i put question geographic information systems too, there people you. if basemap slow, did try cartopy, saw on matplotlib site, see http://matplotlib.org/1.4.1/mpl_toolkits/index.html


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -