CCD data reduction