Skip to content

Commit

Permalink
Make the output command line argument optional for SURFEX binary tasks
Browse files Browse the repository at this point in the history
Some applications do not need to produce (or store) output files after
running SURFEX but current implementation requires an output file
(a PGD, PREP or an OFFLINE restart file) to be always stored. This
commit relaxes that requirement.
  • Loading branch information
joewkr committed Jul 7, 2023
1 parent 1b18d80 commit 12883e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pysurfex/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def run_surfex_binary(mode, **kwargs):
else:
raise FileNotFoundError("File not found: " + archive)

if not os.path.exists(output) or force:
if not (output is not None and os.path.exists(output)) or force:
if os.path.isfile(namelist_path):
with open(namelist_path, mode="r", encoding="utf-8") as file_handler:
nam_defs = yaml.safe_load(file_handler)
Expand Down
2 changes: 1 addition & 1 deletion pysurfex/cmd_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ def parse_args_surfex_binary(argv, mode):
parser.add_argument(
"--domain", type=str, required=False, help="JSON file with domain"
)
parser.add_argument("--output", "-o", type=str, required=True)
parser.add_argument("--output", "-o", type=str, required=False, default=None)
parser.add_argument("--dtg", type=str, required=False, default=None)
parser.add_argument("--basetime", type=str, required=False, default=None)
if pert:
Expand Down

0 comments on commit 12883e7

Please sign in to comment.