Hello,
I am working on developing a library of all possible combinations of wave heights, periods, directions, and water levels for a coastal domain. For this, I have set up a small python script that writes and executes TOMAWAC for a large number of discrete combinations of above variables. In the end, I have something like 2000 results files in one directory, all numbered 0001_name.slf, 0002_name.slf, ... 2000_name.slf. Each result file has the same geometry, variable names, number of time steps, etc.
What I wish to do is take the last record of each result file (for every variable), and store it into one master *.slf file. I am envisioning this master *.slf file will be used by t2d-sis coupling to read appropriate wave results in morphological simulations.
The pseudo code for this concatenation would be something like:
open each result file
--> go to last time record
--> read results for all variables
--> add a time record to master file, and append results to master file
close each result file
Can someone help in getting me get started on this? My knowledge of PYTHON is limited to rudimentary reading and processing of *.slf result files. I guess I am after the names of methods (or functions) which can be used to accomplish the above.
Thank you in advance,
Pat