Idepix pixel_classif_flags interpretation


I’m using Idepix to generate cloud masks and shadow cloud masks for Sentinel 2 scenes. I have problems to interpret the image pixel_classif_flags.img because the values ​​of the pixels do not match those of the coding indicated in the help in flag_coding en in the “help”. The pixel_classif_flags.img shows 168 different flag for example for clouds…I have values like 206224, 206208…



The pixel_classif_flags is a integer (32 bit) band.
This means that it can contain 32 different flags. Each bit has one flag meaning.
Following are the bits shown from 0 to 31.
The bit at position 0 has the value 1, the flag at position 2 has the value 4…

For one pixel multiple flags can be raised and the you get the sum of these flags.
In SNAP you can visualise these falgs.

Here on the left you see the for each flag if it is set or not (true or false). You can also use mask (on the right) to colourise pixel where a certain flag is set.

so if I want to use, for example, the CLOUD_mask in another program I have to use the “Export mask pixels” and use an txt file or I have to transform the atributte of the pixel_classif_flags.img to BINARY and reclass the pixels with 1 in the correspondent bit position, is it?

You can also create a new band by Band Maths which uses the mask name as expression. The newly created band can be exported as ENVI image and it will have only two values 0 and 255.

Or in another Programm you read the pixel_classif_flags.img and then you will get the values you have already seen. Then you can do bit operations on the value.
The links explain it.
In brief:
if (2 & pixel_classif_flags == 2) {
// IDEPIX_CLOUD is set

Thank you, that works fine

This thread was very helpful, thanks. Perhaps others are interested to use a Python function that returns flags (e.g. <class ‘list’>: [‘INVALID’, ‘CLOUD’, ‘WHITE’]) for integer values (e.g. 49280).

def get_raised_flags(value):

             'WATER', 'BRIGHTWHITE', 'VEG_RISK', '', '', '', '', '', '', '', '', '', '', '', '', '', '']

    bit_list = '{0:032b}'.format(value)
    raised_flags = []

    for index, bit in enumerate(bit_list[::-1]):
        if bit == '1':

    return raised_flags