def METHOD_NAME(data, optimal_crps_percentiles, scalar_realization):
    """Check that rebadging realizations as percentiles gives the desired output."""
    if scalar_realization:
        cube = set_up_variable_cube(ECC_TEMPERATURE_REALIZATIONS[1])
        realization_coord = DimCoord([0], standard_name="realization", units="1")
        cube.add_aux_coord(realization_coord)
        expected_data = ECC_TEMPERATURE_REALIZATIONS[1]
        percentiles = [50]
    else:
        cube = set_up_variable_cube(data, realizations=[0, 1, 2])
        expected_data = ECC_TEMPERATURE_REALIZATIONS
        if optimal_crps_percentiles:
            percentiles = [16.6666, 50, 83.3333]
        else:
            percentiles = [25, 50, 75]
    result = RebadgeRealizationsAsPercentiles(
        optimal_crps_percentiles=optimal_crps_percentiles
    )(cube)
    assert isinstance(result, Cube)
    assert len(result.coords("percentile")) == 1
    assert len(result.coords("realization")) == 0
    assert result.coord("percentile").dtype == np.float32
    assert result.coord("percentile").units == "%"
    np.testing.assert_allclose(
        result.coord("percentile").points, percentiles, atol=1e-4, rtol=1e-4
    )
    np.testing.assert_allclose(result.data, expected_data)