def rhypo_to_rrup(rhypo, mag):
    """
    Converts hypocentral distance to an equivalent rupture distance
    dependent on the magnitude
    """
    rrup = rhypo - (0.7108 + 2.496e-06 * mag ** 7.982)
    rrup[rrup < 3.0] = 3.0
    return rrup
