From d418d1a79a47e61e3e3fd1a7709287277cc7438e Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 6 Feb 2024 12:39:25 -0500 Subject: [PATCH 1/2] fix error in Fortran_to_Aviary.py when output file is not specified or ARNGE(1) = 0. --- aviary/utils/Fortran_to_Aviary.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/aviary/utils/Fortran_to_Aviary.py b/aviary/utils/Fortran_to_Aviary.py index f8b9d9a77..9ef1c4ef3 100644 --- a/aviary/utils/Fortran_to_Aviary.py +++ b/aviary/utils/Fortran_to_Aviary.py @@ -57,7 +57,7 @@ def create_aviary_deck(fortran_deck: str, legacy_code=None, defaults_deck=None, if not out_file: name = fortran_deck.stem - out_file: Path = fortran_deck.parents / name + '_converted.csv' + out_file: Path = fortran_deck.parent.resolve().joinpath(name + '_converted.csv') if legacy_code is GASP: default_extension = '.dat' @@ -362,6 +362,7 @@ def update_gasp_options(vehicle_data): # if the design range target_range value is 0, set the problem_type to fallout if design_range[0] == 0: input_values.set_val('problem_type', ['fallout']) + problem_type = 'fallout' design_range = 0 if problem_type == 'sizing': design_range = design_range[0] @@ -613,5 +614,8 @@ def _exec_F2A(args, user_args): args.input_deck = args.input_deck[0] filepath = args.input_deck - create_aviary_deck(filepath, args.legacy_code, args.defaults_deck, - Path(args.out_file), args.force) + if args.out_file: + create_aviary_deck(filepath, args.legacy_code, args.defaults_deck, + Path(args.out_file), args.force) + else: + create_aviary_deck(filepath, args.legacy_code, args.defaults_deck, args.force) From 0de73abb7197f8620b0eec172272a1473047c399 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Tue, 6 Feb 2024 15:40:43 -0500 Subject: [PATCH 2/2] made changes based on Carl's suggestions --- aviary/utils/Fortran_to_Aviary.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/aviary/utils/Fortran_to_Aviary.py b/aviary/utils/Fortran_to_Aviary.py index 9ef1c4ef3..0c4f187f5 100644 --- a/aviary/utils/Fortran_to_Aviary.py +++ b/aviary/utils/Fortran_to_Aviary.py @@ -55,7 +55,9 @@ def create_aviary_deck(fortran_deck: str, legacy_code=None, defaults_deck=None, fortran_deck: Path = get_path(fortran_deck, verbose=False) - if not out_file: + if out_file: + out_file = Path(out_file) + else: name = fortran_deck.stem out_file: Path = fortran_deck.parent.resolve().joinpath(name + '_converted.csv') @@ -361,8 +363,8 @@ def update_gasp_options(vehicle_data): if isinstance(design_range, list): # if the design range target_range value is 0, set the problem_type to fallout if design_range[0] == 0: - input_values.set_val('problem_type', ['fallout']) problem_type = 'fallout' + input_values.set_val('problem_type', [problem_type]) design_range = 0 if problem_type == 'sizing': design_range = design_range[0] @@ -614,8 +616,5 @@ def _exec_F2A(args, user_args): args.input_deck = args.input_deck[0] filepath = args.input_deck - if args.out_file: - create_aviary_deck(filepath, args.legacy_code, args.defaults_deck, - Path(args.out_file), args.force) - else: - create_aviary_deck(filepath, args.legacy_code, args.defaults_deck, args.force) + create_aviary_deck(filepath, args.legacy_code, args.defaults_deck, + args.out_file, args.force)