Annotation in the time-lapse vtk files

Hi Paraview team,

Hope you are doing well.

I am using ParaView for the visualization of around 600 vtk files. Each file belongs to a certain date that the data were collected. When I am looking at the results I expect to have the data of the data as an annotation but I do not know how to do that in ParaView. Could you advise on that?

Annotate Time or PythonAnnotation

Dear Mathieu,

Annotate Time is just giving me the time steps number not the data that I need to see. About PythonAnnotation, I do not know hoe to do that really. In the following you can see the date that I expect to see…


Could you give more details?
Cheers,
Reyhaneh

What data do you want to see ?

Each of the vtk files belongs to a dataset that was collected on a certain date. I need to show the DATE that the data were collected.

/Reyhaneh

please share an example of your data

20191212_180142Local_C.ohm (685.6 KB)
20191220_180143Local_C.ohm (686.3 KB)
20191212_180142Local_C.ohm (685.6 KB)

Here I attached one data set belongs to 2019-12-12 and two vtk files which belong to 2019-12-12 and a day after.

ParaView cannot read .ohm files.

I did confuse you. I sent the data that were collected. I want to show just a series of date in each time step.
For example:
For Time step: 1, I would like to show Date 2019-12-12
For Time step: 2, I would like to show Date 2019-12-18

please share an example .vtk file

It is so large to be uploaded. So you can find it in the following link:

Cheers,
Reyhaneh

I requested access

You have access now. sorry that I did not check sooner …

Hello,

The information you are looking for is not present on your data, so there is nothing ParaView can do.

Best,

If you can prepare a list of time information for each time step, there may be a way to display the time using the Programmable Annotation filter.

In that case, the script in the Programmable Annotation filter would look something like this:

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 = ['20191212_180142','20191220_180143']

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 = 'C:/Users/rccmk/Desktop/dcinv.result/*.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)

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

Are you using the old ParaView? If so, you may need to rewrite the line with the error as follows


arr.InsertNextValue(’Date {}’.format(time_str))

The version that I am using is 5.4.1. I have another error again:

Traceback (most recent call last):
File “”, line 22, in
File “”, line 28, in RequestData
AttributeError: ‘NoneType’ object has no attribute ‘AddColumn’

Sorry for bothering you.
/Reyhaneh

Version 5.4.1. is too old. Please use the latest version.
https://www.paraview.org/download/

Hello again and thanks for your help.

The annotation is working and it looks perfect. I need to take out the median value of the ‘Resistivity/ohmm’ variable now. I know how to do it for Max, Min and Average not for the Median. The filter called ‘Median’ is not active and I know it is not working with this geometry that I have. Could you advise, please?