def append(self, key, data):
        """
        Append the given data to the data that already exists
        in the container for the given key.
        Only data with equal dimensions (except the first) are allowed,
        since they are concatenated/stacked along the first dimension.

        Args:
            key (str): Key to store data for.
            data (numpy.ndarray): Array-like data.
                                  Has to have the same dimension as
                                  the existing data after the first dimension.

        Note:
            The container has to be opened in advance.
            For appending to existing data the HDF5-Dataset has to be chunked,
            so it is not allowed to first add data via ``set``.
        """
        existing = self.get(key, mem_map=True)

        if existing is not None:
            num_existing = existing.shape[0]

            if existing.shape[1:] != data.shape[1:]:
                error_msg = (
                    'The data to append needs to'
                    'have the same dimensions ({}).'
                )
                raise ValueError(error_msg.format(existing.shape[1:]))

            existing.resize(num_existing + data.shape[0], 0)
            existing[num_existing:] = data
        else:
            max_shape = list(data.shape)
            max_shape[0] = None

            self._file.create_dataset(key, data=data,
                                      chunks=True, maxshape=max_shape)
def append ( self , key , data ) : existing = self . get ( key , mem_map = True ) if existing is not None : num_existing = existing . shape [ 0 ] if existing . shape [ 1 : ] != data . shape [ 1 : ] : error_msg = ( 'The data to append needs to' 'have the same dimensions ({}).' ) raise ValueError ( error_msg . format ( existing . shape [ 1 : ] ) ) existing . resize ( num_existing + data . shape [ 0 ] , 0 ) existing [ num_existing : ] = data else : max_shape = list ( data . shape ) max_shape [ 0 ] = None self . _file . create_dataset ( key , data = data , chunks = True , maxshape = max_shape )
Append the given data to the data that already exists
        in the container for the given key.
        Only data with equal dimensions (except the first) are allowed,
        since they are concatenated/stacked along the first dimension.

        Args:
            key (str): Key to store data for.
            data (numpy.ndarray): Array-like data.
                                  Has to have the same dimension as
                                  the existing data after the first dimension.

        Note:
            The container has to be opened in advance.
            For appending to existing data the HDF5-Dataset has to be chunked,
            so it is not allowed to first add data via ``set``.