planetarypy / planetaryimage

Python PDS and Isis Cube file parser.
BSD 3-Clause "New" or "Revised" License
40 stars 20 forks source link

Error on opening files from New Horizons MVIC data #79

Open alemran042 opened 3 years ago

alemran042 commented 3 years ago

I have been trying to read images from New Horizons MVIC data on a Linux OS (Ubuntu 20.04.2 LTS). I tried both adding .img and .lbl file but neither worked. Below the error:

from planetaryimage import PDS3Image image = PDS3Image.open('....\mvic_0299178092_0x536_sci_pl.img')

or

image = PDS3Image.open('....\mvic_0299178092_0x536_sci_pl.lbl')

----------------------------for img file-------------------------------- KeyError Traceback (most recent call last)

in 1 from planetaryimage import PDS3Image ----> 2 image = PDS3Image.open('mvic_0299178092_0x536_sci_pl.img') ~/anaconda3/lib/python3.7/site-packages/planetaryimage/image.py in open(cls, filename) 35 else: 36 with open(filename, 'rb') as fp: ---> 37 return cls(fp, filename) 38 39 def __init__(self, stream_string_or_array, filename=None, compression=None): ~/anaconda3/lib/python3.7/site-packages/planetaryimage/image.py in __init__(self, stream_string_or_array, filename, compression) 75 76 #: A numpy array representing the image ---> 77 self.data = self._load_data(stream_string_or_array) 78 79 def __repr__(self): ~/anaconda3/lib/python3.7/site-packages/planetaryimage/image.py in _load_data(self, stream) 156 157 def _load_data(self, stream): --> 158 if self.data_filename is not None: 159 return self._load_detached_data() 160 ~/anaconda3/lib/python3.7/site-packages/planetaryimage/image.py in data_filename(self) 130 def data_filename(self): 131 """Return detached filename else None.""" --> 132 return self._data_filename 133 134 @property ~/anaconda3/lib/python3.7/site-packages/planetaryimage/pds3image.py in _data_filename(self) 300 @property 301 def _data_filename(self): --> 302 return self._image_pointer.filename 303 304 @property ~/anaconda3/lib/python3.7/site-packages/planetaryimage/pds3image.py in _image_pointer(self) 313 @property 314 def _image_pointer(self): --> 315 return Pointer.parse(self.label['^IMAGE'], self.record_bytes) 316 317 @property ~/anaconda3/lib/python3.7/site-packages/pvl/collections.py in __getitem__(self, key) 173 if isinstance(key, (int, slice)): 174 return self.__items[key] --> 175 return dict_getitem(self, key)[0] 176 177 def __delitem__(self, key): KeyError: '^IMAGE' ----------------------------for lbl file------------------------------------ FileNotFoundError Traceback (most recent call last) in 1 from planetaryimage import PDS3Image ----> 2 image = PDS3Image.open('mvic_0299178092_0x536_sci_pl.lbl') ~/anaconda3/lib/python3.7/site-packages/planetaryimage/image.py in open(cls, filename) 35 else: 36 with open(filename, 'rb') as fp: ---> 37 return cls(fp, filename) 38 39 def __init__(self, stream_string_or_array, filename=None, compression=None): ~/anaconda3/lib/python3.7/site-packages/planetaryimage/image.py in __init__(self, stream_string_or_array, filename, compression) 75 76 #: A numpy array representing the image ---> 77 self.data = self._load_data(stream_string_or_array) 78 79 def __repr__(self): ~/anaconda3/lib/python3.7/site-packages/planetaryimage/image.py in _load_data(self, stream) 157 def _load_data(self, stream): 158 if self.data_filename is not None: --> 159 return self._load_detached_data() 160 161 stream.seek(self.start_byte) ~/anaconda3/lib/python3.7/site-packages/planetaryimage/image.py in _load_detached_data(self) 172 filename = os.path.abspath(os.path.join(dirpath, self.data_filename)) 173 --> 174 with open(filename, 'rb') as stream: 175 return self._decode(stream) FileNotFoundError: [Errno 2] No such file or directory: '/home/emran/SPAC/Pluto/New Horizons/copied file/Pluto Encounter Surface Composition/data/color/MVIC_0299178092_0X536_SCI_PL.IMG'
cmillion commented 3 years ago

Nobody is actively maintaining this project anymore. I suggest that you try to read the data with pdr. https://github.com/millionconcepts/pdr

If it doesn't work please file an issue there with the error output and the full URL to the data on the PDS, and I'll try to fix it.