Replace duplicate acquisitions which have same values on the chosen time scale with their average.
        The average is calculated with numpy.nanmean, meaning that NaN values are ignored when calculating the average.

        :param data: Array in a shape of t x nobs, where nobs = h x w x n
        :type data: numpy.ndarray
        :param times: Array of reference times relative to the first timestamp
        :type times: numpy.array
        :return: cleaned versions of data input
        :rtype: numpy.ndarray
        :return: cleaned versions of times input
        :rtype: numpy.array

def _get_unique_times(data, times):
        """ Replace duplicate acquisitions which have same values on the chosen time scale with their average.
        The average is calculated with numpy.nanmean, meaning that NaN values are ignored when calculating the average.

        :param data: Array in a shape of t x nobs, where nobs = h x w x n
        :type data: numpy.ndarray
        :param times: Array of reference times relative to the first timestamp
        :type times: numpy.array
        :return: cleaned versions of data input
        :rtype: numpy.ndarray
        :return: cleaned versions of times input
        :rtype: numpy.array
        """
        seen = set()
        duplicated_indices = np.array([idx for idx, item in enumerate(times) if item in seen or seen.add(item)],
                                      dtype=int)
        duplicated_times = np.unique(times[duplicated_indices])

        for time in duplicated_times:
            indices = np.where(times == time)[0]
            nan_mask = np.all(np.isnan(data[indices]), axis=0)
            data[indices[0], ~nan_mask] = np.nanmean(data[indices][:, ~nan_mask], axis=0)

        times = np.delete(times, duplicated_indices, axis=0)
        data = np.delete(data, duplicated_indices, axis=0)

        return data, times