Skip to content

Commit

Permalink
Merge branch '149_modify-dicts-fix' into 'main'
Browse files Browse the repository at this point in the history
Add json formatting where missing

See merge request ghsc/neic/algorithms/neic-finitefault!142
  • Loading branch information
khaynie-usgs committed Mar 6, 2024
2 parents a4f0b8a + 0e57663 commit 8e1b26f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/wasp/modify_jsons.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ def _modify_by_dict(
if not len(channels_to_search):
break
with open(json_file, "w") as f:
json.dump(channels, f)
json.dump(
channels,
f,
sort_keys=True,
indent=4,
separators=(",", ": "),
ensure_ascii=False,
)


def _modify_by_input(
Expand Down
9 changes: 8 additions & 1 deletion src/wasp/modify_sacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ def _modify_by_dict(
time_shift = int(modifications["time_correction"] / delta)
channels[idx]["start_signal"] = channel["start_signal"] - time_shift
with open(json_file, "w") as f:
json.dump(channels, f)
json.dump(
channels,
f,
sort_keys=True,
indent=4,
separators=(",", ": "),
ensure_ascii=False,
)


def _modify_by_input(
Expand Down

0 comments on commit 8e1b26f

Please sign in to comment.