Skip to content

Commit

Permalink
Updated update_model_properties to give proper type/length to model p…
Browse files Browse the repository at this point in the history
…roperties
  • Loading branch information
djm21 committed Mar 11, 2024
1 parent 850f054 commit c20c162
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/sasctl/pzmm/write_json_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
Expand Down

0 comments on commit c20c162

Please sign in to comment.