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

Problem loading Rosetta RPC-MIP data file #32

Closed msbentley closed 2 years ago

msbentley commented 2 years ago

I am trying to load this product:

http://archives.esac.esa.int/psa/ftp/INTERNATIONAL-ROSETTA-MISSION/RPCMIP/RO-C-RPCMIP-5-EXT3-V1.0/DATA/DERIVED/2016/09/RPCMIPS5DXX1609250000_01439.LBL

I have the .LBL, .TAB and .FMT files in the same directory, but am getting:

In [1]: import pdr
In [2]: data = pdr.read('RPCMIPS5DXX1609250000_01439.LBL')
In [3]: data.keys()
Out[3]:
['LABEL',
 'DENSITY_TABLE',
 'RPC_SCIENCE_USAGE_DESC',
 'RPCMIP_SCIENCE_USAGE_DESC']
In [4]: data.DENSITY_TABLE
/Users/mbentley/Library/CloudStorage/OneDrive-ESA/software/pds/pdr/pdr/pdr.py:459: UserWarning: Unable to load DENSITY_TABLE: 'tuple' object has no attribute 'items'
  warnings.warn(f"Unable to load {​​​​​​​​object_name}​​​​​​​​: {​​​​​​​​ex}​​​​​​​​")
Out[4]: <MultiDict('NAME': 'DENSITY', 'INTERCHANGE_FORMAT': 'ASCII', 'ROWS': 2597, 'COLUMNS': 11, 'ROW_BYTES': 128, '^STRUCTURE': 'MIP_DENSITY.FMT')>

Note that this could be a product error or user error instead of PDR; apologies if so!

Sierra-MC commented 2 years ago

Hi Mark,

It's not just you! We found this bug as well and have already implemented a fix. I'm currently testing to make sure we didn't break anything else unintentionally and am hoping to have it merged down by the end of the day. I'll update here when that's done.

msbentley commented 2 years ago

Fantastic, thanks for the super speedy response!

Sierra-MC commented 2 years ago

Sorry for the delay. The changes have been tested and pushed on github. The PyPI and conda installs will be updated soon.

msbentley commented 2 years ago

Great, thanks @Sierra-MC - looks good!

In [1]: import pdr

In [2]: data = pdr.read('RPCMIPS5DXX1609250000_01439.LBL')

In [3]: data
Out[3]:
pdr.Data(/Users/mbentley/Desktop/mip/RPCMIPS5DXX1609250000_01439.LBL)
keys=['LABEL', 'DENSITY_TABLE', 'RPC_SCIENCE_USAGE_DESC', 'RPCMIP_SCIENCE_USAGE_DESC']
not yet loaded: ('LABEL', 'DENSITY_TABLE', 'RPC_SCIENCE_USAGE_DESC', 'RPCMIP_SCIENCE_USAGE_DESC')

In [4]: data.DENSITY_TABLE
Out[4]:
     ELECTRON_DENSITY_UTC_TIME  DELTA_TIME  ELECTRON_DENSITY  UNCERTAINTY_ELECTRON_DENSITY  QUALITY_SNR  QUALITY_SPECTRUM  DETECTION_RATE        SPECTRUM_UTC_TIME INSTRUMENT_MODE TRANSMISSION_LEVEL       TMRATE
0      2016-09-25T00:00:23.499       2.875            101.57                         25.81         0.49               1.0            1.00  2016-09-25T00:00:20.624       SDL_Phase               FULL  Normal rate
1      2016-09-25T00:00:55.499       2.875            113.10                         36.71         0.46               1.0            1.00  2016-09-25T00:00:52.624       SDL_Phase               FULL  Normal rate
2      2016-09-25T00:01:27.499       2.875            117.89                         32.65         0.49               1.0            0.88  2016-09-25T00:01:24.624       SDL_Phase               FULL  Normal rate
3      2016-09-25T00:01:59.499       2.875            113.10                         39.08         0.45               1.0            0.88  2016-09-25T00:01:56.624       SDL_Phase               FULL  Normal rate
4      2016-09-25T00:02:31.500       2.875             97.13                         38.41         0.52               1.0            0.78  2016-09-25T00:02:28.625       SDL_Phase               FULL  Normal rate
...                        ...         ...               ...                           ...          ...               ...             ...                      ...             ...                ...          ...
2592   2016-09-25T23:57:43.528       2.875            227.69                        109.22         0.78               1.0            1.00  2016-09-25T23:57:40.653       SDL_Phase               FULL  Normal rate
2593   2016-09-25T23:58:15.528       2.875            246.54                         76.94         0.86               1.0            1.00  2016-09-25T23:58:12.653       SDL_Phase               FULL  Normal rate
2594   2016-09-25T23:58:47.528       2.875            243.06                        121.53         0.73               1.0            1.00  2016-09-25T23:58:44.653       SDL_Phase               FULL  Normal rate
2595   2016-09-25T23:59:19.528       2.875            282.76                        168.53         0.84               1.0            1.00  2016-09-25T23:59:16.653       SDL_Phase               FULL  Normal rate
2596   2016-09-25T23:59:51.528       2.875            229.37                        111.31         0.10               1.0            1.00  2016-09-25T23:59:48.653       SDL_Phase               FULL  Normal rate

[2597 rows x 11 columns]