'Initializes a Data Writer.
Args:
names: Names used to identify the different data components. Will be used
as prefixes for the output files.
output_dir: Directory where the data will be written.
memory: Size of each output chunk.
numdim_list: Number of dimensions in each data component.
datasize: Total number of data vectors that will be written. Having this
number helps to save memory.'

def __init__(self, names, output_dir, memory, numdim_list, datasize=None):

    typesize = 4
    self.typesize = typesize
    self.names = names
    self.output_dir = output_dir
    if (not os.path.isdir(output_dir)):
        os.makedirs(output_dir)
    self.numdim_list = numdim_list
    self.data_len = len(names)
    assert (self.data_len == len(numdim_list))
    numdims = sum(numdim_list)
    total_memory = GetBytes(memory)
    if (datasize is not None):
        total_memory_needed = ((datasize * typesize) * numdims)
        total_memory = min(total_memory, total_memory_needed)
    self.buffer_index = ([0] * self.data_len)
    self.dump_count = ([0] * self.data_len)
    self.data_written = ([0] * self.data_len)
    self.max_dumps = []
    self.buffers = []
    for numdim in numdim_list:
        memory = ((total_memory * numdim) / numdims)
        numvecs = (memory / (typesize * numdim))
        data = np.zeros((numvecs, numdim), dtype='float32')
        self.buffers.append(data)
        if (datasize is not None):
            max_dump = (datasize / numvecs)
            if ((datasize % numvecs) > 0):
                max_dump += 1
            self.max_dumps.append(max_dump)
        else:
            self.max_dumps.append(1)
