Skip to content

Commit

Permalink
preserve key order in output json
Browse files Browse the repository at this point in the history
  • Loading branch information
lee1043 committed Feb 14, 2023
1 parent 46ff3af commit cdd3602
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pcmdi_metrics/cloud_feedback/cloud_feedback_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@
print("assessed_cloud_feedback:", assessed_cld_fbk)
print("ecs:", ecs)

output_dict = dict()
output_dict["RESULTS"] = dict()
output_dict["RESULTS"][model] = dict()
output_dict["RESULTS"][model][variant] = dict()
output_dict = OrderedDict()
output_dict["RESULTS"] = OrderedDict()
output_dict["RESULTS"][model] = OrderedDict()
output_dict["RESULTS"][model][variant] = OrderedDict()
output_dict["RESULTS"][model][variant]["clim_cloud_rmse"] = climo_cld_rmse
output_dict["RESULTS"][model][variant]["cloud_feedback_rmse"] = cld_fbk_rmse
output_dict["RESULTS"][model][variant]["assessed_cloud_feedback"] = OrderedDict()
Expand Down
2 changes: 1 addition & 1 deletion pcmdi_metrics/cloud_feedback/lib/lib_cloud_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def cloud_feedback_metrics_to_json(
"realization",
"statistic",
],
sort_keys=True,
sort_keys=False,
indent=4,
separators=(",", ": "),
)
Expand Down

0 comments on commit cdd3602

Please sign in to comment.