def evaluate_velocity_at(layer, depth, prop):
    """
    Evaluate material properties at some depth in a velocity layer.

    .. seealso:: :func:`evaluate_velocity_at_top`,
        :func:`evaluate_velocity_at_bottom`

    :param layer: The velocity layer to use for evaluation.
    :type layer: :class:`~numpy.ndarray`, dtype = :py:const:`.VelocityLayer`
    :param depth: The depth at which the material property should be
        evaluated. Must be within the bounds of the layer or results will be
        undefined.
    :type depth: float
    :param prop: The material property to evaluate. One of:

        * ``p``
            Compressional (P) velocity (km/s)
        * ``s``
            Shear (S) velocity (km/s)
        * ``r`` or ``d``
            Density (g/cm^3)
    :type prop: str

    :returns: The value of the material property requested.
    :rtype: :class:`~numpy.ndarray` (dtype = :class:`float`, shape equivalent
        to ``layer``)
    """
    thick = layer['bot_depth'] - layer['top_depth']
    prop = prop.lower()
    if prop == "p":
        slope = (layer['bot_p_velocity'] - layer['top_p_velocity']) / thick
        return slope * (depth - layer['top_depth']) + layer['top_p_velocity']
    elif prop == "s":
        slope = (layer['bot_s_velocity'] - layer['top_s_velocity']) / thick
        return slope * (depth - layer['top_depth']) + layer['top_s_velocity']
    elif prop in "rd":
        slope = (layer['bot_density'] - layer['top_density']) / thick
        return slope * (depth - layer['top_depth']) + layer['top_density']
    raise ValueError("Unknown material property, use p, s, or d.")