From 8ae2ebd504c90556734a829c92c33d236c02bc39 Mon Sep 17 00:00:00 2001 From: Marko Mecina <marko.mecina@univie.ac.at> Date: Thu, 14 Mar 2024 11:05:43 +0100 Subject: [PATCH] also handle text-calibrated PTC=3 parameters --- Ccs/ccs_function_lib.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Ccs/ccs_function_lib.py b/Ccs/ccs_function_lib.py index 76765f5..e246145 100644 --- a/Ccs/ccs_function_lib.py +++ b/Ccs/ccs_function_lib.py @@ -2738,12 +2738,16 @@ def cast_str_value_ptc(val, ptc): elif ptc == 2: try: v = int(val) # test if val is text-calibrated - logger.warning("Numerical fixed value ({}) defined for enumerated type parameter (PTC=2).".format(val)) + logger.info("Numerical fixed value ({}) defined for enumerated type parameter (PTC=2).".format(val)) return v except ValueError: return str(val) elif ptc in [3, 4]: - return int(val) + try: + return int(val) # test if val is text-calibrated + except ValueError: + logger.info("String fixed value ({}) defined for integer type parameter (PTC=3).".format(val)) + return val elif ptc in [5, 9, 10]: return float(val) elif ptc == 7: -- GitLab