Read headed but empty CSV table

The current CSV reader seems to have a limitation. If the table is empty (i.e., consists of just the header with columns names), no table is generated in ParaView. It would be great if the CSV reader created an empty table with header in this case. It seems that this should be possible if a header is provided.

My use case is the following: I read a point cloud from a CSV file series containing x,y,z columns with a header, and then I apply the TableToPoints filter to it. Usually, the first file is an empty table, because particles are produced over time, starting from none. This then produces an error “Failed to locate the columns to use for the point coordinates” in vtkExecutive.cxx, line 730.

1 Like

I agree and that should be pretty simple.

Cool, thanks for looking into this! Would love to see this working soon.

Would love to see this working soon.

Don’t hesitate to contribute to this, time or funding :slight_smile:

I wish I knew how to contribute the code change for this. I’ve spent half a day trying to locate the point in the VTK codebase that would need to be modified, but failed …

VTK/Filters/General/vtkTableToPolyData.cxx

However I see that there is already a check for empty table:

  if (input->GetNumberOfRows() == 0)
  {
    // empty input.
    return 1;
  }

Can you share your empty data and step to reproduce the error ?

Thanks so much, Mathieu. I’m attaching two CSV files, the first one empty, the second one containing 2 points, both having the same header x,y,z. Steps to reproduce in ParaView 5.13.2:

  1. Open the CSV file series. SpreadSheetView1 opens up but shows nothing. TableToPoints filter is grayed out.
  2. Jump from Time 0 to Time 1. TableToPoints becomes available, but SpreadSheetView1 is still empty.
  3. Apply the TableToPoints filter. SpreadSheetView1 shows the two points.
  4. Jump back to Time 0. SpreadSheetView1 shows nothing.
  5. Remove TableToPoints filter.
  6. Apply the TableToPoints filter. Despite being at Time 0, it is available.
  7. Jump to Time 1 → “Failed to locate the columns to use for the point coordinates”, “ERROR: In vtkExecutive.cxx,line 730”

particles0.csv (6 Bytes)
particles1.csv (60 Bytes)

Looks like you found a bug, deleting the TableToPoints should not delete the output of the CSV reader. please open an issue: https://gitlab.kitware.com/paraview/paraview/-/issues

Done: https://gitlab.kitware.com/paraview/paraview/-/issues/22923