    def compute_forecast(self):
        """
        Generate a nowcast ensemble by using the Short-Term Ensemble Prediction
        System (STEPS) method.

        Parameters
        ----------
        precip: array-like
            Array of shape (ar_order+1,m,n) containing the input precipitation fields
            ordered by timestamp from oldest to newest. The time steps between the
            inputs are assumed to be regular.
        velocity: 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. All values are required to be finite.
        timesteps: int or list of floats
            Number of time steps to forecast or a list of time steps for which the
            forecasts are computed (relative to the input time step). The elements
            of the list are required to be in ascending order.
        config: StepsNowcasterConfig
            Provides a set of configuration parameters for the nowcast ensemble generation.

        Returns
        -------
        out: ndarray
            If return_output is True, a four-dimensional array of shape
            (n_ens_members,num_timesteps,m,n) containing a time series of forecast
            precipitation fields for each ensemble member. Otherwise, a None value
            is returned. The time series starts from t0+timestep, where timestep is
            taken from the input precipitation 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).

        See also
        --------
        pysteps.extrapolation.interface, pysteps.cascade.interface,
        pysteps.noise.interface, pysteps.noise.utils.compute_noise_stddev_adjs

        References
        ----------
        :cite:`Seed2003`, :cite:`BPS2006`, :cite:`SPN2013`, :cite:`PCH2019b`
        """
        self.__check_inputs()
        self.__print_forecast_info()
        # Measure time for initialization
        if self.__config.measure_time:
            self.__start_time_init = time.time()

        # Slice the precipitation field to only use the last ar_order + 1 fields
        self.__precip = self.__precip[-(self.__config.ar_order + 1) :, :, :].copy()
        self.__initialize_nowcast_components()
        if check_norain(
            self.__precip,
            self.__config.precip_threshold,
            self.__config.norain_threshold,
            self.__params.noise_kwargs["win_fun"],
        ):
            return zero_precipitation_forecast(
                self.__config.n_ens_members,
                self.__time_steps,
                self.__precip,
                self.__config.callback,
                self.__config.return_output,
                self.__config.measure_time,
                self.__start_time_init,
            )

        self.__perform_extrapolation()
        self.__apply_noise_and_ar_model()
        self.__initialize_velocity_perturbations()
        self.__initialize_precipitation_mask()
        self.__initialize_fft_objects()
        # Measure and print initialization time
        if self.__config.measure_time:
            self.__init_time = self.__measure_time(
                "Initialization", self.__start_time_init
            )

        # Run the main nowcast loop
        self.__nowcast_main()

        # Unstack nowcast output if return_output is True
        if self.__config.measure_time:
            (
                self.__state.precip_forecast,
                self.__mainloop_time,
            ) = self.__state.precip_forecast

        # Stack and return the forecast output
        if self.__config.return_output:
            self.__state.precip_forecast = np.stack(
                [
                    np.stack(self.__state.precip_forecast[j])
                    for j in range(self.__config.n_ens_members)
                ]
            )
            if self.__config.measure_time:
                return (
                    self.__state.precip_forecast,
                    self.__init_time,
                    self.__mainloop_time,
                )
            else:
                return self.__state.precip_forecast
        else:
            return None
Generate a nowcast ensemble by using the Short-Term Ensemble Prediction
System (STEPS) method.

Parameters
----------
precip: array-like
Array of shape (ar_order+1,m,n) containing the input precipitation fields
ordered by timestamp from oldest to newest. The time steps between the
inputs are assumed to be regular.
velocity: 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. All values are required to be finite.
timesteps: int or list of floats
Number of time steps to forecast or a list of time steps for which the
forecasts are computed (relative to the input time step). The elements
of the list are required to be in ascending order.
config: StepsNowcasterConfig
Provides a set of configuration parameters for the nowcast ensemble generation.

Returns
-------
out: ndarray
If return_output is True, a four-dimensional array of shape
(n_ens_members,num_timesteps,m,n) containing a time series of forecast
precipitation fields for each ensemble member. Otherwise, a None value
is returned. The time series starts from t0+timestep, where timestep is
taken from the input precipitation 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).

See also
--------
pysteps.extrapolation.interface, pysteps.cascade.interface,
pysteps.noise.interface, pysteps.noise.utils.compute_noise_stddev_adjs

References
----------
:cite:`Seed2003`, :cite:`BPS2006`, :cite:`SPN2013`, :cite:`PCH2019b`
pysteps/nowcasts/steps.py