@@ -351,7 +351,15 @@ def keep_tracks_by_date(self, date, nb_days):
351351 return self .extract_with_mask (mask )
352352
353353 def particle_candidate_atlas (
354- self , cube , space_step , dt , start_intern = False , end_intern = False , callback_coherence = None , finalize_coherence = None , ** kwargs
354+ self ,
355+ cube ,
356+ space_step ,
357+ dt ,
358+ start_intern = False ,
359+ end_intern = False ,
360+ callback_coherence = None ,
361+ finalize_coherence = None ,
362+ ** kwargs
355363 ):
356364 """Select particles within eddies, advect them, return target observation and associated percentages
357365
@@ -383,7 +391,9 @@ def particle_candidate_atlas(
383391 kw_coherence = dict (space_step = space_step , dt = dt , c = cube )
384392 kw_coherence .update (kwargs )
385393 for t in times :
386- logger .info ("Coherence for time step : %s in [%s:%s]" , t , times [0 ], times [- 1 ])
394+ logger .info (
395+ "Coherence for time step : %s in [%s:%s]" , t , times [0 ], times [- 1 ]
396+ )
387397 # Get index for origin
388398 i = t - t_start
389399 indexs0 = i_sort [i_start [i ] : i_end [i ]]
@@ -393,15 +403,37 @@ def particle_candidate_atlas(
393403 if indexs0 .size == 0 or indexs1 .size == 0 :
394404 continue
395405
396- results .append (callback_coherence (self , i_target , pct , indexs0 , indexs1 , start_intern , end_intern , t_start = t , ** kw_coherence ))
406+ results .append (
407+ callback_coherence (
408+ self ,
409+ i_target ,
410+ pct ,
411+ indexs0 ,
412+ indexs1 ,
413+ start_intern ,
414+ end_intern ,
415+ t_start = t ,
416+ ** kw_coherence
417+ )
418+ )
397419 indexs [results [- 1 ]] = indexs0 , indexs1
398420
399421 if finalize_coherence is not None :
400422 finalize_coherence (results , indexs , i_target , pct )
401423 return i_target , pct
402424
403425 @classmethod
404- def fill_coherence (cls , network , i_targets , percents , i_origin , i_end , start_intern , end_intern , ** kwargs ):
426+ def fill_coherence (
427+ cls ,
428+ network ,
429+ i_targets ,
430+ percents ,
431+ i_origin ,
432+ i_end ,
433+ start_intern ,
434+ end_intern ,
435+ ** kwargs
436+ ):
405437 """_summary_
406438
407439 :param array i_targets: global target
@@ -412,21 +444,29 @@ def fill_coherence(cls, network, i_targets, percents, i_origin, i_end, start_int
412444 :param bool end_intern: Use intern or extern contour at end of advection
413445 """
414446 # Get contour data
415- contours_start = [network [label ][i_origin ] for label in cls .intern (start_intern )]
447+ contours_start = [
448+ network [label ][i_origin ] for label in cls .intern (start_intern )
449+ ]
416450 contours_end = [network [label ][i_end ] for label in cls .intern (end_intern )]
417451 # Compute local coherence
418- i_local_targets , local_percents = particle_candidate_step (contours_start = contours_start , contours_end = contours_end ,** kwargs )
452+ i_local_targets , local_percents = particle_candidate_step (
453+ contours_start = contours_start , contours_end = contours_end , ** kwargs
454+ )
419455 # Store
420- cls .merge_particle_result (i_targets , percents , i_local_targets , local_percents , i_origin , i_end )
421-
456+ cls .merge_particle_result (
457+ i_targets , percents , i_local_targets , local_percents , i_origin , i_end
458+ )
459+
422460 @staticmethod
423- def merge_particle_result (i_targets , percents , i_local_targets , local_percents , i_origin , i_end ):
461+ def merge_particle_result (
462+ i_targets , percents , i_local_targets , local_percents , i_origin , i_end
463+ ):
424464 """Copy local result in merged result with global indexation
425465
426466 :param array i_targets: global target
427- :param array percents:
467+ :param array percents:
428468 :param array i_local_targets: local index target
429- :param array local_percents:
469+ :param array local_percents:
430470 :param array i_origin: indices of origins
431471 :param array i_end: indices of ends
432472 """
0 commit comments