Rescuing corrupted IDL .sav files to NetCDF or HDF5

Unfortunately there is some astronomical data out there in proprietary, undocumented .sav files. IDL itself has been buggy in the past for writing .sav.

You can read IDL .sav files from Python using

However, occasionally a corrupted .sav file may throw errors. In my limited trials I’ve found this means you won’t be able to read the .sav file in GDL, either. IDL was able to read the .sav file, so I wrote a one-off IDL script to convert from IDL .sav to NetCDF4 .NC format. I also have code there to convert from IDL .sav to HDF5. 

I also successfully submitted a patch to SciPy to fix some of these IDL .sav reading issues.