Skip to content

Commit 35d00b2

Browse files
json output file name fix NREL#75
1 parent 849e6c6 commit 35d00b2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/geophires_x/GEOPHIRESv3.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import logging.config
66
import os
77
import sys
8+
from pathlib import Path
9+
810
import geophires_x.Model as Model
911
import geophires_x.OptionList as OptionList
1012

@@ -61,9 +63,9 @@ def main(enable_geophires_logging_config=True):
6163

6264
json_outputfile = 'HDR.json'
6365
if len(sys.argv) > 2:
64-
json_outputfile = str(sys.argv[2])
65-
segs = json_outputfile.split('.')
66-
json_outputfile = segs[0] + '.json'
66+
output_arg = str(sys.argv[2])
67+
output_arg_path = Path(output_arg)
68+
json_outputfile = output_arg.replace(output_arg_path.name, f'{output_arg_path.stem}.json')
6769
with open(json_outputfile, 'w', encoding='UTF-8') as f:
6870
f.write(json.dumps(json_merged))
6971

0 commit comments

Comments
 (0)