Skip to content
Snippets Groups Projects
Commit 0002e702 authored by Dan Lipsa's avatar Dan Lipsa
Browse files

Add testing for time.

parent 08c4412e
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
from GetReader import get_reader
from vtkmodules.vtkCommonExecutionModel import vtkStreamingDemandDrivenPipeline
from vtkmodules.vtkFiltersCore import (
vtkAssignAttribute,
vtkThreshold,
......@@ -23,7 +24,12 @@ VTK_DATA_ROOT = vtkGetDataRoot()
# Open the file.
reader = get_reader(VTK_DATA_ROOT + "/Data/tos_O1_2001-2002.nc")
# Set the arrays we want to load.
reader.UpdateMetaData()
reader.UpdateInformation()
info = reader.GetOutputInformation(0)
assert info.Has(vtkStreamingDemandDrivenPipeline.TIME_STEPS()), "Time dependent dataset does not have TIME_STEPS key"
# the exact times are not the same between NetCDFCF and XArray accessors, because XArray uses
times = info.Get(vtkStreamingDemandDrivenPipeline.TIME_STEPS())
assert len(times) == 24 and (times[23]) - times[0] == (705.0 - 15.0), "Number of time steps or time values are wrong."
reader.SetVariableArrayStatus("tos",1)
reader.SetSphericalCoordinates(1)
aa = vtkAssignAttribute()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment