Hello,
Many thanks for your help.
I am using the following script:
import glob
import os
def GetUpdateTimestep(algorithm):
“”“Returns the requested time value, or None if not present”""
executive = algorithm.GetExecutive()
outInfo = executive.GetOutputInformation(0)
return outInfo.Get(executive.UPDATE_TIME_STEP())
if outInfo.Has(executive.UPDATE_TIME_STEP()) else None
time_list=[‘20191220_180143’,‘20191227_180143’,‘20200103_180143’,‘20200110_180143’,‘20200117_180143’,‘20200124_180144’,‘20200131_180144’,‘20200207_180143’,‘20200214_180143’,‘20200221_180143’,‘20200228_180143’,‘20200306_180143’,‘20200313_180143’,‘20200320_180142’,‘20200327_180141’,‘20200403_180142’,‘20200410_180143’,‘20200417_180142’,‘20200423_180143’,‘20200501_180143’,‘20200508_180143’,‘20200515_180143’,‘20200521_180143’,‘20200529_180143’,‘20200605_180143’,‘20200612_180142’,‘20200619_180142’,‘20200626_180140’,‘20200703_180141’,‘20200710_180141’,‘20200716_180141’,‘20200724_180141’,‘20200731_180141’,‘20200807_180140’,‘20200814_180140’,‘20200821_180140’,‘20200828_180140’,‘20200904_180140’,‘20200911_180141’,‘20200918_180141’,‘20200925_180141’,‘20201002_180141’,‘20201009_180143’,‘20201127_180144’,‘20201204_180140’,‘20201211_180142’,‘20201218_180142’,‘20201225_180143’,‘20210101_180143’,‘20210108_180143’,‘20210115_180144’,‘20210122_180144’,‘20210129_180144’]
time_step = int(GetUpdateTimestep(self))
time_str = time_list[time_step]
This is for getting time information from a file name
Need to change your working folder name
#path = ‘/lunarc/nobackup/projects/snic2020-12-6/Inversion_RealData/WeeklyData/FirstRound/runLong_L1_RobustData_MemoryRobust/data/*.ohm’
#ohms = sorted(glob.glob(path))
#time = os.path.splitext(os.path.basename(ohms[time_step]))[0]
#time_str = time.replace(‘Local_C’, ‘’)
to = self.GetTableOutput()
arr = vtk.vtkStringArray()
arr.SetName(“Text”)
arr.SetNumberOfComponents(1)
arr.InsertNextValue(f’Date {time_str}’)
to.AddColumn(arr)
But I am getting the folloiwing error:
File “”, line 27
arr.InsertNextValue(f’Date {time_str}’)
^
SyntaxError: invalid syntax
Traceback (most recent call last):
File “”, line 22, in
NameError: name ‘RequestData’ is not defined
Could you advise?
Cheers,
Reyhaneh