コード例 #1
0
    def test_encode_uint16(self):
        data, meta = data_io.read(self.fname16)

        data_comp = jls.encode(data)

        msg = 'oops size={:d}'.format(data_comp.size)
        self.assertTrue(data_comp.size < 2740000, msg)
コード例 #2
0
    def test_encode_band_resid(self):
        data, meta = data_io.read(self.fname_resid)

        data = data.squeeze()
        data_comp = jls.encode(data)

        msg = 'oops size={:d}'.format(data_comp.size)
        self.assertTrue(data_comp.size < 24000, msg)
コード例 #3
0
    def test_encode_to_file(self):
        data, meta = data_io.read(self.fname)

        fname_temp = os.path.join(self.path_module, 'data_temp.jls')
        jls.write(fname_temp, data)

        file_size = os.path.getsize(fname_temp)
        msg = 'oops file_size={:d}'.format(file_size)
        self.assertTrue(file_size < 2090000, msg)
コード例 #4
0
    def test_encode_decode_compare_uint8(self):
        data, meta = data_io.read(self.fname)

        # Compress, decompress.
        data_comp = jls.encode(data)

        data_image = jls.decode(data_comp)

        diff = np.sum( (data.squeeze().astype(np.int) - data_image.astype(np.int))**2)
        self.assertTrue(diff == 0)
コード例 #5
0
    def test_read_header(self):
        data, meta = data_io.read(self.fname)
        data_comp = jls.encode(data)

        header = jls.CharLS._CharLS.read_header(data_comp)

        self.assertTrue(header['width'] == 2592)
        self.assertTrue(header['height'] == 1944)
        self.assertTrue(header['bitspersample'] == 8)
        self.assertTrue(header['bytesperline'] == 2592)
        self.assertTrue(header['components'] == 1)
        self.assertTrue(header['allowedlossyerror'] == 0)
        self.assertTrue(header['ilv'] == 0)