def calc_clim_skill(
    outdir_path,
    n_cascade_levels=6,
    n_models=1,
    window_length=30,
):
    """
    Return the climatological skill based on the daily average skill in the
    rolling window. This is done using a geometric mean.

    Parameters
    ----------
    n_cascade_levels: int, optional
      Number of cascade levels. Defaults to 6, see issue #385 on GitHub.
    outdir_path: string
      Path to folder where the historical skill are stored. Defaults to
      path_workdir from rcparams.
    n_models: int, optional
      Number of NWP models. Defaults to 1.
    window_length: int, optional
      Length of window (in days) over which to compute the climatological
      skill. Defaults to 30.

    Returns
    -------
    climatological_mean_skill: array-like
      Array of shape [model, scale_level, ...] containing the climatological
      (geometric) mean skill.

    """
    past_skill_file = Path(outdir_path) / "NWP_skill_window.npy"
    # past_skill has dimensions date x model x scale_level  x ....
    if past_skill_file.is_file():
        past_skill = np.load(past_skill_file)
    else:
        past_skill = np.array(None)
    # check if there is enough data to compute the climatological skill
    if not past_skill.any():
        return get_default_skill(n_cascade_levels, n_models)
    elif past_skill.shape[0] < window_length:
        return get_default_skill(n_cascade_levels, n_models)
    # reduce window if necessary
    else:
        past_skill = past_skill[-window_length:]

    # Make sure past_skill cannot be lower than 10e-5
    past_skill = np.where(past_skill < 10e-5, 10e-5, past_skill)

    # Calculate climatological skill from the past_skill using the
    # geometric mean.
    geomean_skill = np.exp(np.log(past_skill).mean(axis=0))

    # Make sure skill is always a positive value and a finite value
    geomean_skill = np.where(geomean_skill < 10e-5, 10e-5, geomean_skill)
    geomean_skill = np.nan_to_num(
        geomean_skill, copy=True, nan=10e-5, posinf=10e-5, neginf=10e-5
    )

    return geomean_skill
Return the climatological skill based on the daily average skill in the
rolling window. This is done using a geometric mean.

Parameters
----------
n_cascade_levels: int, optional
Number of cascade levels. Defaults to 6, see issue #385 on GitHub.
outdir_path: string
Path to folder where the historical skill are stored. Defaults to
path_workdir from rcparams.
n_models: int, optional
Number of NWP models. Defaults to 1.
window_length: int, optional
Length of window (in days) over which to compute the climatological
skill. Defaults to 30.

Returns
-------
climatological_mean_skill: array-like
Array of shape [model, scale_level, ...] containing the climatological
(geometric) mean skill.
pysteps/blending/clim.py