def estimate_snow_and_rain(pptn, t_min, t_max, t_snow):
    """ Split precipitation grid into snowfall and rainfall components
        according to temperature. Assumes that temperature increases linearly 
        from t_min to t_max and then decreases linearly again back to t_min in 
        each 24hr period (i.e. a symmetrical triangular temperature profile). 
        In this simplistic case, the proportion of the day above t_snow is:

            (t_max - t_snow)/(t_max - t_min)
    
    Args:
        pptn:   Grid of total daily precipitation.
        t_min:  Grid of minimum daily temperature.
        t_max:  Grid of maximum daily temperature.
        t_snow: Threshold temperature below which precipitation falls as snow
                (float).
    
    Returns:
        List of arrays: [rain, snow]
    """
    # Calculate fraction of rain. There are three cases to consider:
    #   1. t_max > t_snow and t_min < t_snow. Use equation above.
    #   2. t_max <= t_snow. fr_rn = 0
    #   3. t_min > t_snow. fr_rn = 1
    # Calculate case 1
    fr_rn = (t_max-t_snow)/(t_max-t_min)

    # Deal with case 2
    fr_rn[t_max<=t_snow] = 0

    # Deal with case 3
    fr_rn[t_min>t_snow] = 1

    # Calculate rain and snow
    rain = pptn*fr_rn
    snow = pptn*(1-fr_rn)

    return [rain, snow]