def intensity_scale_merge(intscale_1, intscale_2):
    """
    Merge two intensity-scale verification objects.

    Parameters
    ----------
    intscale_1: dict
        Am intensity-scale object initialized with
        :py:func:`pysteps.verification.spatialscores.intensity_scale_init`
        and populated with
        :py:func:`pysteps.verification.spatialscores.intensity_scale_accum`.
    intscale_2: dict
        Another intensity-scale object initialized with
        :py:func:`pysteps.verification.spatialscores.intensity_scale_init`
        and populated with
        :py:func:`pysteps.verification.spatialscores.intensity_scale_accum`.

    Returns
    -------
    out: dict
      The merged intensity-scale object.
    """

    # checks
    if intscale_1["name"] != intscale_2["name"]:
        raise ValueError(
            "cannot merge: the intensity scale methods are not same %s!=%s"
            % (intscale_1["name"], intscale_2["name"])
        )

    intscale = intscale_1.copy()
    name = intscale["name"]
    thrs = intscale["thrs"]
    scales = intscale["scales"]

    for i, thr in enumerate(thrs):
        if name.lower() == "bmse":
            intscale[thr] = binary_mse_merge(intscale[thr], intscale_2[thr])

        elif name.lower() == "fss":
            for j, scale in enumerate(scales):
                intscale[thr][scale] = fss_merge(
                    intscale[thr][scale], intscale_2[thr][scale]
                )

    return intscale
Merge two intensity-scale verification objects.

Parameters
----------
intscale_1: dict
Am intensity-scale object initialized with
:py:func:`pysteps.verification.spatialscores.intensity_scale_init`
and populated with
:py:func:`pysteps.verification.spatialscores.intensity_scale_accum`.
intscale_2: dict
Another intensity-scale object initialized with
:py:func:`pysteps.verification.spatialscores.intensity_scale_init`
and populated with
:py:func:`pysteps.verification.spatialscores.intensity_scale_accum`.

Returns
-------
out: dict
The merged intensity-scale object.
pysteps/verification/spatialscores.py