Implementation of blending methods for blending (ensemble) nowcasts with Numerical Weather Prediction (NWP) models.


Interface for the blending module. It returns a callable function for computing blended nowcasts with NWP models.


Return a callable function for computing nowcasts blending into an NWP forecast.


Module with methods to read, write and compute past and climatological NWP model skill scores. The module stores the average daily skill score for the past t days and updates it every day. The resulting average climatological skill score is the skill the NWP model skill regresses to during the blended forecast. If no climatological values are present, the default skill from [BPS06] is used.

get_default_skill([n_cascade_levels, n_models])

Get the default climatological skill values as given in [BPS06].

save_skill(current_skill, validtime, outdir_path)

Add the current NWP skill to update today's daily average skill.

calc_clim_skill(outdir_path[, ...])

Return the climatological skill based on the daily average skill in the rolling window.


Linear blending method to blend (ensemble) nowcasts and (ensemble) Numerical Weather Prediction (NWP) forecasts. The method uses a predefined start and end time for the blending. Before this start time, the resulting blended forecasts only consists of the nowcast(s). In between the start and end time, the nowcast(s) weight decreases and NWP forecasts weight increases linearly from 1(0) to 0(1). After the end time, the blended forecast entirely consists of the NWP forecasts. The saliency-based blending method also takes into account the pixel intensities and preserves them if they are strong enough based on their ranked salience.

Implementation of the linear blending and saliency-based blending between nowcast and NWP data.

forecast(precip, precip_metadata, velocity, ...)

Generate a forecast by linearly or saliency-based blending of nowcasts with NWP data


Methods for computing skill scores, needed for the blending weights, of two- dimensional model fields with the latest observation field.

spatial_correlation(obs, mod, domain_mask)

Determine the spatial correlation between the cascade of the latest available observed (radar) rainfall field and a time-synchronous cascade derived from a model (generally NWP) field.

lt_dependent_cor_nwp(lt, correlations, ...)

Determine the correlation of a model field for lead time lt and cascade k, by assuming that the correlation determined at t=0 regresses towards the climatological values.

lt_dependent_cor_extrapolation(PHI[, ...])

Determine the correlation of the extrapolation (nowcast) component for lead time lt and cascade k, by assuming that the correlation determined at t=0 regresses towards the climatological values.

clim_regr_values(n_cascade_levels, outdir_path)

Obtains the climatological correlation values and regression parameters from a file called NWP_weights_window.bin in the outdir_path.


Implementation of the STEPS stochastic blending method as described in [BPS04], [BPS06] and [SPN13]. The STEPS blending method consists of the following main steps:

  1. Set the radar rainfall fields in a Lagrangian space.

  2. Perform the cascade decomposition for the input radar rainfall fields. The method assumes that the cascade decomposition of the NWP model fields is already done prior to calling the function, as the NWP model fields are generally not updated with the same frequency (which is more efficient). A method to decompose and store the NWP model fields whenever a new NWP model field is present, is present in pysteps.blending.utils.decompose_NWP.

  3. Initialize the noise method.

  4. Estimate AR parameters for the extrapolation nowcast and noise cascade.

  5. Initialize all the random generators.

  6. Calculate the initial skill of the NWP model forecasts at t=0.

  7. Start the forecasting loop:
    1. Determine which NWP models will be combined with which nowcast ensemble member. The number of output ensemble members equals the maximum number of (ensemble) members in the input, which can be either the defined number of (nowcast) ensemble members or the number of NWP models/members.

    2. Determine the skill and weights of the forecasting components (extrapolation, NWP and noise) for that lead time.

    3. Regress the extrapolation and noise cascades separately to the subsequent time step.

    4. Extrapolate the extrapolation and noise cascades to the current time step.

    5. Blend the cascades.

    6. Recompose the cascade to a rainfall field.

    7. Post-processing steps (masking and probability matching, which are different from the original blended STEPS implementation).

forecast(precip, precip_models, velocity, ...)

Generate a blended nowcast ensemble by using the Short-Term Ensemble Prediction System (STEPS) method.


Calculate explained variance ratios from correlation.


Calculate BPS blending weights for STEPS blending from correlation.

calculate_weights_spn(correlations, cov)

Calculate SPN blending weights for STEPS blending from correlation.

blend_means_sigmas(means, sigmas, weights)

Calculate the blended means and sigmas, the normalization parameters needed to recompose the cascade.


Module with common utilities used by the blending methods.

stack_cascades(R_d[, donorm])

Stack the given cascades into a larger array.

blend_cascades(cascades_norm, weights)

Calculate blended normalized cascades using STEPS weights following eq.

recompose_cascade(combined_cascade, ...)

Recompose the cascades into a transformed rain rate field.

blend_optical_flows(flows, weights)

Combine advection fields using given weights.

decompose_NWP(R_NWP, NWP_model, ...[, ...])

Decomposes the NWP forecast data into cascades and saves it in a netCDF file

compute_store_nwp_motion(precip_nwp, ...)

Computes, per forecast lead time, the velocity field of an NWP model field.

load_NWP(input_nc_path_decomp, ...)

Loads the decomposed NWP and velocity data from the netCDF files

check_norain(precip_arr[, precip_thr, ...])

param precip_arr:

Array containing the input precipitation field