1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
Author: Andreas Tille <tille@debian.org>
Last-Update: Wed, 13 Mar 2024 11:41:42 +0100
Description: Replace deprecated clock() by perf_counter() to measure time needed
--- a/examples/hires.py
+++ b/examples/hires.py
@@ -9,7 +9,7 @@ import pickle, time
fig = plt.figure()
# create Basemap instance. Use 'high' resolution coastlines.
-t1 = time.clock()
+t1 = time.perf_counter()
#m = Basemap(llcrnrlon=-10.5,llcrnrlat=49.5,urcrnrlon=3.5,urcrnrlat=59.5,
# resolution='h',projection='tmerc',lon_0=-4,lat_0=0)
m = Basemap(width=920000,height=1100000,
@@ -17,7 +17,7 @@ m = Basemap(width=920000,height=1100000,
# make sure countries and rivers are loaded
m.drawcountries()
m.drawrivers()
-print(time.clock()-t1,' secs to create original Basemap instance')
+print(time.perf_counter()-t1,' secs to create original Basemap instance')
# pickle the class instance.
pickle.dump(m,open('map.pickle','wb'),-1)
@@ -25,7 +25,7 @@ pickle.dump(m,open('map.pickle','wb'),-1
# clear the figure
plt.clf()
# read pickle back in and plot it again (should be much faster).
-t1 = time.clock()
+t1 = time.perf_counter()
m2 = pickle.load(open('map.pickle','rb'))
# draw coastlines and fill continents.
m.drawcoastlines()
@@ -38,7 +38,7 @@ m.drawcountries(linewidth=1)
m.drawmapboundary(fill_color='aqua')
# draw major rivers.
m.drawrivers(color='b')
-print(time.clock()-t1,' secs to plot using using a pickled Basemap instance')
+print(time.perf_counter()-t1,' secs to plot using using a pickled Basemap instance')
# draw parallels
circles = np.arange(48,65,2).tolist()
m.drawparallels(circles,labels=[1,1,0,0])
--- a/lib/mpl_toolkits/basemap/__init__.py
+++ b/lib/mpl_toolkits/basemap/__init__.py
@@ -14,7 +14,7 @@ heavy lifting), and the following functi
:func:`addcyclic`: Add cyclic (wraparound) point in longitude.
"""
-from distutils.version import LooseVersion
+from packaging.version import Version as LooseVersion
try:
from urllib import urlretrieve
--- a/lib/mpl_toolkits/basemap/diagnostic.py
+++ b/lib/mpl_toolkits/basemap/diagnostic.py
@@ -93,7 +93,7 @@ def check_proj_inv_hammer(segfault_prote
False - inverse hammer is not supported
"Unknown" - support is Unknown
"""
- from distutils.version import LooseVersion
+ from packaging.version import Version as LooseVersion
from pyproj import __version__ as pyproj_version
if LooseVersion(proj4_version()) > LooseVersion('4.9.2'):
--- a/lib/mpl_toolkits/basemap/test.py
+++ b/lib/mpl_toolkits/basemap/test.py
@@ -1,6 +1,6 @@
from __future__ import (absolute_import, division, print_function)
-from distutils.version import LooseVersion
+from packaging.version import Version as LooseVersion
import sys
from mpl_toolkits.basemap import Basemap, shiftgrid
import numpy as np
|