@@ -893,24 +893,38 @@ def intern(flag, public_label=False):
893
893
labels = [VAR_DESCR [label ]["nc_name" ] for label in labels ]
894
894
return labels
895
895
896
- def match (self , other , intern = False , cmin = 0 ):
896
+ def match (self , other , method = "overlap" , intern = False , cmin = 0 , ** kwargs ):
897
897
"""return index and score compute with area
898
898
899
899
:param EddiesObservations other: Observations to compare
900
+ :param str method:
901
+ if method is "overlap" method will use contour to compute score,
902
+ if method is "circle" method will apply a formula of circle overlap
900
903
:param bool intern: if True, speed contour will be used
901
904
:param float cmin: 0 < cmin < 1, return only couple above cmin
905
+ :param dict kwargs: look at :py:meth:`vertice_overlap`
902
906
:return: return index of couple in self and other and cost value
903
907
:rtype: (array(int), array(int), array(float))
904
908
905
909
.. minigallery:: py_eddy_tracker.EddiesObservations.match
906
910
"""
907
911
x_name , y_name = self .intern (intern )
908
- i , j = bbox_intersection (
909
- self [x_name ], self [y_name ], other [x_name ], other [y_name ]
910
- )
911
- c = vertice_overlap (
912
- self [x_name ][i ], self [y_name ][i ], other [x_name ][j ], other [y_name ][j ]
913
- )
912
+ if method == "overlap" :
913
+ i , j = bbox_intersection (
914
+ self [x_name ], self [y_name ], other [x_name ], other [y_name ]
915
+ )
916
+ c = vertice_overlap (
917
+ self [x_name ][i ],
918
+ self [y_name ][i ],
919
+ other [x_name ][j ],
920
+ other [y_name ][j ],
921
+ ** kwargs ,
922
+ )
923
+ elif method == "close_center" :
924
+ i , j , c = close_center (
925
+ self .latitude , self .longitude , other .latitude , other .longitude , ** kwargs
926
+ )
927
+
914
928
m = c > cmin
915
929
return i [m ], j [m ], c [m ]
916
930
0 commit comments