def __init__(self, level_file):
        self.level_file = level_file
        try:
            self.level_file = nbt.NBTFile(self.level_file, 'rb')
            #do something here to checkout the level file?
        except __HOLE__, err:
            #should probably do something more worthwhile here
            raise err
        self.level_dir = os.path.dirname(level_file)
        self.chunk_files = sorted(
            sorted(
                glob.glob(os.path.join(self.level_dir, '*', '*', 'c.*.*.dat')),
                key=lambda chunk_file: int(os.path.basename(chunk_file).split('.')[1],36)
            ),
            key=lambda chunk_file: int(os.path.basename(chunk_file).split('.')[2],36)
        )
        self.chunk_count = len(self.chunk_files)
        self.level_size = dict({
            'x_min':0,
            'x_max':0,
            'z_min':0,
            'z_max':0,
        })
        chunks_xpos = map(lambda chunk_file: int(os.path.basename(chunk_file).split('.')[1],36), self.chunk_files)
        chunks_zpos = map(lambda chunk_file: int(os.path.basename(chunk_file).split('.')[2],36), self.chunk_files)
        self.level_size['x_min'] = min(chunks_xpos)
        self.level_size['x_max'] = max(chunks_xpos)
        self.level_size['z_min'] = min(chunks_zpos)
        self.level_size['z_max'] = max(chunks_zpos)

        # Make sure that the dimensions of the level provide equal or more chunks
        #  than there are chunk files.
        assert (abs(self.level_size['x_min']) + 1 + self.level_size['x_max']) * \
            (abs(self.level_size['z_min']) + 1 + self.level_size['z_max']) >= \
            self.chunk_count
dataset/ETHPy150Open aheadley/pynemap/pynemap.py/Level.__init__