Move cloud mask calculation to a separate function.