pysteps.nowcasts.linda.forecast
pysteps.nowcasts.linda.forecast#
- pysteps.nowcasts.linda.forecast(precip_fields, advection_field, timesteps, feature_method='blob', max_num_features=25, feature_kwargs=None, ari_order=1, kernel_type='anisotropic', localization_window_radius=None, errdist_window_radius=None, acf_window_radius=None, extrap_method='semilagrangian', extrap_kwargs=None, add_perturbations=True, pert_thrs=(0.5, 1.0), num_ens_members=10, vel_pert_method=None, vel_pert_kwargs=None, kmperpixel=None, timestep=None, seed=None, num_workers=1, use_multiprocessing=False, measure_time=False)#
Generate a deterministic or ensemble nowcast by using the Lagrangian INtegro-Difference equation model with Autoregression (LINDA) model.
- Parameters
precip_fields (array_like) – Array of shape (ari_order + 2, m, n) containing the input rain rate or reflectivity fields (in linear scale) ordered by timestamp from oldest to newest. The time steps between the inputs are assumed to be regular.
advection_field (array_like) – Array of shape (2, m, n) containing the x- and y-components of the advection field. The velocities are assumed to represent one time step between the inputs.
timesteps (int) – Number of time steps to forecast.
feature_method ({'blob', 'domain' 'shitomasi'}) –
Feature detection method:
Method name
Description
blob
Laplacian of Gaussian (LoG) blob detector implemented in scikit-image
domain
no feature detection, the model is applied over the whole domain without localization
shitomasi
Shi-Tomasi corner detector implemented in OpenCV
Default: ‘blob’
max_num_features (int, optional) – Maximum number of features to use. It is recommended to set this between 20 and 50, which gives a good tradeoff between localization and computation time. Default: 25
feature_kwargs (dict, optional) – Keyword arguments that are passed as
**kwargs
for the feature detector. Seepysteps.feature.blob
andpysteps.feature.shitomasi
.ari_order ({1, 2}, optional) – The order of the ARI(p, 1) model. Default: 1
kernel_type ({"anisotropic", "isotropic"}, optional) – The type of the kernel. Default: ‘anisotropic’
localization_window_radius (float, optional) – The standard deviation of the Gaussian localization window. Default: 0.2 * min(m, n)
errdist_window_radius (float, optional) – The standard deviation of the Gaussian window for estimating the forecast error distribution. Default: 0.15 * min(m, n)
acf_window_radius (float, optional) – The standard deviation of the Gaussian window for estimating the forecast error ACF. Default: 0.25 * min(m, n)
extrap_method (str, optional) – The extrapolation method to use. See the documentation of
pysteps.extrapolation.interface
. Default: ‘semilagrangian’extrap_kwargs (dict, optional) – Optional dictionary containing keyword arguments for the extrapolation method. See
pysteps.extrapolation.interface
.add_perturbations (bool) – Set to False to disable perturbations and generate a single deterministic nowcast. Default: True
pert_thrs (float) – Two-element tuple containing the threshold values for estimating the perturbation parameters (mm/h). Default: (0.5, 1.0)
num_ens_members (int, optional) – The number of ensemble members to generate. Default: 10
vel_pert_method ({'bps', None}, optional) – Name of the generator to use for perturbing the advection field. See
pysteps.noise.interface
. Default: Nonevel_pert_kwargs (dict, optional) – Optional dictionary containing keyword arguments ‘p_par’ and ‘p_perp’ for the initializer of the velocity perturbator. The choice of the optimal parameters depends on the domain and the used optical flow method. For the default values and parameters optimized for different domains, see
pysteps.nowcasts.steps.forecast()
.kmperpixel (float, optional) – Spatial resolution of the input data (kilometers/pixel). Required if vel_pert_method is not None.
timestep (float, optional) – Time step of the motion vectors (minutes). Required if vel_pert_method is not None.
seed (int, optional) – Optional seed for the random generators.
num_workers (int, optional) – The number of workers to use for parallel computations. Applicable if dask is installed. Default: 1
use_multiprocessing (bool, optional) – Set to True to improve the performance of certain parallelized parts of the code. If set to True, the main script calling linda.forecast must be enclosed within the ‘if __name__ == “__main__”:’ block. Default: False
measure_time (bool, optional) – If set to True, measure, print and return the computation time. Default: False
- Returns
out – A four-dimensional array of shape (num_ens_members, timesteps, m, n) containing a time series of forecast precipitation fields for each ensemble member. If add_perturbations is False, the first dimension is dropped. The time series starts from t0 + timestep, where timestep is taken from the input fields. If measure_time is True, the return value is a three-element tuple containing the nowcast array, the initialization time of the nowcast generator and the time used in the main loop (seconds).
- Return type
numpy.ndarray
Notes
It is recommended to choose the feature detector parameters so that the number of features is around 20-40. This gives a good tradeoff between localization and computation time.
It is highly recommented to set num_workers>1 to reduce computation time. In this case, it is advisable to disable OpenMP by setting the environment variable OMP_NUM_THREADS to 1. This avoids slowdown caused by too many simultaneous threads.