I have a NetCDF file with multiple time points in it and I program in vtk python. After loading the NetCDF file in paraview, I am able to navigate through all the available time points without any delay. However, I am not able to achieve the same performance in vtk. All I want is to switch the scalar array for which I am using the following statement.
timestep = 162152 reader.GetOutputInformation(0).Set(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_TIME_STEP(), timestep )
After issuing this statement, if I try to get the output from the netCDF reader, I am able to get the new scalar array for the time step 162152, but I have a performance issue in vtk because I always render the scalar data on a surface generated from the netCDF file. (code below)
reader = vtk.vtkNetCDFCFReader() reader.SetFileName(filePath) reader.UpdateMetaData() reader.SphericalCoordinatesOn() reader.ReplaceFillValueWithNanOn() reader.Update() cellDataToPointData = vtk.vtkCellDataToPointData() cellDataToPointData.SetInputData(reader.GetOutput()) cellDataToPointData.ProcessAllArraysOn() cellDataToPointData.PassCellDataOn() goemetryFilter = vtk.vtkGeometryFilter() goemetryFilter.SetInputConnection(cellDataToPointData.GetOutputPort()) goemetryFilter.Update() self.mapper = vtk.vtkPolyDataMapper() self.mapper.SetInputData(goemetryFilter.GetOutput()) self.mapper.GetInput().GetPointData().SetActiveScalars("elevation") self.mapper.SetColorModeToMapScalars() self.mapper.ScalarVisibilityOn() self.mapper.Update()
I am now wondering how paraview is able to switch different time steps so fast and what should I do to quickly switch scalars in vtk-python for the above code? Any input on this is greatly appreciated. Thanks in advance!