pysteps.extrapolation.semilagrangian.extrapolate¶
-
pysteps.extrapolation.semilagrangian.
extrapolate
(precip, velocity, timesteps, outval=nan, xy_coords=None, allow_nonfinite_values=False, vel_timestep=None, **kwargs)¶ Apply semi-Lagrangian backward extrapolation to a two-dimensional precipitation field.
Parameters: - precip : array-like
Array of shape (m,n) containing the input precipitation field. All values are required to be finite by default.
- velocity : array-like
Array of shape (2,m,n) containing the x- and y-components of the m*n advection field. All values are required to be finite by default.
- timesteps : int or list
If timesteps is integer, it specifies the number of time steps to extrapolate. If a list is given, each element is the desired extrapolation time step from the current time. In this case, the vel_timestep argument must be specified.
- outval : float, optional
Optional argument for specifying the value for pixels advected from outside the domain. If outval is set to ‘min’, the value is taken as the minimum value of R. Default : np.nan
- xy_coords : ndarray, optional
Array with the coordinates of the grid dimension (2, m, n ).
- xy_coords[0] : x coordinates
- xy_coords[1] : y coordinates
By default, the xy_coords are computed for each extrapolation.
- allow_nonfinite_values : bool, optional
If True, allow non-finite values in the precipitation and advection fields. This option is useful if the input fields contain a radar mask (i.e. pixels with no observations are set to nan).
Returns: - out : array or tuple
If return_displacement=False, return a time series extrapolated fields of shape (num_timesteps,m,n). Otherwise, return a tuple containing the extrapolated fields and the total displacement along the advection trajectory.
Other Parameters: - D_prev : array-like
Optional initial displacement vector field of shape (2,m,n) for the extrapolation. Default : None
- n_iter : int
Number of inner iterations in the semi-Lagrangian scheme. If n_iter > 0, the integration is done using the midpoint rule. Otherwise, the advection vectors are taken from the starting point of each interval. Default : 1
- return_displacement : bool
If True, return the total advection velocity (displacement) between the initial input field and the advected one integrated along the trajectory. Default : False
- vel_timestep : float
The time step of the velocity field. It is assumed to have the same unit as the timesteps argument.
References
[GZ2002] Germann et al (2002)