From f3c35de3fc0300d1d1cfd0339fb45533dc496a47 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ipsl.fr>
Date: Wed, 10 Jul 2024 08:20:31 +0200
Subject: [PATCH] Blacken

---
 Inst_eddies/Analysis/stat_SHPC.py | 42 +++++++++++++++++++------------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/Inst_eddies/Analysis/stat_SHPC.py b/Inst_eddies/Analysis/stat_SHPC.py
index d808a7d7..641f844c 100755
--- a/Inst_eddies/Analysis/stat_SHPC.py
+++ b/Inst_eddies/Analysis/stat_SHPC.py
@@ -7,37 +7,43 @@ from os import path
 
 parser = argparse.ArgumentParser()
 parser.add_argument("SHPC")
-parser.add_argument("orientation", choices = ["Anticyclones", "Cyclones"])
+parser.add_argument("orientation", choices=["Anticyclones", "Cyclones"])
 args = parser.parse_args()
 
 n_points = 0
 n_valid_speed = 0
 
-with shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation,
-                                "extremum")) as extremum, \
-     shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation,
-                                "outermost_contour")) as outermost_contour:
+with shapefile.Reader(
+    path.join(args.SHPC, "Slice_0", args.orientation, "extremum")
+) as extremum, shapefile.Reader(
+    path.join(args.SHPC, "Slice_0", args.orientation, "outermost_contour")
+) as outermost_contour:
     n_extr = len(extremum)
     print("number of extrema of SSH:", n_extr, "\n")
     field_names_outer = [f[0] for f in outermost_contour.fields[1:]]
 
-    for rec_extr, shape_rec_outer in zip(extremum.iterRecords(),
-                                         outermost_contour):
+    for rec_extr, shape_rec_outer in zip(
+        extremum.iterRecords(), outermost_contour
+    ):
         l = len(shape_rec_outer.shape.points)
         n_points += l
 
         if rec_extr.speed != 1e4:
             n_valid_speed += 1
 
-print("average number of points of outermost contour per extremum:",
-      n_points / n_extr, "\n")
+print(
+    "average number of points of outermost contour per extremum:",
+    n_points / n_extr,
+    "\n",
+)
 print("number of valid speed values:", n_valid_speed)
 
 n_max_speed = 0
 n_points = 0
 
-with shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation,
-                                "max_speed_contour")) as max_speed_contour:
+with shapefile.Reader(
+    path.join(args.SHPC, "Slice_0", args.orientation, "max_speed_contour")
+) as max_speed_contour:
     for shape_rec in max_speed_contour:
         l = len(shape_rec.shape.points)
 
@@ -45,10 +51,14 @@ with shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation,
             n_max_speed += 1
             n_points += l
 
-print("number of non-null maximum-speed contours (distinct from the "
-      "outermost contour):",
-      n_max_speed)
+print(
+    "number of non-null maximum-speed contours (distinct from the "
+    "outermost contour):",
+    n_max_speed,
+)
 
 if n_max_speed != 0:
-    print("average number of points of non-null maximum-speed contours:",
-          n_points / n_max_speed)
+    print(
+        "average number of points of non-null maximum-speed contours:",
+        n_points / n_max_speed,
+    )
-- 
GitLab