run_telfile: slow alter feature and heavy memory consumption

Summary

When attempting to modify large files using run_telfile.py alter, the alter function in run_telfile may crash due to excessive memory consumption. This problem is similar to that of the merge function, reported in #1010 (closed) and fixed in 933887a4.

Environment

  • Operating System: all
  • TELEMAC version: V8P5

Steps to reproduce

Run run_telfile.py alter on a very large file, several GB in size, e.g. to change the mesh origin of a huge T2D results file results for the Malpasset case, with a time step of 0.2s:

run_telfile.py alter --orig 953000 149000 r2d-malpasset_huge.slf r2d-malpasset_huge-orig.slf

What is the current bug behaviour?

On Linux, the command would quickly crash with the message "Killed".

What is the expected correct behaviour?

It should work, though slowly for files of several GB.

Relevant logs and/or screenshots

Possible fixes

Use direct I/O access functions, similar to those used in the run_telfile.merge function.

Edited by Boris Basic