@@ -363,7 +363,7 @@ def load_from_netcdf(cls, filename):
363
363
return eddies
364
364
365
365
@staticmethod
366
- def cost_function (records_in , records_out , distance ):
366
+ def cost_function2 (records_in , records_out , distance ):
367
367
nb_records = records_in .shape [0 ]
368
368
costs = ma .empty (nb_records ,dtype = 'f4' )
369
369
for i_record in xrange (nb_records ):
@@ -390,8 +390,8 @@ def mask_function(self, other):
390
390
return self .circle_mask (other , radius = 125 )
391
391
392
392
@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)
395
395
cost = ((records_in ['amplitude' ] - records_out ['amplitude' ]
396
396
) / records_in ['amplitude' ]
397
397
) ** 2
@@ -401,7 +401,7 @@ def cost_function2(records_in, records_out, distance):
401
401
cost += (distance / 125 ) ** 2
402
402
cost **= 0.5
403
403
# Mask value superior at 60 % of variation
404
- return ma .array (cost , mask = m )
404
+ # return ma.array(cost, mask=m)
405
405
return cost
406
406
407
407
def circle_mask (self , other , radius = 100 ):
@@ -502,7 +502,7 @@ def solve_conflict(cost):
502
502
503
503
@staticmethod
504
504
def solve_simultaneous (cost ):
505
- mask = - cost .mask
505
+ mask = ~ cost .mask
506
506
# Count number of link by self obs and other obs
507
507
self_links = mask .sum (axis = 1 )
508
508
other_links = mask .sum (axis = 0 )
@@ -526,7 +526,7 @@ def solve_simultaneous(cost):
526
526
# Cost to resolve conflict
527
527
cost_reduce = cost [i_self_keep ][:, i_other_keep ]
528
528
shape = cost_reduce .shape
529
- nb_conflict = (- cost_reduce .mask ).sum ()
529
+ nb_conflict = (~ cost_reduce .mask ).sum ()
530
530
logging .debug ('Shape conflict matrix : %s, %d conflicts' , shape , nb_conflict )
531
531
532
532
if nb_conflict >= (shape [0 ] + shape [1 ]):
@@ -630,7 +630,7 @@ def tracking(self, other):
630
630
dist [mask_accept_dist ])
631
631
632
632
cost_mat = ma .empty (mask_accept_dist .shape , dtype = 'f4' )
633
- cost_mat .mask = - mask_accept_dist
633
+ cost_mat .mask = ~ mask_accept_dist
634
634
cost_mat [mask_accept_dist ] = cost_values
635
635
636
636
i_self , i_other = self .solve_function (cost_mat )
@@ -720,8 +720,8 @@ def filled_by_interpolation(self, mask):
720
720
var = field [0 ]
721
721
if var in ['n' , 'virtual' , 'track' ] or var in self .array_variables :
722
722
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 ])
725
725
726
726
def extract_longer_eddies (self , nb_min , nb_obs , compress_id = True ):
727
727
"""Select eddies which are longer than nb_min
0 commit comments