def _sal_scaled_volume(precip_objects):
    """
    Calculate the scaled volume based on :cite:`WPHF2008`.

    Parameters
    ----------
    precip_objects: pd.DataFrame
        Dataframe containing all detected cells and their respective properties
        as returned by the :py:func:`pysteps.verification.salsscores._sal_detect_objects`
        function.

    Returns
    -------
    total_scaled_volum: float
        The total scaled volume of precipitation objects.
    """
    if not PANDAS_IMPORTED:
        raise MissingOptionalDependency(
            "The pandas package is required for the SAL "
            "verification method but it is not installed"
        )
    objects_volume_scaled = []
    for _, precip_object in precip_objects.iterrows():
        intensity_sum = np.nansum(precip_object.intensity_image)
        max_intensity = precip_object.max_intensity
        if intensity_sum == 0:
            intensity_vol = 0
        else:
            volume_scaled = intensity_sum / max_intensity
            tot_vol = intensity_sum * volume_scaled
            intensity_vol = tot_vol

        objects_volume_scaled.append(
            {"intensity_vol": intensity_vol, "intensity_sum_obj": intensity_sum}
        )
    df_vols = pd.DataFrame(objects_volume_scaled)

    if df_vols.empty or (df_vols["intensity_sum_obj"] == 0).all():
        total_scaled_volum = 0
    else:
        total_scaled_volum = np.nansum(df_vols.intensity_vol) / np.nansum(
            df_vols.intensity_sum_obj
        )
    return total_scaled_volum
Calculate the scaled volume based on :cite:`WPHF2008`.

Parameters
----------
precip_objects: pd.DataFrame
Dataframe containing all detected cells and their respective properties
as returned by the :py:func:`pysteps.verification.salsscores._sal_detect_objects`
function.

Returns
-------
total_scaled_volum: float
The total scaled volume of precipitation objects.
pysteps/verification/salscores.py