3030@njit (cache = True )
3131def count_consecutive (mask ):
3232 """
33- Count consecutive event every False flag count restart
33+ Count consecutive events every False flag count restart
3434
3535 :param array[bool] mask: event to count
3636 :return: count when consecutive event
@@ -50,7 +50,7 @@ def count_consecutive(mask):
5050@njit (cache = True )
5151def reverse_index (index , nb ):
5252 """
53- Compute a list of index , which are not in index.
53+ Compute a list of indexes , which are not in index.
5454
5555 :param array index: index of group which will be set to False
5656 :param array nb: Count for each group
@@ -65,25 +65,25 @@ def reverse_index(index, nb):
6565
6666@njit (cache = True )
6767def build_index (groups ):
68- """We expected that variable is monotonous, and return index for each step change.
68+ """We expect that variable is monotonous, and return index for each step change.
6969
70- :param array groups: array which contain group to be separated
71- :return: (first_index of each group, last_index of each group, value to shift group )
70+ :param array groups: array that contains groups to be separated
71+ :return: (first_index of each group, last_index of each group, value to shift groups )
7272 :rtype: (array, array, int)
73-
7473 Examples
7574 --------
7675 >>> build_index(array((1, 1, 3, 4, 4)))
7776 (array([0, 2, 2, 3]), array([2, 2, 3, 5]), 1)
7877 """
78+
7979 i0 , i1 = groups .min (), groups .max ()
8080 amplitude = i1 - i0 + 1
8181 # Index of first observation for each group
8282 first_index = zeros (amplitude , dtype = numba_types .int_ )
8383 for i , group in enumerate (groups [:- 1 ]):
8484 # Get next value to compare
8585 next_group = groups [i + 1 ]
86- # if different we need to set index for all group between the 2 values
86+ # if different we need to set index for all groups between the 2 values
8787 if group != next_group :
8888 first_index [group - i0 + 1 : next_group - i0 + 1 ] = i + 1
8989 last_index = zeros (amplitude , dtype = numba_types .int_ )
@@ -95,21 +95,21 @@ def build_index(groups):
9595
9696@njit (cache = True )
9797def hist_numba (x , bins ):
98- """Call numba histogram to speed up."""
98+ """Call numba histogram to speed up."""
9999 return histogram (x , bins )
100100
101101
102102@njit (cache = True , fastmath = True , parallel = False )
103103def distance_grid (lon0 , lat0 , lon1 , lat1 ):
104104 """
105- Get distance for every couple of point .
105+ Get distance for every couple of points .
106106
107107 :param array lon0:
108108 :param array lat0:
109109 :param array lon1:
110110 :param array lat1:
111111
112- :return: nan value for far away point , and km for other
112+ :return: nan value for far away points , and km for other
113113 :rtype: array
114114 """
115115 nb_0 = lon0 .shape [0 ]
@@ -164,7 +164,7 @@ def cumsum_by_track(field, track):
164164 Cumsum by track.
165165
166166 :param array field: data to sum
167- :pram array(int) track: id of track to separate data
167+ :pram array(int) track: id of trajectories to separate data
168168 :return: cumsum with a reset at each start of track
169169 :rtype: array
170170 """
@@ -192,7 +192,7 @@ def interp2d_geo(x_g, y_g, z_g, m_g, x, y, nearest=False):
192192 :param array m_g: Boolean grid, True if value is masked
193193 :param array x: coordinate where interpolate z
194194 :param array y: coordinate where interpolate z
195- :param bool nearest: if true we will take nearest pixel
195+ :param bool nearest: if True we will take nearest pixel
196196 :return: z interpolated
197197 :rtype: array
198198 """
@@ -256,17 +256,17 @@ def interp2d_bilinear(x_g, y_g, z_g, m_g, x, y):
256256 nb_x = x_g .shape [0 ]
257257 nb_y = y_g .shape [0 ]
258258 is_circular = abs (x_g [- 1 ] % 360 - (x_g [0 ] - x_step ) % 360 ) < 1e-5
259- # Indices which should be never exist
259+ # Indexes that should never exist
260260 i0_old , j0_old , masked = - 100000000 , - 10000000 , False
261261 z = empty (x .shape , dtype = z_g .dtype )
262262 for i in prange (x .size ):
263263 x_ = (x [i ] - x_ref ) / x_step
264264 y_ = (y [i ] - y_ref ) / y_step
265265 i0 = int (floor (x_ ))
266- # To keep original value if wrapping apply to compute xd
266+ # To keep original values if wrapping applied to compute xd
267267 i0_ = i0
268268 j0 = int (floor (y_ ))
269- # corner are the same need only a new xd and yd
269+ # corners are the same need only a new xd and yd
270270 if i0 != i0_old or j0 != j0_old :
271271 i1 = i0 + 1
272272 j1 = j0 + 1
@@ -288,7 +288,7 @@ def interp2d_bilinear(x_g, y_g, z_g, m_g, x, y):
288288 z_g [i1 , j1 ],
289289 )
290290 masked = False
291- # Need to be store only on change
291+ # Need to be stored only on change
292292 i0_old , j0_old = i0 , j0
293293 if masked :
294294 z [i ] = nan
@@ -359,17 +359,17 @@ def flatten_line_matrix(l_matrix):
359359@njit (cache = True )
360360def simplify (x , y , precision = 0.1 ):
361361 """
362- Will remove all middle/end point which are closer than precision.
362+ Will remove all middle/end points closer than precision.
363363
364364 :param array x:
365365 :param array y:
366- :param float precision: if two points have distance inferior to precision with remove next point
366+ :param float precision: if two points have distance inferior to precision we remove next point
367367 :return: (x,y)
368368 :rtype: (array,array)
369369 """
370370 precision2 = precision ** 2
371371 nb = x .shape [0 ]
372- # will be True for value keep
372+ # will be True for kept values
373373 mask = ones (nb , dtype = bool_ )
374374 for j in range (0 , nb ):
375375 x_previous , y_previous = x [j ], y [j ]
@@ -423,7 +423,7 @@ def split_line(x, y, i):
423423 :param y: array
424424 :param i: array of int at each i change, we cut x, y
425425
426- :return: x and y separate by nan at each i jump
426+ :return: x and y separated by nan at each i jump
427427 """
428428 nb_jump = len (where (i [1 :] - i [:- 1 ] != 0 )[0 ])
429429 nb_value = x .shape [0 ]
@@ -445,11 +445,11 @@ def split_line(x, y, i):
445445@njit (cache = True )
446446def wrap_longitude (x , y , ref , cut = False ):
447447 """
448- Will wrap contiguous longitude with reference as west bound .
448+ Will wrap contiguous longitude with reference as western boundary .
449449
450450 :param array x:
451451 :param array y:
452- :param float ref: longitude of reference, all the new value will be between ref and ref + 360
452+ :param float ref: longitude of reference, all the new values will be between ref and ref + 360
453453 :param bool cut: if True line will be cut at the bounds
454454 :return: lon,lat
455455 :rtype: (array,array)
@@ -557,7 +557,7 @@ def local_to_coordinates(x, y, lon0, lat0):
557557@njit (cache = True , fastmath = True )
558558def nearest_grd_indice (x , y , x0 , y0 , xstep , ystep ):
559559 """
560- Get nearest grid indice from a position.
560+ Get nearest grid index from a position.
561561
562562 :param x: longitude
563563 :param y: latitude
@@ -575,7 +575,7 @@ def nearest_grd_indice(x, y, x0, y0, xstep, ystep):
575575@njit (cache = True )
576576def bbox_indice_regular (vertices , x0 , y0 , xstep , ystep , N , circular , x_size ):
577577 """
578- Get bbox indice of a contour in a regular grid.
578+ Get bbox index of a contour in a regular grid.
579579
580580 :param vertices: vertice of contour
581581 :param float x0: first grid longitude
0 commit comments