From 0002e702f0ec317cf2bb57e2efc92b31cda08b9e Mon Sep 17 00:00:00 2001
From: Dan Lipsa <dan.lipsa@kitware.com>
Date: Tue, 18 Feb 2025 16:07:47 -0500
Subject: [PATCH] Add testing for time.

---
 IO/NetCDF/Testing/Python/NetCDFCFSphericalCoords.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/IO/NetCDF/Testing/Python/NetCDFCFSphericalCoords.py b/IO/NetCDF/Testing/Python/NetCDFCFSphericalCoords.py
index 07e8805968f..4deb5bde547 100755
--- a/IO/NetCDF/Testing/Python/NetCDFCFSphericalCoords.py
+++ b/IO/NetCDF/Testing/Python/NetCDFCFSphericalCoords.py
@@ -1,5 +1,6 @@
 #!/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()
-- 
GitLab