From da1e022ec9b55aa14fb81f74c2803d9fbca4f346 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ipsl.fr> Date: Fri, 11 Oct 2024 19:55:37 +0200 Subject: [PATCH] Add arguments `i_slice` and orientation --- Inst_eddies/Analysis/distribution_function.py | 12 +++++++----- Inst_eddies/Analysis/tests.json | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Inst_eddies/Analysis/distribution_function.py b/Inst_eddies/Analysis/distribution_function.py index 76a7a6cd..118aed97 100755 --- a/Inst_eddies/Analysis/distribution_function.py +++ b/Inst_eddies/Analysis/distribution_function.py @@ -8,7 +8,7 @@ import numpy as np import jumble_matplotlib -def read(SHPC): +def read(SHPC, i_slice, orientation): """Read the three dbf files in dirname and return speed, radius and amplitude of outermost contour, radius and amplitude of maximum speed contour, as Numpy arrays. @@ -16,9 +16,9 @@ def read(SHPC): Select valid speed values. """ - extremum = SHPC.get_reader(0, "Anticyclones", "extremum") - outerm_cont = SHPC.get_reader(0, "Anticyclones", "outermost_contour") - max_speed_cont = SHPC.get_reader(0, "Anticyclones", "max_speed_contour") + extremum = SHPC.get_reader(i_slice, orientation, "extremum") + outerm_cont = SHPC.get_reader(i_slice, orientation, "outermost_contour") + max_speed_cont = SHPC.get_reader(i_slice, orientation, "max_speed_contour") speed = [] rad_outer = [] rad_speed = [] @@ -132,10 +132,12 @@ if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("SHPC", help="directory containing SHPC") + parser.add_argument("i_slice", help="slice index", type=int) + parser.add_argument("orientation", choices=["Anticyclones", "Cyclones"]) parser.add_argument("--save", action="store_true") args = parser.parse_args() SHPC = util_eddies.SHPC_class(args.SHPC) - d = read(SHPC) + d = read(SHPC, args.i_slice, args.orientation) fig_list = plot_all([d]) if args.save: diff --git a/Inst_eddies/Analysis/tests.json b/Inst_eddies/Analysis/tests.json index ea06319e..b7ed9179 100644 --- a/Inst_eddies/Analysis/tests.json +++ b/Inst_eddies/Analysis/tests.json @@ -131,6 +131,8 @@ "command": [ "$src_dir/Inst_eddies/Analysis/distribution_function.py", "$tests_old_dir/Region_5_15_days/SHPC", + "0", + "Anticyclones", "--save" ] } -- GitLab