def _apply_subduction_trench_correction(mean, x_tr, H, rrup, imt):
    """
    Implement equation for subduction trench correction as described in
    equation 3.5.2-1, page 3-148 of "Technical Reports on National Seismic
    Hazard Maps for Japan"
    """
    if imt.name == 'PGV':
        V1 = 10 ** ((-4.021e-5 * x_tr + 9.905e-3) * (H - 30))
        V2 = np.maximum(1., (10 ** (-0.012)) * ((rrup / 300.) ** 2.064))
        corr = V2
        if H > 30:
            corr *= V1
    else:
        V2 = np.maximum(1., (10 ** (+0.13)) * ((rrup / 300.) ** 3.2))
        corr = V2
        if H > 30:
            V1 = 10 ** ((-8.1e-5 * x_tr + 2.0e-2) * (H - 30))
            corr *= V1
    return np.log(np.exp(mean) * corr)
Implement equation for subduction trench correction as described in
    equation 3.5.2-1, page 3-148 of "Technical Reports on National Seismic
    Hazard Maps for Japan"