@@ -440,7 +440,8 @@ def bounds(self):
440440 return self .x_bounds .min (), self .x_bounds .max (), self .y_bounds .min (), self .y_bounds .max ()
441441
442442 def eddy_identification (self , grid_height , uname , vname , date , step = 0.005 , shape_error = 55 ,
443- array_sampling = 50 , pixel_limit = None , precision = None ):
443+ array_sampling = 50 , pixel_limit = None , precision = None , force_height_unit = None ,
444+ force_speed_unit = None ):
444445 """
445446
446447 Args:
@@ -467,7 +468,8 @@ def eddy_identification(self, grid_height, uname, vname, date, step=0.005, shape
467468 self .init_speed_coef (uname , vname )
468469
469470 # Get unit of h grid
470- h_units = self .units (grid_height )
471+
472+ h_units = self .units (grid_height ) if force_height_unit is None else force_height_unit
471473 units = UnitRegistry ()
472474 in_h_unit = units .parse_expression (h_units )
473475 if in_h_unit is not None :
@@ -653,7 +655,8 @@ def eddy_identification(self, grid_height, uname, vname, date, step=0.005, shape
653655 factor , _ = in_h_unit .to (out_unit ).to_tuple ()
654656 a_and_c [0 ].obs [name ] *= factor
655657 a_and_c [1 ].obs [name ] *= factor
656- in_u_units = units .parse_expression (self .units (uname ))
658+ u_units = self .units (uname ) if force_speed_unit is None else force_speed_unit
659+ in_u_units = units .parse_expression (u_units )
657660 if in_u_units is not None :
658661 for name in ['speed_average' , 'uavg_profile' ]:
659662 out_unit = units .parse_expression (VAR_DESCR [name ]['nc_attr' ]['units' ])
0 commit comments