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

Unable to load IMAGE: 'BAND_STORAGE_TYPE' #35

Closed msbentley closed 1 year ago

msbentley commented 1 year ago

I am trying to load this Rosetta/OSIRIS NAC image:

https://archives.esac.esa.int/psa/ftp/INTERNATIONAL-ROSETTA-MISSION/OSINAC/RO-C-OSINAC-5-EXT3-67P-M31-GEO-V1.0/DATA/IMG/N20160702T014008820ID50F27.IMG

and get the warning below:

In [1]: import pdr

In [2]: nac = pdr.read('N20160702T014008820ID50F27.IMG')

In [3]: nac
Out[3]:
pdr.Data(/Users/mbentley/Downloads/N20160702T014008820ID50F27.IMG)
keys=['LABEL', 'IMAGE', 'DISTANCE_IMAGE', 'EMISSION_ANGLE_IMAGE', 'INCIDENCE_ANGLE_IMAGE', 'PHASE_ANGLE_IMAGE', 'FACET_INDEX_IMAGE', 'COORDINATE_X_IMAGE', 'COORDINATE_Y_IMAGE', 'COORDINATE_Z_IMAGE', 'HISTORY']
not yet loaded: ('LABEL', 'IMAGE', 'DISTANCE_IMAGE', 'EMISSION_ANGLE_IMAGE', 'INCIDENCE_ANGLE_IMAGE', 'PHASE_ANGLE_IMAGE', 'FACET_INDEX_IMAGE', 'COORDINATE_X_IMAGE', 'COORDINATE_Y_IMAGE', 'COORDINATE_Z_IMAGE', 'HISTORY')

In [4]: nac.IMAGE
/Users/mbentley/miniconda3/envs/pdr/lib/python3.10/site-packages/pdr/pdr.py:489: UserWarning: Unable to load IMAGE: 'BAND_STORAGE_TYPE'
  warnings.warn(f"Unable to load {object_name}: {ex}")
Out[4]: <MultiDict('INTERCHANGE_FORMAT': 'BINARY', 'LINE_SAMPLES': 512, 'LINES': 512, 'BANDS': 1, 'SAMPLE_TYPE': 'PC_REAL', 'SAMPLE_BITS': 32, 'UNIT': 'W/M**2/SR/NM', 'DERIVED_MINIMUM': 0, 'DERIVED_MAXIMUM': 4.42328e-05, 'LINE_DISPLAY_DIRECTION': 'DOWN', 'SAMPLE_DISPLAY_DIRECTION': 'LEFT', 'FIRST_LINE': 1, 'FIRST_LINE_SAMPLE': 1)>

As ever, please don't discount user error, but it would be great to know if this is an issue with pdr, or an unsupported feature, or something else... Thanks once again!!

cmillion commented 1 year ago

I'm just acknowledging that we've seen this.

m-stclair commented 1 year ago

This should be addressed in 5f6a481297f78b519a23450d14daa4c5641dea5c (currently only on the develop branch). I think these labels are technically noncompliant, although not in a very significant way: when the BANDS keyword is present, the BAND_STORAGE_TYPE keyword should also be present. In this case, of course, it doesn't actually matter. Since the images are 2D, the BANDS keyword can simply be ignored, which is what pdr does now when encountering an array with BANDS=1.

msbentley commented 1 year ago

Thanks @m-stclair with that change pdr works perfectly!