readPixel Issue on pre-processed S3 L1B OLCI product

Thank you for getting back to me. In the end, I did a long way round:
band = p.getBand(‘pixel_classif_flags’)
idepix_flags = band.readPixels(0, 0, w, h, zeros((h, w), float32)).astype(‘uint32’)

then getting the bits with the method described here:

then applying the mask by extracting the band data one by one:
for loop etc…
data = np.zeros(width * height, dtype=np.float32)
band.readPixels(0, 0, width, height, data)
data.shape = height, width
band_data[band_name] = data

then for loop etc…
data[combined_mask] = np.nan

very long winded but I think it achieved what I wanted in the meantime. Will probably attempt the method you gave when I get time and if it works move to that.