File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
pySDC/playgrounds/dedalus/scripts Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
3+ import os
4+ import glob
5+ import shutil
6+ import argparse
7+
8+ parser = argparse .ArgumentParser (
9+ description = 'Collect simulation infos from simulation repositories' ,
10+ formatter_class = argparse .ArgumentDefaultsHelpFormatter )
11+
12+ parser .add_argument (
13+ "prefix" , help = "prefix of the simulation directories (is removed from the collected file names)" )
14+ parser .add_argument (
15+ "--outFolder" , help = "name of the output folder (default : prefix used)" ,
16+ default = None )
17+
18+ args = parser .parse_args ()
19+
20+ prefix = args .prefix
21+ outFolder = prefix if args .outFolder is None else args .outFolder
22+
23+ print (f"Collecting { prefix } */infos.json into { outFolder } " )
24+ os .makedirs (outFolder , exist_ok = True )
25+
26+ folders = glob .glob (args .prefix )
27+ for folder in folders :
28+ src = f"{ folders } /infos.json"
29+ if not os .path .isfile (src ):
30+ print (f" -- { folder } does not contain infos.json, ignoring ..." )
31+ continue
32+
33+ dst = f"{ outFolder } /{ folder [len (prefix ):]} .json"
34+ print (f" -- copying { src } into { dst } " )
35+ shutil .copy (src , dst )
36+
37+ print (" -- all done !" )
You can’t perform that action at this time.
0 commit comments