def sw_archie(res, phi, Rw, a=1.0, m=2.0, n=2.0):
    """
    Calculate water saturation using Archie method.
    
                (a * Rw)  
        Sw = ( ----------- )^(1/n)
               phi^m * res 
    
    
    Sw = sw_archie(res, phi, Rw, a, m, n)
    
    Sw = water saturation
    res = measured formation resistivity
    phi = effective porosity
    Rw = formation water resistivity
    a = constant
    m = constant
    n = constant
    
    """
    
    Rw = float(Rw)
    a = float(a)
    m = float(m)
    n = float(n)
    
    Sw = (a * Rw / (phi**m * res)) ** (1 / n)
    
    Sw[Sw < 0] = 0.0
    Sw[Sw > 1] = 1.0
    
    return Sw