PlotJuggler icon indicating copy to clipboard operation
PlotJuggler copied to clipboard

CSV: Add option to skip invalid rows

Open Jofkos opened this issue 1 year ago • 2 comments

CSV files may contain invalid rows (i.e., rows that have the wrong number of columns). In some cases, those are not expected and thus not loading the entire file (and displaying a warning) may make sense. This is what is currently done. In other cases, however, due to how the CSV files are generated, invalid rows may be expected and still being able to load such a file without having to first manually remove them would thus be helpful.

This pull request does exactly that: It adds a checkbox to just ignore rows which don't have as many values as there are columns. It is unchecked by default, preserving the current behaviour.

Screenshot 2024-04-01 at 16 26 57

Jofkos avatar Apr 01 '24 14:04 Jofkos

I wonder who wants to load a corrupted CSV...

facontidavide avatar Apr 22 '24 17:04 facontidavide

I made that change because it is useful.

Here's one use-case: A CSV gets written to by an application which is connected to a physical instrument. You don't want to stop the experiment, but want to quickly inspect the data as it is running. When you grab the CSV file, the last line is incomplete. Sure, this is not a problem: just delete the last line. When you have to do this multiple times a day, having the ability to just drag in the files rather than having to open them in a separate application first is a big win.

Here's another one: Some process may just generate CSV where some lines are incomplete. This could be because of fickle communication, interference or a non-prioritized telemetry printing being interrupted improperly. Just because that's the case, does that mean the telemetry that does get through is worthless?

Jofkos avatar Apr 22 '24 18:04 Jofkos