def del_eta_del_x(U, f, g, balance='geostrophic', R=None):
    """
    Calculate :mat: `\\frac{\\partial \\eta} {\\partial x}` for different
    force balances

    Parameters
    ----------
    U : array_like
        velocity magnitude [m/s]
    f : float
        Coriolis parameter
    d : float
        Acceleration of gravity
    balance : str, optional
              geostrophic [default], gradient or max_gradient
    R : float, optional
        Radius

    """
    if balance == 'geostrophic':
        detadx = f * U / g
    elif balance == 'gradient':
        detadx = (U ** 2 / R + f * U) / g
    elif balance == 'max_gradient':
        detadx = R * f ** 2 / (4 * g)
    return detadx
