def test_pds3_1band_disk_format(pattern_data):
    image = PDS3Image(open(filename, 'rb'), memory_layout='DISK')

    assert image.data.shape == (1, 10, 10)
    assert image.data.size == 100

    assert_almost_equal(image.data[0], pattern_data)
Exemple #2
0
 def __init__(self, filepath):
     pds_date = self._convert_date(filepath)
     print('pds_date:', pds_date)
     jpg_im = Image.open(filepath)
     np_ar = np.asarray(jpg_im)
     dim = np_ar.shape
     new_ar = np.zeros((dim[2], dim[0], dim[1]))
     new_ar[0, :, :] = np_ar[:, :, 0]
     new_ar[1, :, :] = np_ar[:, :, 1]
     new_ar[2, :, :] = np_ar[:, :, 2]
     new_ar = new_ar.astype('>i2')
     self.img = PDS3Image(new_ar)
     self.filename = os.path.splitext(filepath)[0]
     if self._label_file_exists():
         self.img.label = self._update_label(pds_date)
     self.img.save(self.filename + '.IMG')