Skip to content

Commit 20eb3f5

Browse files
author
cpelley
committed
TEST: Added non-equally spaced coordinate test
1 parent 44edf42 commit 20eb3f5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

stratify/tests/test_bounded_vinterp.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ def test_target_extends_above_source(self):
6565
target_data[:, -1] = 0
6666
assert_array_equal(res, target_data)
6767

68+
def test_target_extends_above_source_non_equally_spaced_coords(self):
69+
# |--|--|-------|| - Source
70+
# |-|-|-|-|-|-|-|-| - Target
71+
source_bounds = np.array([[0, 1.5], [1.5, 2], [2, 6], [6, 6.5]])
72+
target_bounds = self.gen_bounds(0, 8, 1)
73+
data = np.ones((4, 4))
74+
res = bounded_vinterp.interpolate_conservative(target_bounds,
75+
source_bounds, data,
76+
axis=1)
77+
target_data = np.array(
78+
[1/1.5, 1 + ((1/3.)/1), 0.25, 0.25, 0.25, 0.25, 1.])[None]
79+
target_data = np.repeat(target_data, 4, 0)
80+
assert_array_equal(res, target_data)
81+
6882
def test_target_extends_below_source(self):
6983
# |-|-|-|-|-|-|-| - Source
7084
# |-|-|-|-|-|-|-|-| - Target

0 commit comments

Comments
 (0)