def test_condense_to_unity_no_change(self): test_input = numpy.array([0.0, 0.25, 0.5, 0.75, 1.0]) # input should be the same as output actual_output = geotiff.condense_to_unity(test_input) self._assert_numpy_arrays_almost_equal(test_input, actual_output)
def test_condense_to_unity_2d(self): test_input = numpy.array([[0.005, 0.007], [0.0098, 0.005]]) expected_output = numpy.array([[0.0, 0.416666666667], [1.0, 0.0]]) actual_output = geotiff.condense_to_unity(test_input) self._assert_numpy_arrays_almost_equal(expected_output, actual_output)
def test_condense_to_unity_with_min_max(self): test_input = numpy.array([0.4, 0.7, 1.3, 2.2, 4.1]) expected_output = numpy.array([0.0, 0.0, 0.15625, 0.4375, 1.0]) fixed_min_max = (0.8, 4.0) actual_output = geotiff.condense_to_unity(test_input, min_max=fixed_min_max) self._assert_numpy_arrays_almost_equal(expected_output, actual_output)