Correcting non-independent and non-identically distributed errors with surface codes