Skip to content

Commit

Permalink
Switch bathymetry interp from scipy to simple bilinear
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Sep 2, 2020
1 parent 0987573 commit eae5e28
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions conda_package/mpas_tools/ocean/inject_bathymetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
unicode_literals

from mpas_tools.mesh.creation.open_msh import readmsh
from mpas_tools.mesh.interpolation import interp_bilin
import numpy as np
from scipy import interpolate
import netCDF4 as nc4
Expand Down Expand Up @@ -84,13 +85,8 @@ def interpolate_SRTM(lon_pts, lat_pts):
idx = np.intersect1d(lon_idx, lat_idx)
xpts = lon_pts[idx]
ypts = lat_pts[idx]
xy_pts = np.vstack((xpts, ypts)).T

# Interpolate bathymetry onto points
bathy = interpolate.RegularGridInterpolator(
(xdata, ydata), zdata.T, bounds_error=False, fill_value=np.nan)
bathy_int = bathy(xy_pts)
bathymetry[idx] = bathy_int
bathymetry[idx] = interp_bilin(xdata, ydata, zdata, xpts, ypts)

end = timeit.default_timer()
print(end - start, " seconds")
Expand Down

0 comments on commit eae5e28

Please sign in to comment.