Allow user to specify output data file

这个提交包含在:
nmannall
2023-12-19 15:27:13 +00:00
父节点 8bff7029a3
当前提交 a8dfeeb742
共有 2 个文件被更改,包括 7 次插入10 次删除

查看文件

@@ -168,17 +168,13 @@ class ModelConfig:
outputdir: string of output file directory given by input file command.
"""
if not outputdir:
try:
self.output_file_path = Path(self.args.outputfile)
except AttributeError:
self.output_file_path = sim_config.input_file_path.with_suffix("")
if outputdir is not None:
Path(outputdir).mkdir(exist_ok=True)
self.output_file_path = Path(outputdir, sim_config.input_file_path.stem)
elif sim_config.args.outputfile is not None:
self.output_file_path = Path(sim_config.args.outputfile).with_suffix("")
else:
try:
Path(outputdir).mkdir(exist_ok=True)
self.output_file_path = Path(outputdir, sim_config.input_file_path.stem)
except AttributeError:
self.output_file_path = sim_config.input_file_path.with_suffix("")
self.output_file_path = sim_config.input_file_path.with_suffix("")
parts = self.output_file_path.parts
self.output_file_path = Path(*parts[:-1], parts[-1] + self.appendmodelnumber)

查看文件

@@ -165,6 +165,7 @@ def cli():
# Parse command line arguments
parser = argparse.ArgumentParser(prog="gprMax", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("inputfile", help=help_msg["inputfile"])
parser.add_argument("-outputfile", "-o", help=help_msg["outputfile"])
parser.add_argument("-n", default=args_defaults["n"], type=int, help=help_msg["n"])
parser.add_argument("-i", type=int, help=help_msg["i"])
parser.add_argument("-mpi", action="store_true", default=args_defaults["mpi"], help=help_msg["mpi"])