pysat / pysatCDF

Python reader for NASA CDF file format
BSD 3-Clause "New" or "Revised" License
10 stars 7 forks source link

Update _cdf.py #26

Closed gregstarr closed 3 years ago

gregstarr commented 3 years ago

adding a try/except to _process_return_multi_z_attr when decoding characters so that when uninterpretable characters are encountered, they are just replaced with some filler character but the user can still access the data.

gregstarr commented 3 years ago

Hello, I was trying to read the SWARM level 1 B langmuir probe files (https://swarm-diss.eo.esa.int/#swarm%2FLevel1b%2FLatest_baselines%2FEFIx_LP) and was getting an error. I didn't do a huge amount of investigating, but found that the error was a UnicodeDecodeError which occurred when trying to read the metadata.

Here is a picture of the error:

image

I am proposing the change in this PR because I think even if there are parts of the file that can't be read, the user would still want to read as much as possible. I noticed that when I paused at the error, all the actual numerical data had been loaded already, I was just missing the metadata. With the changes in this PR, I was able to read the file, pictured below:

image

rstoneback commented 3 years ago

Hi @gregstarr! Thanks for reporting an issue and especially for putting forward a fix.

Can you update the pull to target the develop branch?

I'm a bit tied up with the start of the year but I have this down to test out this coming week. Cheers.

gregstarr commented 3 years ago

Oh, crap I should have done this off of develop, my bad. I'm not sure I want to mess with rebasing. I think I will just make a new PR

see: #28