lkilcher / dolfyn

A library for oceanographic doppler instruments such as Acoustic Doppler Profilers (ADPs, ADCPs) and Acoustic Doppler Velocimeters (ADVs).
BSD 3-Clause "New" or "Revised" License
42 stars 25 forks source link

All read errors become "Unable to find a suitable reader..." #72

Closed lkilcher closed 2 years ago

lkilcher commented 2 years ago

When using the dolfyn.read function, anytime there is an error in one of the read subroutines (i.e., read_nortek, read_signature, or read_rdi) the try...catch block of the dolfyn.read function turns this into the error defined there. This really creates headaches for debugging read issues.

Previously I'd defined a WrongFileType Exception that was the first error to be raised when one of those functions tried to read a file that didn't match what it expected. This wasn't the most elegant solution for many reasons, but it was better than what we have now.

The other simple fix would be to map file-extensions to a reader (e.g., {read_signature: ['.ad2cp'], read_rdi: ['.pd0', '.###', ], ...}) but that has the problems of: a) needing to parse RDI .### file names somehow, and b) needing to maintain the list of file-extensions as it evolves.

@jmcvey3 - thoughts on how to deal with this?

lkilcher commented 2 years ago

This was resolved by #75