def write_data_chunk(self, rows, indexes, mask, values):
<EOL>for v in values:<EOL><INDENT>if not np.prod(v.shape):<EOL><INDENT>return<EOL><DEDENT><DEDENT>try:<EOL><INDENT>nrows = indexes[<NUM_LIT:0>].shape[<NUM_LIT:0>]<EOL>if nrows != len(rows):<EOL><INDENT>rows = np.empty(nrows, dtype=self.dtype)<EOL><DEDENT>names = self.dtype.names<EOL>nindexes = len(indexes)<EOL>for i, idx in enumerate(indexes):<EOL><INDENT>rows[names[i]] = idx<EOL><DEDENT>for i, v in enumerate(values):<EOL><INDENT>rows[names[i + nindexes]] = v<EOL><DEDENT>if mask is not None:<EOL><INDENT>m = ~mask.ravel().astype(bool, copy=False)<EOL>if not m.all():<EOL><INDENT>rows = rows[m]<EOL><DEDENT><DEDENT><DEDENT>except Exception as detail:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>".format(detail=detail))<EOL><DEDENT>try:<EOL><INDENT>if len(rows):<EOL><INDENT>self.table.append(rows)<EOL>self.table.flush()<EOL><DEDENT><DEDENT>except Exception as detail:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>".format(<EOL>detail=detail))<EOL><DEDENT>
Parameters
----------
rows : an empty memory space where we are putting the chunk
indexes : an array of the indexes
mask : an array of the masks
values : an array of the values