polyfemos.scripts.check_output_files¶
A command line script to check polyfemos output files.
- copyright
2019, University of Oulu, Sodankyla Geophysical Observatory
- license
GNU Lesser General Public License v3.0 or later (https://spdx.org/licenses/LGPL-3.0-or-later.html)
Public Functions
-
polyfemos.scripts.check_output_files.check_csv_file(filename, value_checks=[], valid_header=[])[source]¶ Function to verify the ‘*.alert’ and ‘*.csv’ files. The format of such files is described in Alert file Format and State of health CSV Format.
- Parameters
filename (str) – path to a file to be checked
value_checks (list, optional) – a list passed to
check_row()valid_header (list, optional) – a reference header used to verify the file header. See
check_header()for more info.
-
polyfemos.scripts.check_output_files.check_header(header, valid_header)[source]¶ Checks if two lists of strings are identical using using
re.compile()andre.match()functions. Asterisk (‘*’) can be used to match any number of any characters.
-
polyfemos.scripts.check_output_files.check_row(row, value_checks)[source]¶ - Parameters
row (list) – a list of values
value_checks (list) – a list of list, each nested list should consist of integer, function and a message string. The integer describes if the value in
rowis optional. The function is used to verify the value. If the function returnsNone, the value had some problems and the message is used to describe the problem.
- Return type
- Returns
Error message if the given row does not match the criteria. If an empty string is returned, the
rowis ok.
-
polyfemos.scripts.check_output_files.check_stf_file(filename)[source]¶ Function to verify the ‘*.stf’ files. The format of such files is described in Sohtextfile Format.
- Parameters
filename (str) – path to ‘*.stf’ file to be checked
-
polyfemos.scripts.check_output_files.main(argv=None)[source]¶ Recursively checks folders for polyfemos output files and check the validity of the files. If the exact file is given, only the given file is checked.
If a single path to a directory is given, the directory is recursively checked for files with given extension.
Wild cards in path can be used to give a list of paths.
Printed row/line and column indices start at 0.
- Parameters
argv (list) – command line arguments