I have a following python script to take the time-average of XDMF file, which works completely fine with my MacBook Pro.
#### import the simple module from the paraview
from paraview.simple import *
from pathlib import Path
import argparse
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
def parse_command_line_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument("--input_path", type=str, required=True)
return parser.parse_args()
def compute_time_average(input_path):
print(" -- Reading file: ", input_path)
xdmf_file = XDMFReader(FileNames=[input_path])
print(" -- File read successfully")
# create a new 'Temporal Statistics'
print(" -- Computing time average")
temporalStatistics1 = TemporalStatistics(registrationName='TemporalStatistics1', Input=xdmf_file)
# Properties modified on temporalStatistics1
temporalStatistics1.ComputeMinimum = 0
temporalStatistics1.ComputeMaximum = 0
temporalStatistics1.ComputeStandardDeviation = 0
output_path = input_path.replace('.xdmf', '_time_average.vtu')
# save data
SaveData(output_path, proxy=temporalStatistics1, DataMode='Ascii')
print(" -- Time average computed successfully and saved to: ", output_path)
# delete objects
del xdmf_file
del temporalStatistics1
def main():
args = parse_command_line_args()
compute_time_average(args.input_path)
if __name__ == "__main__":
main()
However, when I use this on the cluster, some files cannot be read with the following message.
A few files were fine, but most of the files throw the same error message. I opened up .vtu
file and checked the number of components, but cannot really find any problem.
ERROR: In /opt/glr/paraview/paraview-ci/build/superbuild/paraview/src/VTK/IO/XML/vtkXMLDataReader.cxx, line 410
vtkXMLUnstructuredGridReader (0x167254170): Cannot read point data array "displacement_25_to_1000_amplitude_average" from PointData in piece 0. The data array in the element may be too short.
In this google drive, you can find working and not-working VTU files.
https://drive.google.com/drive/folders/1-UU466lmmwOG1ep98IoN6Jcr0Edz8veR?usp=sharing