Everything is working when I load my netCDF file in paraview, wherein I am able to use the time combobox to query the scalars from any timepoint of a selected variable, which has the dimensions - (‘time’, ‘latitude’, ‘longitude’)"
However, when I am trying to read the same netCDF file in VTK, I dont know how to fetch scalars for a specific time dimension.
I have added some sample code below to convey some code information. Anyone knows how and where I can mention a time index in code for displaying the scalar array named “mlotst” ? Could you please point me to some sample code?
# Reader NETCDF
self.main.reader = vtk.vtkNetCDFCFReader()
self.main.reader.SetFileName(self.main.path)
self.main.reader.UpdateMetaData()
self.main.reader.SphericalCoordinatesOn()
self.main.reader.ReplaceFillValueWithNanOn()
self.reader.Update()
cellDataToPointData = vtk.vtkCellDataToPointData()
cellDataToPointData.SetInputData(self.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.SetColorModeToMapScalars()
self.mapper.GetInput().GetPointData().SetActiveScalars("mlotst")
self.mapper.ScalarVisibilityOn()
self.actor = vtk.vtkActor()
self.actor.SetMapper(self.mapper)
self.ren.AddActor(self.actor)
self.ren.ResetCamera()