Skip to content

Commit 80799a0

Browse files
committed
Merge branch 'master' of https://github.com/pySTEPS/pysteps
2 parents c81f90f + 4567643 commit 80799a0

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

pysteps/motion/vet.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -337,25 +337,30 @@ def vet(input_images,
337337
338338
This algorithm computes the displacement field between two images
339339
( the input_image with respect to the template image).
340-
The displacement is sought by minimizing sum of the residuals of the
340+
The displacement is sought by minimizing the sum of the residuals of the
341341
squared differences of the images pixels and the contribution of a
342-
smoothness constrain.
342+
smoothness constraint.
343+
In the case that a MaskedArray is used as input, the residuals term in
344+
the cost function is only computed over areas with non-masked values.
345+
Otherwise, it is computed over the entire domain.
343346
344-
In order to find the minimum an scaling guess procedure is applied,
345-
from larger scales
346-
to a finer scale. This reduces the changes that the minimization procedure
347-
converges to a local minimum. The scaling guess is defined by the scaling
348-
sectors (see **sectors** keyword).
347+
To find the minimum, a scaling guess procedure is applied,
348+
from larger to smaller scales.
349+
This reduces the chances that the minimization procedure
350+
converges to a local minimum.
351+
The first scaling guess is defined by the scaling sectors keyword.
349352
350353
The smoothness of the returned displacement field is controlled by the
351-
smoothness constrain gain (**smooth_gain** keyword).
354+
smoothness constraint gain (**smooth_gain** keyword).
352355
353-
If a first guess is not given, zero displacements are used as first guess.
356+
If a first guess is not given, zero displacements are used as the first
357+
guess.
354358
355-
To minimize the cost function, the `scipy minimization`_ function is used
356-
with the 'CG' method. This method proved to give the best results under
357-
any different conditions and is the most similar one to the original VET
358-
implementation in `Laroche and Zawadzki (1995)`_.
359+
The cost function is minimized using the `scipy minimization`_ function,
360+
with the 'CG' method by default.
361+
This method proved to give the best results under many different conditions
362+
and is the most similar one to the original VET implementation in
363+
`Laroche and Zawadzki (1995)`_.
359364
360365
361366
The method CG uses a nonlinear conjugate gradient algorithm by Polak and
@@ -385,10 +390,10 @@ def vet(input_images,
385390
The expected dimensions are (2,ni,nj).
386391
387392
sectors : list or array, optional
388-
The number of sectors for each dimension used in the scaling procedure.
393+
Number of sectors on each dimension used in the scaling procedure.
389394
If dimension is 1, the same sectors will be used both image dimensions
390-
(x and y). If is 2D, the each row determines the sectors of the
391-
each dimension.
395+
(x and y). If **sectors** is a 1D array, the same number of sectors
396+
is used in both dimensions.
392397
393398
smooth_gain : float, optional
394399
Smooth gain factor

pysteps/nowcasts/sprog.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ def forecast(R, V, n_timesteps, n_cascade_levels=6, R_thr=None,
5151
Number of time steps to forecast.
5252
n_cascade_levels : int, optional
5353
The number of cascade levels to use.
54-
R_thr : float, optional
55-
Specifies the threshold value for minimum observable precipitation
56-
intensity. Required if mask_method is not None or conditional is True.
54+
R_thr : float
55+
The threshold value for minimum observable precipitation intensity.
5756
extrap_method : str, optional
5857
Name of the extrapolation method to use. See the documentation of
5958
pysteps.extrapolation.interface.
@@ -126,9 +125,6 @@ def forecast(R, V, n_timesteps, n_cascade_levels=6, R_thr=None,
126125
if np.any(~np.isfinite(V)):
127126
raise ValueError("V contains non-finite values")
128127

129-
if conditional and R_thr is None:
130-
raise ValueError("conditional=True but R_thr is not set")
131-
132128
print("Computing S-PROG nowcast:")
133129
print("-------------------------")
134130
print("")
@@ -154,9 +150,7 @@ def forecast(R, V, n_timesteps, n_cascade_levels=6, R_thr=None,
154150
print("parallel threads: %d" % num_workers)
155151
print("number of cascade levels: %d" % n_cascade_levels)
156152
print("order of the AR(p) model: %d" % ar_order)
157-
158-
if conditional:
159-
print("precip. intensity threshold: %g" % R_thr)
153+
print("precip. intensity threshold: %g" % R_thr)
160154

161155
if measure_time:
162156
starttime_init = time.time()

0 commit comments

Comments
 (0)