From c20c1629aef3aabd20765da4318f6fe1e33eb7dd Mon Sep 17 00:00:00 2001 From: djm21 Date: Sun, 10 Mar 2024 22:21:28 -0500 Subject: [PATCH] Updated update_model_properties to give proper type/length to model properties --- src/sasctl/pzmm/write_json_files.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/sasctl/pzmm/write_json_files.py b/src/sasctl/pzmm/write_json_files.py index d905acde..4345b6eb 100644 --- a/src/sasctl/pzmm/write_json_files.py +++ b/src/sasctl/pzmm/write_json_files.py @@ -2481,7 +2481,10 @@ def update_model_properties( "can be generated." ) for key in update_dict: - model_files[PROP][key] = update_dict[key] + if not isinstance(update_dict[key], str): + model_files[PROP][key] = str(round(update_dict[key], 14)) + else: + model_files[PROP][key] = update_dict[key] else: if not Path.exists(Path(model_files) / PROP): raise RuntimeError( @@ -2490,8 +2493,10 @@ def update_model_properties( ) with open(Path(model_files) / PROP, 'r+') as properties_json: model_properties = json.load(properties_json) - for key in update_dict: - model_properties[key] = update_dict[key] + if not isinstance(update_dict[key], str): + model_files[PROP][key] = str(round(update_dict[key], 14)) + else: + model_files[PROP][key] = update_dict[key] properties_json.seek(0) properties_json.write(json.dumps(model_properties, indent=4, cls=NpEncoder)) properties_json.truncate()