From c3266e1957d0362078964add787a28d16e8e13f8 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Tue, 27 Sep 2022 11:13:51 -0500
Subject: [PATCH] snapshot...

---
 modules/util/util.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/util/util.py b/modules/util/util.py
index 06f8eb06..f8269454 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -11,7 +11,7 @@ import h5py
 import pickle
 from netCDF4 import Dataset
 from util.setup import ancillary_path
-from scipy.interpolate import RectBivariateSpline
+from scipy.interpolate import RectBivariateSpline, interp2d
 
 LatLonTuple = namedtuple('LatLonTuple', ['lat', 'lon'])
 
@@ -1397,3 +1397,17 @@ def resample(x, y, z, x_new, y_new):
 def resample_one(x, y, z, x_new, y_new):
     f = RectBivariateSpline(x, y, z)
     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
-- 
GitLab