def load_NWP(input_nc_path_decomp, input_path_velocities, start_time, n_timesteps):
    """Loads the decomposed NWP and velocity data from the netCDF files

    Parameters
    ----------
    input_nc_path_decomp: str
      Path to the saved netCDF file containing the decomposed NWP data.
    input_path_velocities: str
        Path to the saved numpy binary file containing the estimated velocity
        fields from the NWP data.
    start_time: numpy.datetime64
      The start time of the nowcasting. Assumed to be a numpy.datetime64 type
    n_timesteps: int
      Number of time steps to forecast

    Returns
    -------
    R_d: list
      A list of dictionaries with each element in the list corresponding to
      a different time step. Each dictionary has the same structure as the
      output of the decomposition function
    uv: array-like
        Array of shape (timestep,2,m,n) containing the x- and y-components
      of the advection field for the (NWP) model field per forecast lead time.
    """

    if not NETCDF4_IMPORTED:
        raise MissingOptionalDependency(
            "netCDF4 package is required to load the decomposed NWP data, "
            "but it is not installed"
        )

    # Open the file
    ncf_decomp = netCDF4.Dataset(input_nc_path_decomp, "r", format="NETCDF4")
    velocities = np.load(input_path_velocities)

    decomp_dict = {
        "domain": ncf_decomp.domain,
        "normalized": bool(ncf_decomp.normalized),
        "compact_output": bool(ncf_decomp.compact_output),
    }

    # Convert the start time and the timestep to datetime64 and timedelta64 type
    zero_time = np.datetime64("1970-01-01T00:00:00", "ns")
    analysis_time = np.timedelta64(int(ncf_decomp.analysis_time), "ns") + zero_time

    timestep = ncf_decomp.timestep
    timestep = np.timedelta64(timestep, "m")

    valid_times = ncf_decomp.variables["valid_times"][:]
    valid_times = np.array(
        [np.timedelta64(int(valid_times[i]), "ns") for i in range(len(valid_times))]
    )
    valid_times = valid_times + zero_time

    # Find the indices corresponding with the required start and end time
    start_i = (start_time - analysis_time) // timestep
    assert analysis_time + start_i * timestep == start_time
    end_i = start_i + n_timesteps + 1

    # Check if the requested end time (the forecast horizon) is in the stored data.
    # If not, raise an error
    if end_i > ncf_decomp.variables["pr_decomposed"].shape[0]:
        raise IndexError(
            "The requested forecast horizon is outside the stored NWP forecast horizon. Either request a shorter forecast horizon or store a longer NWP forecast horizon"
        )

    # Add the valid times to the output
    decomp_dict["valid_times"] = valid_times[start_i:end_i]

    # Slice the velocity fields with the start and end indices
    uv = velocities[start_i:end_i, :, :, :]

    # Initialise the list of dictionaries which will serve as the output (cf: the STEPS function)
    R_d = list()

    pr_decomposed = ncf_decomp.variables["pr_decomposed"][start_i:end_i, :, :, :]
    means = ncf_decomp.variables["means"][start_i:end_i, :]
    stds = ncf_decomp.variables["stds"][start_i:end_i, :]

    for i in range(n_timesteps + 1):
        decomp_dict["cascade_levels"] = np.ma.filled(
            pr_decomposed[i], fill_value=np.nan
        )
        decomp_dict["means"] = np.ma.filled(means[i], fill_value=np.nan)
        decomp_dict["stds"] = np.ma.filled(stds[i], fill_value=np.nan)

        R_d.append(decomp_dict.copy())

    ncf_decomp.close()
    return R_d, uv
Loads the decomposed NWP and velocity data from the netCDF files

Parameters
----------
input_nc_path_decomp: str
Path to the saved netCDF file containing the decomposed NWP data.
input_path_velocities: str
Path to the saved numpy binary file containing the estimated velocity
fields from the NWP data.
start_time: numpy.datetime64
The start time of the nowcasting. Assumed to be a numpy.datetime64 type
n_timesteps: int
Number of time steps to forecast

Returns
-------
R_d: list
A list of dictionaries with each element in the list corresponding to
a different time step. Each dictionary has the same structure as the
output of the decomposition function
uv: array-like
Array of shape (timestep,2,m,n) containing the x- and y-components
of the advection field for the (NWP) model field per forecast lead time.
pysteps/blending/utils.py