diff --git a/Inst_eddies/Analysis/stat.py b/Inst_eddies/Analysis/stat.py index f69e7af841830aaaed718babd3dcf7b5283e73f4..c8b103d7967b79ef29f76f59b1b0873927deedf0 100755 --- a/Inst_eddies/Analysis/stat.py +++ b/Inst_eddies/Analysis/stat.py @@ -23,6 +23,8 @@ with shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation, shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation, "outermost_contour")) as outermost_contour: n_extr = len(extremum) + field_names_outer = [f[0] for f in outermost_contour.fields[1:]] + with_radius_4 = 'radius4' in field_names_outer for rec_extr, shape_rec_outer in zip(extremum.iterRecords(), outermost_contour): @@ -35,7 +37,7 @@ with shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation, if shape_rec_outer.record.r_eq_area >= 0: n_outer += 1 - if "radius4" in shape_rec_outer.record: + if with_radius_4: if shape_rec_outer.record.radius4 == 0: n_radius4[0] += 1 elif shape_rec_outer.record.radius4 == 1: @@ -43,7 +45,7 @@ with shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation, elif shape_rec_outer.record.radius4 >= 2: n_radius4[2] += 1 - if rec_extr.speed == 1e4 and "radius4" in shape_rec_outer.record: + if rec_extr.speed == 1e4 and with_radius_4: if shape_rec_outer.record.radius4 == 0: n_missing_speed[0] += 1 elif shape_rec_outer.record.radius4 == 1: