@@ -438,6 +438,21 @@ def bounds(self):
438
438
439
439
def eddy_identification (self , grid_height , uname , vname , date , step = 0.005 , shape_error = 55 ,
440
440
array_sampling = 50 , pixel_limit = None ):
441
+ """
442
+
443
+ Args:
444
+ grid_height:
445
+ uname:
446
+ vname:
447
+ date:
448
+ step: must be in meter (m)
449
+ shape_error: must be in percent (%)
450
+ array_sampling:
451
+ pixel_limit:
452
+
453
+ Returns:
454
+
455
+ """
441
456
if not isinstance (date , datetime ):
442
457
raise Exception ('Date argument be a datetime object' )
443
458
# The inf limit must be in pixel and sup limit in surface
@@ -447,6 +462,14 @@ def eddy_identification(self, grid_height, uname, vname, date, step=0.005, shape
447
462
# Compute an interpolator for eke
448
463
self .init_speed_coef (uname , vname )
449
464
465
+ # Get unit of h grid
466
+ h_units = self .units (grid_height )
467
+ units = UnitRegistry ()
468
+ in_h_unit = units .parse_expression (h_units )
469
+ if in_h_unit is not None :
470
+ factor , _ = in_h_unit .to ('m' ).to_tuple ()
471
+ step /= factor
472
+
450
473
# Get h grid
451
474
data = self .grid (grid_height )
452
475
@@ -614,13 +637,11 @@ def eddy_identification(self, grid_height, uname, vname, date, step=0.005, shape
614
637
eddies_collection .obs ['contour_lon_s' ] = ((eddies_collection .obs ['contour_lon_s' ].T - ref ) % 360 + ref ).T
615
638
616
639
a_and_c .append (eddies_collection )
617
- h_units = self .units (grid_height )
618
- units = UnitRegistry ()
619
- in_unit = units .parse_expression (h_units )
620
- if in_unit is not None :
640
+
641
+ if in_h_unit is not None :
621
642
for name in ['amplitude' , 'height_max_speed_contour' , 'height_external_contour' , 'height_inner_contour' ]:
622
643
out_unit = units .parse_expression (VAR_DESCR [name ]['nc_attr' ]['units' ])
623
- factor , _ = in_unit .to (out_unit ).to_tuple ()
644
+ factor , _ = in_h_unit .to (out_unit ).to_tuple ()
624
645
a_and_c [0 ].obs [name ] *= factor
625
646
a_and_c [1 ].obs [name ] *= factor
626
647
return a_and_c
0 commit comments