@@ -131,11 +131,13 @@ def test_scale_range():
131131 )
132132 )
133133
134- exp_data = (np_data - np_data .min ()) / np_data .max ()
134+ mi , ma = np_data .min (), np_data .max ()
135+ exp_data = (np_data - mi ) / (ma - mi )
135136 expected = xr .DataArray (exp_data , dims = ("x" , "y" ))
136137
137138 result = preprocessing (data )
138- xr .testing .assert_allclose (expected , result )
139+ # NOTE xarray.testing.assert_allclose compares irrelavant properties here and fails although the result is correct
140+ np .testing .assert_allclose (expected , result )
139141
140142
141143def test_scale_range_axes ():
@@ -158,11 +160,12 @@ def test_scale_range_axes():
158160
159161 p_low = np .percentile (np_data , min_percentile , axis = (1 , 2 ), keepdims = True )
160162 p_up = np .percentile (np_data , max_percentile , axis = (1 , 2 ), keepdims = True )
161- exp_data = (np_data - p_low ) / p_up
163+ exp_data = (np_data - p_low ) / ( p_up - p_low )
162164 expected = xr .DataArray (exp_data , dims = ("c" , "x" , "y" ))
163165
164166 result = preprocessing (data )
165- xr .testing .assert_allclose (expected , result )
167+ # NOTE xarray.testing.assert_allclose compares irrelavant properties here and fails although the result is correct
168+ np .testing .assert_allclose (expected , result )
166169
167170
168171def test_sigmoid ():
0 commit comments