From 644d02e8ec9912a33c1822c28507eaa979f8b89e Mon Sep 17 00:00:00 2001 From: Kristen Thyng Date: Mon, 15 Jul 2019 12:27:15 -0500 Subject: [PATCH] small tweaks to remove old mpl functions that were apparently deprecated with new mpl version --- tracpy/calcs.py | 4 ++-- tracpy/inout.py | 4 ++-- tracpy/tools.py | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tracpy/calcs.py b/tracpy/calcs.py index d1dcaa0..df6409f 100755 --- a/tracpy/calcs.py +++ b/tracpy/calcs.py @@ -3,7 +3,7 @@ """ import numpy as np -from matplotlib.mlab import find +# from matplotlib.mlab import find import netCDF4 as netCDF from scipy import ndimage import time @@ -266,7 +266,7 @@ def rel_dispersion(lonp, latp, r=[0, 1], squared=True, spherical=True): spherical=spherical) # add in which drifter we are at to shift to correct index and one # since starts after comparison point - ind = idrifter + 1 + find((dist <= r[1]) * (dist >= r[0])) + ind = idrifter + 1 + np.where((dist <= r[1]) * (dist >= r[0]))[0] for i in ind: pairs.append([min(idrifter, i), max(idrifter, i)]) diff --git a/tracpy/inout.py b/tracpy/inout.py index 92234c6..7aa39c2 100755 --- a/tracpy/inout.py +++ b/tracpy/inout.py @@ -22,7 +22,7 @@ from . import op import os import tracpy -from matplotlib.mlab import find +# from matplotlib.mlab import find def setupROMSfiles(loc, date, ff, tout, time_units, tstride=1): @@ -72,7 +72,7 @@ def setupROMSfiles(loc, date, ff, tout, time_units, tstride=1): dates = netCDF.num2date(nc.variables['ocean_time'][:], time_units, calendar='proleptic_gregorian') # time index with time value just below date (relative to file ifile) - istart = find(dates <= date)[-1] + istart = np.where(dates <= date)[0][-1] # Select indices if ff == 1: diff --git a/tracpy/tools.py b/tracpy/tools.py index c4cb5f3..a3972c8 100755 --- a/tracpy/tools.py +++ b/tracpy/tools.py @@ -15,7 +15,8 @@ from scipy import ndimage import time import matplotlib.tri as mtri -from matplotlib.mlab import Path, find +# from matplotlib.mlab import Path, find +from matplotlib.path import Path def interpolate2d(x, y, grid, itype, xin=None, yin=None, order=1, @@ -462,7 +463,7 @@ def make_proj(setup='nwgom', usebasemap=True, **kwargs): # Set up projection using inputs dictionary if usebasemap: - from mpl_toolkits.basemap import Basemap + # from mpl_toolkits.basemap import Basemap proj = Basemap(**inputs) else: from pyproj import Proj