@@ -363,7 +363,7 @@ def load_from_netcdf(cls, filename):
363363 return eddies
364364
365365 @staticmethod
366- def cost_function (records_in , records_out , distance ):
366+ def cost_function2 (records_in , records_out , distance ):
367367 nb_records = records_in .shape [0 ]
368368 costs = ma .empty (nb_records ,dtype = 'f4' )
369369 for i_record in xrange (nb_records ):
@@ -390,8 +390,8 @@ def mask_function(self, other):
390390 return self .circle_mask (other , radius = 125 )
391391
392392 @staticmethod
393- def cost_function2 (records_in , records_out , distance ):
394- m = EddiesObservations .across_ground (records_in , records_out , distance )
393+ def cost_function (records_in , records_out , distance ):
394+ # m = EddiesObservations.across_ground(records_in, records_out, distance)
395395 cost = ((records_in ['amplitude' ] - records_out ['amplitude' ]
396396 ) / records_in ['amplitude' ]
397397 ) ** 2
@@ -401,7 +401,7 @@ def cost_function2(records_in, records_out, distance):
401401 cost += (distance / 125 ) ** 2
402402 cost **= 0.5
403403 # Mask value superior at 60 % of variation
404- return ma .array (cost , mask = m )
404+ # return ma.array(cost, mask=m)
405405 return cost
406406
407407 def circle_mask (self , other , radius = 100 ):
@@ -502,7 +502,7 @@ def solve_conflict(cost):
502502
503503 @staticmethod
504504 def solve_simultaneous (cost ):
505- mask = - cost .mask
505+ mask = ~ cost .mask
506506 # Count number of link by self obs and other obs
507507 self_links = mask .sum (axis = 1 )
508508 other_links = mask .sum (axis = 0 )
@@ -526,7 +526,7 @@ def solve_simultaneous(cost):
526526 # Cost to resolve conflict
527527 cost_reduce = cost [i_self_keep ][:, i_other_keep ]
528528 shape = cost_reduce .shape
529- nb_conflict = (- cost_reduce .mask ).sum ()
529+ nb_conflict = (~ cost_reduce .mask ).sum ()
530530 logging .debug ('Shape conflict matrix : %s, %d conflicts' , shape , nb_conflict )
531531
532532 if nb_conflict >= (shape [0 ] + shape [1 ]):
@@ -630,7 +630,7 @@ def tracking(self, other):
630630 dist [mask_accept_dist ])
631631
632632 cost_mat = ma .empty (mask_accept_dist .shape , dtype = 'f4' )
633- cost_mat .mask = - mask_accept_dist
633+ cost_mat .mask = ~ mask_accept_dist
634634 cost_mat [mask_accept_dist ] = cost_values
635635
636636 i_self , i_other = self .solve_function (cost_mat )
@@ -720,8 +720,8 @@ def filled_by_interpolation(self, mask):
720720 var = field [0 ]
721721 if var in ['n' , 'virtual' , 'track' ] or var in self .array_variables :
722722 continue
723- self .obs [var ][mask ] = interp (index [mask ], index [- mask ],
724- self .obs [var ][- mask ])
723+ self .obs [var ][mask ] = interp (index [mask ], index [~ mask ],
724+ self .obs [var ][~ mask ])
725725
726726 def extract_longer_eddies (self , nb_min , nb_obs , compress_id = True ):
727727 """Select eddies which are longer than nb_min
0 commit comments