7070@njit (cache = True , fastmath = True )
7171def shifted_ellipsoid_degrees_mask2 (lon0 , lat0 , lon1 , lat1 , minor = 1.5 , major = 1.5 ):
7272 """
73- work only if major is an array but faster * 6
73+ Work only if major is an array but faster * 6
7474 """
7575 # c = (major ** 2 - minor ** 2) ** .5 + major
7676 c = major
@@ -189,7 +189,8 @@ def _repr_html_(self):
189189 return f"""<b>{ infos ['nb_obs' ]} observations from { infos ['t0' ]} to { infos ['t1' ]} </b>"""
190190
191191 def hist (self , varname , x , bins , percent = False , mean = False , nb = False ):
192- """
192+ """ Build histograms.
193+
193194 :param str varname: variable to use to compute stat
194195 :param str x: variable to use to know in which bins
195196 :param array bins:
@@ -216,7 +217,7 @@ def box_display(value):
216217
217218 def __repr__ (self ):
218219 """
219- Return general informations on dataset as a string
220+ Return general informations on dataset as strings.
220221
221222 :return: informations on datasets
222223 :rtype: str
@@ -292,7 +293,7 @@ def obs_dimension(cls, handler):
292293
293294 def add_fields (self , fields = list (), array_fields = list ()):
294295 """
295- Add a new field
296+ Add a new field.
296297 """
297298 nb_obs = self .obs .shape [0 ]
298299 new = self .__class__ (
@@ -321,7 +322,7 @@ def add_rotation_type(self):
321322
322323 def circle_contour (self , only_virtual = False ):
323324 """
324- Set contour as a circle with radius and center data
325+ Set contours as a circles from radius and center data.
325326
326327 .. minigallery:: py_eddy_tracker.EddiesObservations.circle_contour
327328 """
@@ -346,7 +347,7 @@ def circle_contour(self, only_virtual=False):
346347
347348 @property
348349 def dtype (self ):
349- """Return dtype to build numpy array
350+ """Return dtype to build numpy array.
350351 """
351352 dtype = list ()
352353 for elt in self .elements :
@@ -363,7 +364,7 @@ def dtype(self):
363364
364365 @property
365366 def elements (self ):
366- """Return all the names of the variables
367+ """Return all the names of the variables.
367368 """
368369 elements = [i for i in self .ELEMENTS ]
369370 if self .track_array_variables > 0 :
@@ -376,7 +377,7 @@ def elements(self):
376377 return list (set (elements ))
377378
378379 def coherence (self , other ):
379- """Check coherence between two dataset
380+ """Check coherence between two datasets.
380381 """
381382 test = self .track_extra_variables == other .track_extra_variables
382383 test *= self .track_array_variables == other .track_array_variables
@@ -402,7 +403,7 @@ def concatenate(cls, observations):
402403 return eddies
403404
404405 def merge (self , other ):
405- """Merge two dataset
406+ """Merge two datasets.
406407 """
407408 nb_obs_self = len (self )
408409 nb_obs = nb_obs_self + len (other )
@@ -424,7 +425,7 @@ def reset(self):
424425
425426 @property
426427 def obs (self ):
427- """Return an array observations
428+ """Return observations.
428429 """
429430 return self .observations
430431
@@ -437,7 +438,7 @@ def __iter__(self):
437438
438439 def iter_on (self , xname , bins = None ):
439440 """
440- Yield observation group for each bin
441+ Yield observation group for each bin.
441442
442443 :param str varname:
443444 :param array bins: bounds of each bin ,
@@ -467,7 +468,7 @@ def iter_on(self, xname, bins=None):
467468
468469 def align_on (self , other , var_name = "time" , ** kwargs ):
469470 """
470- Align the time indexes of two datasets
471+ Align the time indexes of two datasets.
471472 """
472473 iter_self , iter_other = (
473474 self .iter_on (var_name , ** kwargs ),
@@ -486,7 +487,7 @@ def align_on(self, other, var_name="time", **kwargs):
486487 yield indexs_self , indexs_other , b0_self , b1_self
487488
488489 def insert_observations (self , other , index ):
489- """Insert other obs in self at the index
490+ """Insert other obs in self at the index.
490491 """
491492 if not self .coherence (other ):
492493 raise Exception ("Observations with no coherence" )
@@ -508,7 +509,7 @@ def insert_observations(self, other, index):
508509 return self
509510
510511 def append (self , other ):
511- """Merge
512+ """Merge.
512513 """
513514 return self + other
514515
@@ -517,7 +518,7 @@ def __add__(self, other):
517518
518519 def distance (self , other ):
519520 """ Use haversine distance for distance matrix between every self and
520- other eddies"""
521+ other eddies. """
521522 return distance_grid (
522523 self .obs ["lon" ], self .obs ["lat" ], other .obs ["lon" ], other .obs ["lat" ]
523524 )
@@ -534,7 +535,7 @@ def new_like(eddies, new_size):
534535 )
535536
536537 def index (self , index , reverse = False ):
537- """Return obs from self at the index
538+ """Return obs from self at the index.
538539 """
539540 if reverse :
540541 index = reverse_index (index , len (self ))
@@ -559,7 +560,7 @@ def zarr_dimension(filename):
559560 @classmethod
560561 def load_file (cls , filename , ** kwargs ):
561562 """
562- Load the netcdf or the zarr file
563+ Load the netcdf or the zarr file.
563564
564565 Load only latitude and longitude on the first 300 obs :
565566
@@ -573,6 +574,10 @@ def load_file(cls, filename, **kwargs):
573574 indexs=dict(obs=slice(0, 300)),
574575 )
575576 small_dataset = TrackEddiesObservations.load_file(filename, **kwargs_latlon_300)
577+
578+ Default **kwargs to load zarr are : raw_data=False, remove_vars=None, include_vars=None
579+
580+ Default **kwargs to load netcdf are : raw_data=False, remove_vars=None, include_vars=None, indexs=None
576581 """
577582 filename_ = (
578583 filename .filename if isinstance (filename , ExFileObject ) else filename
@@ -843,7 +848,7 @@ def propagate(
843848 self , previous_obs , current_obs , obs_to_extend , dead_track , nb_next , model
844849 ):
845850 """
846- Filled virtual obs (C)
851+ Filled virtual obs (C).
847852
848853 :param previous_obs: previous obs from current (A)
849854 :param current_obs: previous obs from virtual (B)
@@ -902,16 +907,17 @@ def intern(flag, public_label=False):
902907 return labels
903908
904909 def match (self , other , method = "overlap" , intern = False , cmin = 0 , ** kwargs ):
905- """Return index and score computed with the chosen method on the effective contour
910+ """Return index and score computed on the effective contour.
906911
907912 :param EddiesObservations other: Observations to compare
908913 :param str method:
909914 - "overlap": the score is computed with contours;
910- - "circle": circles are computed and used for score
915+ - "circle": circles are computed and used for score (TODO)
911916 :param bool intern: if True, speed contour is used (default = effective contour)
912917 :param float cmin: 0 < cmin < 1, return only couples with score >= cmin
913- :param dict kwargs: look at :py:meth:`py_eddy_tracker.poly.vertice_overlap`
914- :return: return the indexes of the eddies in self coupled with eddies in other and their associated score
918+ :param dict kwargs: look at :py:meth:`vertice_overlap`
919+ :return: return the indexes of the eddies in self coupled with eddies in
920+ other and their associated score
915921 :rtype: (array(int), array(int), array(float))
916922
917923 .. minigallery:: py_eddy_tracker.EddiesObservations.match
@@ -980,13 +986,14 @@ def mask_function(self, other, distance):
980986
981987 @staticmethod
982988 def cost_function (records_in , records_out , distance ):
983- """Return cost function between obs to associate
989+ """Return the cost function between two obs.
984990
985- .. code-block:: python
991+ .. math::
986992
987- cost = sqrt(((amplitude_in - amplitude_out) / amplitude_in) ** 2 +
988- ((speed_radius_in - speed_radius_out) / speed_radius_in) ** 2 +
989- (distance / 125) ** 2)
993+ cost = \sqrt{({Amp_{_{in}} - Amp_{_{out}} \over Amp_{_{in}}}) ^2 +
994+ ({Rspeed_{_{in}} - Rspeed_{_{out}} \over Rspeed_{_{in}}}) ^2 +
995+ ({distance \over 125}) ^2
996+ }
990997
991998 :param records_in: starting observations
992999 :param records_out: observations to associate
@@ -1098,7 +1105,7 @@ def solve_conflict(cost):
10981105
10991106 @staticmethod
11001107 def solve_simultaneous (cost ):
1101- """Write something"""
1108+ """Write something (TODO) """
11021109 mask = ~ cost .mask
11031110 # Count number of link by self obs and other obs
11041111 self_links = mask .sum (axis = 1 )
@@ -1470,7 +1477,7 @@ def set_global_attr_netcdf(self, h_nc):
14701477
14711478 def extract_with_area (self , area , ** kwargs ):
14721479 """
1473- Extract geographically with a bounding box
1480+ Extract geographically with a bounding box.
14741481
14751482 :param dict area: 4 coordinates in a dictionary to specify bounding box (lower left corner and upper right corner)
14761483 :param dict kwargs: look at :py:meth:`extract_with_mask`
@@ -1491,7 +1498,7 @@ def extract_with_area(self, area, **kwargs):
14911498
14921499 def extract_with_mask (self , mask ):
14931500 """
1494- Extract a subset of observations
1501+ Extract a subset of observations.
14951502
14961503 :param array(bool) mask: mask to select observations
14971504 :return: same object with selected observations
@@ -1517,6 +1524,8 @@ def extract_with_mask(self, mask):
15171524
15181525 def scatter (self , ax , name = None , ref = None , factor = 1 , ** kwargs ):
15191526 """
1527+ Scatter data.
1528+
15201529 :param matplotlib.axes.Axes ax: matplotlib axe used to draw
15211530 :param str, None name:
15221531 variable used to fill the contour, if None all elements have the same color
0 commit comments