Exemplo n.º 1
0
    def test_rate_of_change(self):
        times = self.times
        arr = [
            2, 10, 2.1, 3, 4, 5, 7, 10, 0, 2, 2.2, 2, 1, 2, 3, 90, 91, 92, 93,
            1, 2, 3, 4, 5
        ]
        expected = [
            1, 3, 3, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1,
            1, 1
        ]
        inputs = [
            arr,
            np.asarray(arr, dtype=np.floating),
            dask_arr(np.asarray(arr, dtype=np.floating))
        ]
        for i in inputs:
            result = qartod.rate_of_change_test(inp=i,
                                                tinp=times,
                                                threshold=self.threshold)
            npt.assert_array_equal(expected, result)

        # test epoch secs - should return same result
        npt.assert_array_equal(
            qartod.rate_of_change_test(inp=i,
                                       tinp=self.times_epoch_secs,
                                       threshold=self.threshold), expected)
Exemplo n.º 2
0
 def test_rate_of_change_negative_values(self):
     times = self.times[0:4]
     arr = [-2, -10, -2, -3]
     expected = [1, 3, 3, 1]
     result = qartod.rate_of_change_test(inp=arr,
                                         tinp=times,
                                         threshold=self.threshold)
     npt.assert_array_equal(expected, result)
Exemplo n.º 3
0
 def test_rate_of_change_missing_values(self):
     times = self.times[0:8]
     arr = [2, 10, 2, 3, None, None, 7, 10]
     expected = [1, 3, 3, 1, 9, 9, 1, 1]
     result = qartod.rate_of_change_test(inp=arr,
                                         tinp=times,
                                         threshold=self.threshold)
     npt.assert_array_equal(expected, result)