def matrix_type(request):
    return request.param
def _check_layer_operation(example_dict, operation_dict):
    """Error-checks layer operation.

    Such operations are used for dimensionality reduction (to convert radar data
    from 3-D to 2-D).

    :param example_dict: See doc for `reduce_examples_3d_to_2d`.
    :param operation_dict: Dictionary with the following keys.
    operation_dict["radar_field_name"]: Field to which operation will be
        applied.
    operation_dict["operation_name"]: Name of operation (must be in list
        `VALID_LAYER_OPERATION_NAMES`).
    operation_dict["min_height_m_agl"]: Minimum height of layer over which
        operation will be applied.
    operation_dict["max_height_m_agl"]: Max height of layer over which operation
        will be applied.

    :raises: ValueError: if something is wrong with the operation params.
    """

    if operation_dict[RADAR_FIELD_KEY] in AZIMUTHAL_SHEAR_FIELD_NAMES:
        error_string = (
            'Layer operations cannot be applied to azimuthal-shear fields '
            '(such as "{0:s}").'
        ).format(operation_dict[RADAR_FIELD_KEY])

        raise ValueError(error_string)

    if (operation_dict[RADAR_FIELD_KEY] == radar_utils.REFL_NAME
            and REFL_IMAGE_MATRIX_KEY in example_dict):
        pass

    else:
        if (operation_dict[RADAR_FIELD_KEY]
                not in example_dict[RADAR_FIELDS_KEY]):
            error_string = (
                '\n{0:s}\nExamples contain only radar fields listed above, '
                'which do not include "{1:s}".'
            ).format(
                str(example_dict[RADAR_FIELDS_KEY]),
                operation_dict[RADAR_FIELD_KEY]
            )

            raise ValueError(error_string)

    if operation_dict[OPERATION_NAME_KEY] not in VALID_LAYER_OPERATION_NAMES:
        error_string = (
            '\n{0:s}\nValid operations (listed above) do not include '
            '"{1:s}".'
        ).format(
            str(VALID_LAYER_OPERATION_NAMES), operation_dict[OPERATION_NAME_KEY]
        )

        raise ValueError(error_string)

    min_height_m_agl = operation_dict[MIN_HEIGHT_KEY]
    max_height_m_agl = operation_dict[MAX_HEIGHT_KEY]

    error_checking.assert_is_geq(
        min_height_m_agl, numpy.min(example_dict[RADAR_HEIGHTS_KEY])
    )
    error_checking.assert_is_leq(
        max_height_m_agl, numpy.max(example_dict[RADAR_HEIGHTS_KEY])
    )
    error_checking.assert_is_greater(max_height_m_agl, min_height_m_agl)