Implicit sampling for data assimilation