Skip to content
Snippets Groups Projects
Commit c3266e19 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 401bfc02
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ import h5py ...@@ -11,7 +11,7 @@ import h5py
import pickle import pickle
from netCDF4 import Dataset from netCDF4 import Dataset
from util.setup import ancillary_path from util.setup import ancillary_path
from scipy.interpolate import RectBivariateSpline from scipy.interpolate import RectBivariateSpline, interp2d
LatLonTuple = namedtuple('LatLonTuple', ['lat', 'lon']) LatLonTuple = namedtuple('LatLonTuple', ['lat', 'lon'])
...@@ -1397,3 +1397,17 @@ def resample(x, y, z, x_new, y_new): ...@@ -1397,3 +1397,17 @@ def resample(x, y, z, x_new, y_new):
def resample_one(x, y, z, x_new, y_new): def resample_one(x, y, z, x_new, y_new):
f = RectBivariateSpline(x, y, z) f = RectBivariateSpline(x, y, z)
return f(x_new, y_new) return f(x_new, y_new)
def resample_2d_linear(x, y, z, x_new, y_new):
z_intrp = []
for k in range(z.shape[0]):
z_k = z[k, :, :]
f = interp2d(x, y, z_k)
z_intrp.append(f(x_new, y_new))
return np.stack(z_intrp)
def resample_2d_linear_one(x, y, z, x_new, y_new):
f = interp2d(x, y, z)
return f(x_new, y_new)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment