From bed3c9b08a9d6254a09990334d5a49d1dee8cd2d Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Mon, 6 Dec 2021 21:12:42 +0100 Subject: [PATCH] Polish --- Inst_eddies/inst_eddies_in.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Inst_eddies/inst_eddies_in.py b/Inst_eddies/inst_eddies_in.py index adc2e0bb..2862bd35 100755 --- a/Inst_eddies/inst_eddies_in.py +++ b/Inst_eddies/inst_eddies_in.py @@ -28,7 +28,7 @@ def loop_inst_eddies(files, bbox, d): if os.access("main_nml.txt", os.R_OK): print("Will use main_nml.txt.") else: - sys.exit('"main_nml.txt" not found') + sys.exit('inst_eddies.py: "main_nml.txt" not found') nco_instance = nco.Nco() @@ -50,8 +50,10 @@ def loop_inst_eddies(files, bbox, d): if bbox: xmin, xmax, ymin, ymax = bbox nco_instance.ncks(nc_file, output = "cropped.nc", - options = [f"--dimension=longitude,{xmin},{xmax}", - f"--dimension=latitude,{ymin},{ymax}"]) + options = [f"--dimension=longitude,{xmin}," + f"{xmax}", + f"--dimension=latitude,{ymin}," + f"{ymax}"]) nc_file = "cropped.nc" nco_instance.ncpdq(nc_file, output = "unpacked.nc", @@ -70,7 +72,8 @@ def loop_inst_eddies(files, bbox, d): print("inst_eddies.py: Missing file:", nc_file) for orient in ["cyclo", "anti"]: - with open(f"SHPC_{orient}/ishape_last.txt", "a") as ishape_last, \ + with open(f"SHPC_{orient}/ishape_last.txt", "a") \ + as ishape_last, \ shapefile.Reader(f"SHPC_{orient}/extremum") as shpr: n_shapes = len(shpr) ishape_last.write(str(n_shapes - 1) + "\n") -- GitLab