smerckel / dbdreader

A reader for binary data files created by Slocum ocean gliders (AUVs)
GNU General Public License v3.0
16 stars 14 forks source link

Not raising cache not found error #5

Closed s-pearce closed 2 years ago

s-pearce commented 2 years ago

I tried using dbdreader.MultiDBD reader on a DBD/EBD pair where the dbd file has the cache info in the file, but the ebd file does not (set to transmit only when it has not previously). When I accidentally neglected to point to my cache directory in the inputs, it seemed to read in the pair just fine, but only the dbd parameters showed up; the ebd parameters were not present in data.parameterNames, yet no exception/error was raised. It later raised an error for not finding a science parameter I requested but did not have it available. I expected if it couldn't find the cache file, that it would have raised the dbdreader.DbdError with the dbdreader.DBD_ERROR_CACHE_NOT_FOUND flag. I then tried using dbdreader.DBD to open the ebd file directly without pointing to the cache directory and again it did not throw an error but did not have any parameters available.

I can provide the ebd file without the cache file available if requested to reproduce this scenario, but I would think it would be easy to reproduce.

s-pearce commented 2 years ago

I forgot to mention everything worked fine after I included the cache directory where the cache for that ebd was kept.

smerckel commented 2 years ago

Dear s-pearce, Thank you for reporting this error. I'll look at this shortly.

smerckel commented 2 years ago

Hi s-pearce,

Trying to open a single dbd file using DBD() will immediately throw an exception if the cache file cannot be found, and not wait until it is actually tried to read some parameters. When using MultiDBD, all selected files are checked whether a cache file is available. If not, again an exception is thrown immediately upon construction. I suppose this is the expected behaviour. If it is not, please open the issue again, and a provide an example that shows what goes wrong and how you expect it to be.

Thanks for pointing out this issue.