def packData(dataArray):
            """
            Repacks the terrain data to Mojang's leveldb library's format.
            """
            assert dataArray.shape[2] == self.Height

            data = numpy.array(dataArray).reshape(16, 16, self.Height / 2, 2)
            data[..., 1] <<= 4
            data[..., 1] |= data[..., 0]
            return numpy.array(data[:, :, :, 1])

            Repacks the terrain data to Mojang's leveldb library's format.
            
pymclevel/leveldbpocket.py