From 35b51fd10d0001812c948ea88265accef4973dde Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Wed, 11 Oct 2023 21:48:54 +0200 Subject: [PATCH] Select compact encoding to Json file This makes quite a difference in file size for a large domain. For example, the size of `Global_1993_2023/Graph_anti/expanded_traj.json` is reduced from 0.6 to 0.3 GiB. We do not need pretty display for these files. --- Trajectories/trajectories.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Trajectories/trajectories.py b/Trajectories/trajectories.py index 046a94b6..ad9d141e 100755 --- a/Trajectories/trajectories.py +++ b/Trajectories/trajectories.py @@ -172,13 +172,13 @@ for t in traj_vert_ind: print("Saving...") with open("traj_segm.json", "w") as outfile: - json.dump(traj_segm, outfile, indent = 4) + json.dump(traj_segm, outfile, separators = (',', ':')) print("Created traj_segm.json.") with open("expanded_traj.json", "w") as outfile: json.dump({"e_overestim": g.gp.e_overestim, "traj": expanded_traj}, - outfile, indent = 4) + outfile, separators = (',', ':')) print("Created expanded_traj.json.") print('Done') -- GitLab