Skip to content

Commit 35225cb

Browse files
committed
Fix incomplete docstring
1 parent bd1888b commit 35225cb

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

pysteps/optflow/lucaskanade.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -321,41 +321,44 @@ def clean_image(R, n=3, thr=0):
321321
R[mask] = np.nanmin(R)
322322

323323
return R
324-
324+
325325
def declustering(x, y, u, v, decl_grid, min_nr_samples):
326-
"""
327-
Filter out outliers and get more representative data points.
328-
It assigns data points to a (RxR) declustering grid and then take the median of all values within one cell.
326+
"""Filter out outliers in a sparse motion field and get more representative
327+
data points. The method assigns data points to a (RxR) declustering grid
328+
and then take the median of all values within one cell.
329329
330330
Parameters
331331
----------
332-
x0 :
333-
y0 :
334-
u :
335-
v :
332+
x : array_like
333+
x-coordinates of the origins of the velocity vectors
334+
y : array_like
335+
y-coordinates of the origins of the velocity vectors
336+
u : array_like
337+
x-components of the velocities
338+
v : array_like
339+
y-components of the velocities
336340
decl_grid : int
337-
Size of the declustering grid [px].
341+
size of the declustering grid [px]
338342
min_nr_samples : int
339-
The minimum number of samples for computing the median within given declustering cell.
340-
343+
the minimum number of samples for computing the median within given
344+
declustering cell
345+
341346
Returns
342347
-------
343-
x : array-like
344-
y : array-like
345-
u : array-like
346-
v : array-like
347-
348+
A four-element tuple (x,y,u,v) containing the x- and y-coordinates and
349+
velocity components of the declustered motion vectors.
350+
348351
"""
349352
# make sure these are all vertical arrays
350353
x = x[:,None]
351354
y = y[:,None]
352355
u = u[:,None]
353356
v = v[:,None]
354-
357+
355358
# discretize coordinates into declustering grid
356359
xT = x/float(decl_grid)
357360
yT = y/float(decl_grid)
358-
361+
359362
# round coordinates to low integer
360363
xT = np.floor(xT)
361364
yT = np.floor(yT)
@@ -366,7 +369,8 @@ def declustering(x, y, u, v, decl_grid, min_nr_samples):
366369
_,idx = np.unique(xyb, return_index=True)
367370
unique_xy = xy[idx]
368371

369-
# now loop through these unique values and average vectors which belong to the same declustering grid cell
372+
# now loop through these unique values and average vectors which belong to
373+
# the same declustering grid cell
370374
xN=[]; yN=[]; uN=[]; vN=[]
371375
for i in range(unique_xy.shape[0]):
372376
idx = np.logical_and(xT==unique_xy[i,0], yT==unique_xy[i,1])

0 commit comments

Comments
 (0)