From 2d0a2f3d164fe491917997b4a039416e0b8b8b76 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Tue, 26 Jul 2022 22:40:14 +0200 Subject: [PATCH] Polish --- Inst_eddies/config.f90 | 3 ++- Inst_eddies/input_ssh.f90 | 4 ++-- Inst_eddies/inst_eddies.py.in | 13 +++++++------ Overlap/Tests/save_snapshot.f90 | 2 +- Overlap/Tests/test_overlap.f90 | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Inst_eddies/config.f90 b/Inst_eddies/config.f90 index 216360ac..1bf4432a 100644 --- a/Inst_eddies/config.f90 +++ b/Inst_eddies/config.f90 @@ -30,13 +30,14 @@ contains !---------------------------------------------------------------------- call new_unit(unit) - + if (exist) then open(unit, file = "SHPC_cyclo/used_nml.txt", status = "old", & action = "read", position = "rewind") read(unit, nml = config_nml) close(unit) else + print *, "config: Reading config_nml.txt..." open(unit, file = "config_nml.txt", status = "old", action = "read", & position = "rewind") read(unit, nml = config_nml) diff --git a/Inst_eddies/input_ssh.f90 b/Inst_eddies/input_ssh.f90 index 7c2234bc..9a5177e2 100644 --- a/Inst_eddies/input_ssh.f90 +++ b/Inst_eddies/input_ssh.f90 @@ -76,9 +76,9 @@ contains ! As we are requiring the grid spacing to be uniform, the value of ! "periodic" may be deduced from the values of step(1) and nlon: periodic = nint(twopi / step(1)) == nlon - print *, "inst_eddies: periodic = ", periodic + print *, "input_ssh: periodic = ", periodic - call assert(2 * max_radius_deg(1) < 180., "inst_eddies max_radius_deg") + call assert(2 * max_radius_deg(1) < 180., "input_ssh: max_radius_deg") ! (Let us require this even if not periodic. This is clearer.) max_radius = nint(max_radius_deg / step_deg) diff --git a/Inst_eddies/inst_eddies.py.in b/Inst_eddies/inst_eddies.py.in index 8cc6cc90..0383e1c2 100644 --- a/Inst_eddies/inst_eddies.py.in +++ b/Inst_eddies/inst_eddies.py.in @@ -28,9 +28,9 @@ def loop_inst_eddies(files, bbox, d): sys.exit(inst_eddies_exe + " not found or not executable") if os.access("config_nml.txt", os.R_OK): - print("Will use config_nml.txt.") + print("inst_eddies.loop_inst_eddies: Will use config_nml.txt.") else: - sys.exit('inst_eddies.py: "config_nml.txt" not found') + sys.exit('"config_nml.txt" not found') nco_instance = nco.Nco() @@ -45,8 +45,9 @@ def loop_inst_eddies(files, bbox, d): writer.writerow(["date", "elapsed_NCO", "elapsed_Fortran"]) for nc_file in files: - print("inst_eddies.py: Date:", d) - print("Input file:", nc_file) + print("inst_eddies.loop_inst_eddies: Date:", d) + print("inst_eddies.loop_inst_eddies: Input file:", nc_file, + flush = True) if os.access(nc_file, os.F_OK): my_pc = time.perf_counter() @@ -73,7 +74,7 @@ def loop_inst_eddies(files, bbox, d): os.remove("uv.nc") writer.writerow([d, elapsed_NCO, elapsed_Fortran]) else: - print("inst_eddies.py: Missing file:", nc_file) + print("inst_eddies.loop_inst_eddies: Missing file:", nc_file) for orient in ["cyclo", "anti"]: with open(f"SHPC_{orient}/ishape_last.txt", "a") \ @@ -98,6 +99,6 @@ if __name__ == "__main__": argparser.add_argument("-b", "--bbox", nargs=4, type = float, metavar = ("xmin", "xmax", "ymin", "ymax")) args = argparser.parse_args() - d = input("Enter first date index (integer value):") + d = input("Enter first date index (integer value): ") d = int(d) loop_inst_eddies(args.file, args.bbox, d) diff --git a/Overlap/Tests/save_snapshot.f90 b/Overlap/Tests/save_snapshot.f90 index 6144cb2d..e3d206b6 100644 --- a/Overlap/Tests/save_snapshot.f90 +++ b/Overlap/Tests/save_snapshot.f90 @@ -16,7 +16,7 @@ contains use write_extr_map_m, only: write_extr_map type(snapshot), intent(in):: s - + real, intent(in):: corner(:) ! (2) ! longitude and latitude of the corner of the whole grid in input ! NetCDF, in degrees diff --git a/Overlap/Tests/test_overlap.f90 b/Overlap/Tests/test_overlap.f90 index 09eae3c1..7fef4fbd 100644 --- a/Overlap/Tests/test_overlap.f90 +++ b/Overlap/Tests/test_overlap.f90 @@ -3,8 +3,8 @@ program test_overlap use, intrinsic:: ISO_FORTRAN_ENV ! Libraries: - use jumble, only: get_command_arg_dyn, read_opcol, new_unit, ediff1d - use jumble, only: deg_to_rad, assert + use jumble, only: get_command_arg_dyn, read_opcol, new_unit, ediff1d, & + deg_to_rad, assert use shapelib_03, only: dbf_read_attribute_03 use derived_types, only: snapshot, shpc_slice_handler, shpc_slice_meta -- GitLab