MillionConcepts / pdr

[P]lanetary [D]ata [R]eader - A single function to read all Planetary Data System (PDS) data into Python
Other
60 stars 6 forks source link

Error reading Rosetta/OSIRIS PDS3 image #5

Closed msbentley closed 3 years ago

msbentley commented 3 years ago

Opening the following Rosetta/OSIRIS PDS3 file (attached label):

https://pds-smallbodies.astro.umd.edu/holdings/ro-c-osinac-4-ext3-67p-m35-reflect-v1.0/data/img/n20160930t103106740id4bf32.img

I get the following:

In [2]: test = pdr.read('N20160930T103106740ID4BF32.IMG')
/home/mbentley/miniconda3/envs/pdr/lib/python3.9/site-packages/rasterio/__init__.py:221: NotGeoreferencedWarning: Dataset has no geotransform set. The identity matrix may be returned.
  s = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-30912628a884> in <module>
----> 1 test = pdr.read('N20160930T103106740ID4BF32.IMG')

~/Dropbox/software/pds/pdr/pdr/__init__.py in read(fp)
     11 
     12 def read(fp):
---> 13     return Data(fp)
     14 
     15 def open(fp):

~/Dropbox/software/pds/pdr/pdr/pdr.py in __init__(self, filename)
    632         setattr(self, "pointers", [k for k in self.LABEL.keys() if k[0] == "^"])
    633         try:
--> 634             _ = [
    635                 setattr(
    636                     self,

~/Dropbox/software/pds/pdr/pdr/pdr.py in <listcomp>(.0)
    636                     self,
    637                     pointer[1:] if pointer.startswith("^") else pointer,
--> 638                     pointer_to_function[pointer](filename, self.LABEL),
    639                 )
    640                 for pointer in self.pointers

KeyError: '^SIGMA_MAP_IMAGE'
msbentley commented 3 years ago

The same data product is also provided in FITS + LBL format:

https://pds-smallbodies.astro.umd.edu/holdings/ro-c-osinac-4-ext3-67p-m35-reflect-v1.0/data/fit/n20160930t103106740id4bf32.fit https://pds-smallbodies.astro.umd.edu/holdings/ro-c-osinac-4-ext3-67p-m35-reflect-v1.0/data/fit/n20160930t103106740id4bf32.lbl

which results in:

In [3]: test = pdr.read('N20160930T103106740ID4BF32.LBL')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-8ed33c5c066e> in <module>
----> 1 test = pdr.read('N20160930T103106740ID4BF32.LBL')

~/Dropbox/software/pds/pdr/pdr/__init__.py in read(fp)
     11 
     12 def read(fp):
---> 13     return Data(fp)
     14 
     15 def open(fp):

~/Dropbox/software/pds/pdr/pdr/pdr.py in __init__(self, filename)
    632         setattr(self, "pointers", [k for k in self.LABEL.keys() if k[0] == "^"])
    633         try:
--> 634             _ = [
    635                 setattr(
    636                     self,

~/Dropbox/software/pds/pdr/pdr/pdr.py in <listcomp>(.0)
    636                     self,
    637                     pointer[1:] if pointer.startswith("^") else pointer,
--> 638                     pointer_to_function[pointer](filename, self.LABEL),
    639                 )
    640                 for pointer in self.pointers

KeyError: '^HEADER'
cmillion commented 3 years ago

Ok. I know what's happening. Will fix.

It's interesting that the same data product is provided as IMG and FITS.

msbentley commented 3 years ago

Great! Most of the glitches I find now seem to be related to pointers - should I hold off until this is addressed?

cmillion commented 3 years ago

Probably best. I'll need to carve out a few hours to dig into that. I hope to do it in the next few days.

msbentley commented 3 years ago

Fine by me - I really appreciate your efforts, and PDS3 data aren't going anywhere :)

cmillion commented 3 years ago

I appreciate your help, too! It's much easier for me to keep momentum with someone to iterate with.

cmillion commented 3 years ago

Ok. All of the weird pointers aren't necessarily supported now, but they are handled in a consistent way such that new pointers should not cause a raise. Unsupported pointers will print a warning note, though. Like "The ARCHIVE_CONTEXT_DESC pointer is not yet fully supported."

msbentley commented 3 years ago

Looks good, thanks!