Skip to content

Commit 0ba5ff4

Browse files
committed
Allow the user to choose the FFT method
1 parent aabb3af commit 0ba5ff4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pysteps/nowcasts/steps.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def forecast(R, V, n_timesteps, n_ens_members=24, n_cascade_levels=6, R_thr=None
2121
noise_method="nonparametric", noise_stddev_adj=False, ar_order=2,
2222
vel_pert_method=None, conditional=False, use_precip_mask=True,
2323
use_probmatching=True, mask_method="incremental", callback=None,
24-
return_output=True, seed=None, num_workers=None, extrap_kwargs={},
25-
filter_kwargs={}, noise_kwargs={}, vel_pert_kwargs={}):
24+
return_output=True, seed=None, num_workers=None, fft_method="numpy",
25+
extrap_kwargs={}, filter_kwargs={}, noise_kwargs={}, vel_pert_kwargs={}):
2626
"""Generate a nowcast ensemble by using the Short-Term Ensemble Prediction
2727
System (STEPS) method.
2828
@@ -106,6 +106,9 @@ def forecast(R, V, n_timesteps, n_ens_members=24, n_cascade_levels=6, R_thr=None
106106
num_workers : int
107107
The number of workers to use for parallel computation. Set to None to use
108108
all available CPUs. Applicable if dask is enabled.
109+
fft_method : str or tuple
110+
A string or a (function,kwargs) tuple defining the FFT method to use
111+
(see utils.fft.get_method). Defaults to "numpy".
109112
extrap_kwargs : dict
110113
Optional dictionary that is supplied as keyword arguments to the
111114
extrapolation method.
@@ -241,7 +244,7 @@ def forecast(R, V, n_timesteps, n_ens_members=24, n_cascade_levels=6, R_thr=None
241244
decomp_method = cascade.get_method(decomp_method)
242245
R_d = []
243246
for i in range(ar_order+1):
244-
R_ = decomp_method(R[i, :, :], filter, MASK=MASK_thr)
247+
R_ = decomp_method(R[i, :, :], filter, MASK=MASK_thr, fft_method=fft_method)
245248
R_d.append(R_)
246249

247250
# normalize the cascades and rearrange them into a four-dimensional array
@@ -397,7 +400,7 @@ def worker(j):
397400
# generate noise field
398401
EPS = generate_noise(pp, randstate=randgen_prec[j])
399402
# decompose the noise field into a cascade
400-
EPS = decomp_method(EPS, filter)
403+
EPS = decomp_method(EPS, filter, fft_method=fft_method)
401404
else:
402405
EPS = None
403406

0 commit comments

Comments
 (0)