MAVENSDC / cdflib

A python module for reading NASA's Common Data Format (cdf) files
MIT License
82 stars 45 forks source link

globalattsget() returns lists for everything, even scalar values #240

Open jameswilburlewis opened 6 months ago

jameswilburlewis commented 6 months ago

I am in the process of updating PySPEDAS and PyTplot to use version 1.0.0 and later of cdflib. One change I've noticed is that globalattsget() now seems to be returning everything as lists, where previously (prior to 1.0.0) it would return scalar values. This causes some PySPEDAS code to break, when it's expecting to extract substrings from a global attribute value, but now gets a list instead of a string.

This is happening in cdflib 1.2.0 and 1.2.6. Prior to upgrading, I think we were using cdflib 0.4.9.

See screenshot below, from a debugging session in PyCharm reading a CDF from MMS. It shows the value of "gatt" just obtained from a call to globalattsget(). You can a lot of attributes are single-element lists....

Screenshot 2024-04-03 at 6 29 41 PM