eturb.util¶
Miscellaneous utilities¶
Functions
Setup environment variables in preparation for Nek5000 build. |
|
|
Creates a parameter instance and generate formatted docs for it. |
|
Get status of a simulation run by verifying its contents. |
|
Instantiate an isolated |
|
Returns timestamp in modified isoformat from a datetime object (- instead of :). |
|
Find the last modified file in a directory tree. |
|
Modification date of a file or directory. |
|
The current timestamp. |
|
Takes a directory in which a simulation was executed. |
|
Recursively yield DirEntry objects for given directory. |
|
Contents of a tar file. |
|
Modification date of a file or directory as a timestamp. |
|
Contents of a zip file. |
-
eturb.util.
docstring_params
(Class, sections=False, indent_len=4)[source]¶ Creates a parameter instance and generate formatted docs for it. The docs are defined by the
params.<child>._set_doc
method. Done only whensphinx
is already imported.
-
eturb.util.
get_status
(path)[source]¶ Get status of a simulation run by verifying its contents.
- Returns tuple(int, str)
status code and message
-
eturb.util.
init_params
(Class, isolated_unit=False)[source]¶ Instantiate an isolated
params
for a specific class.
-
eturb.util.
isoformat
(dt)[source]¶ Returns timestamp in modified isoformat from a datetime object (- instead of :). Accurate upto seconds.
Note
The modified ISO format is YYYY-MM-DDTHH-MM-SS
-
eturb.util.
last_modified
(path)[source]¶ Find the last modified file in a directory tree.
- Returns DirEntry
-
eturb.util.
modification_date
(path)[source]¶ Modification date of a file or directory. Returns empty string if does not exist.
-
eturb.util.
prepare_for_restart
(path, chkp_fnumber=1, verify_contents=True)[source]¶ Takes a directory in which a simulation was executed.
If verify contents: - check if snakemake was ever executed or check if directory is locked by snakemake - ensures simulation files exist - ensures restart files exist
Reads params.xml if it exists, and if not falls back to abl.par. Hardcoded!
Modifies checkpoint parameters with appropriate
chkp_fnumber
to restart from KTH framework.
-
eturb.util.
scantree
(path)[source]¶ Recursively yield DirEntry objects for given directory.
Courtesy: https://stackoverflow.com/a/33135143
- Returns generator
A generator for
DirEntry
objects.