Skip to content

Commit 529bb56

Browse files
Update scale_range test
1 parent 570b6bc commit 529bb56

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/prediction_pipeline/test_preprocessing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ def test_scale_range():
131131
)
132132
)
133133

134+
eps = 1.0e-6
134135
mi, ma = np_data.min(), np_data.max()
135-
exp_data = (np_data - mi) / (ma - mi)
136+
exp_data = (np_data - mi) / (ma - mi + eps)
136137
expected = xr.DataArray(exp_data, dims=("x", "y"))
137138

138139
result = preprocessing(data)
@@ -158,9 +159,10 @@ def test_scale_range_axes():
158159
)
159160
)
160161

162+
eps = 1.0e-6
161163
p_low = np.percentile(np_data, min_percentile, axis=(1, 2), keepdims=True)
162164
p_up = np.percentile(np_data, max_percentile, axis=(1, 2), keepdims=True)
163-
exp_data = (np_data - p_low) / (p_up - p_low)
165+
exp_data = (np_data - p_low) / (p_up - p_low + eps)
164166
expected = xr.DataArray(exp_data, dims=("c", "x", "y"))
165167

166168
result = preprocessing(data)

0 commit comments

Comments
 (0)