Sentinel-2 output format

MAJA outputs products as a collection of directories, each of which refer to the given input L1C product, together with a log file. As an example:

SENTINEL2A_20170706-090107-511_L2A_T33KWP_C_V1-0/
SENTINEL2B_20170701-090105-359_L2A_T33KWP_C_V1-0/
S2A_MSIL1C_20170706T083601_N0205_R064_T33KWP_20170706T090107.log
S2B_MSIL1C_20170701T084019_N0205_R064_T33KWP_20170701T090105.log
..

Each product directory is named according to the sensor, date of acquisition, level, tile ID and version. It contains a collection of GeoTIFF and XML files:

  • a DATA/ directory for product meta-data inherited from the L1C
  • a MASK/ directory with:
    • *_CLM_*.tif : the cloud mask
    • *_DTF_*.tif:
    • *_DFP_*.tif:
    • *_EDG_*.tif : the edge mask (actual border of the image within the tile extent)
    • *_IAB_*.tif : the water vapour and AOD interpolation mask
    • *_MG2_*.tif : the geophysical mask
    • *_SAT_*.tif : the saturation mask
  • *_SRE_B*.tif : surface reflectance of band B* corrected for adjacency (divide by 10000 to convert Digit Number to surface reflectance)
  • *_FRE_B*.tif : surface reflectance of band B* corrected for adjacency and topography effects (divide by 10000 to convert Digit Number to surface reflectance)
  • *_ATB_*.tif : a 2-bands GeoTIFF with:
    • band 1 being the water vapour (divide by 20 to convert Digit Numbers to g/cm2);
    • band 2 being the Aerosol Optical Thickness (divide by 200 to convent Digit Number to AOD (-)
  • *_MTD_ALL.xml : product meta-data
  • *_QKL_ALL.jpg : product quicklook from bands (B4, B3, B2)

The suffix “_R1” and “_R2” relate to the 10m-resolution and the 20m-resolution bands respectively.

Product meta-data

Although each GeoTIFF surface reflectance file is self-sufficient for geolocation of the data, you will need some of the information stored in the XML meta-data file to properly use a MAJA product. Among other, the scale factor values such that <value> = <digit number> / <quantification value>, and the NODATA values:

    <Radiometric_Informations>
        <REFLECTANCE_QUANTIFICATION_VALUE>10000</REFLECTANCE_QUANTIFICATION_VALUE>
        <WATER_VAPOR_CONTENT_QUANTIFICATION_VALUE>20</WATER_VAPOR_CONTENT_QUANTIFICATION_VALUE>
        <AEROSOL_OPTICAL_THICKNESS_QUANTIFICATION_VALUE>200</AEROSOL_OPTICAL_THICKNESS_QUANTIFICATION_VALUE>
        <Special_Values_List>
            <SPECIAL_VALUE name="nodata">-10000</SPECIAL_VALUE>
            <SPECIAL_VALUE name="water_vapor_content_nodata">0</SPECIAL_VALUE>
            <SPECIAL_VALUE name="aerosol_optical_thickness_nodata">0</SPECIAL_VALUE>
        </Special_Values_List>

You’ll also find quality information related eg. to the cloud cover, snow cover, hot spot detection, etc.. under the <Quality_Information> group:

                    <Global_Index_List>
                        <QUALITY_INDEX name="CloudPercent">0</QUALITY_INDEX>
                        <QUALITY_INDEX name="SnowPercent">0</QUALITY_INDEX>
                        <QUALITY_INDEX name="RainDetected">false</QUALITY_INDEX>
                        <QUALITY_INDEX name="HotSpotDetected">false</QUALITY_INDEX>
                        <QUALITY_INDEX name="SunGlintDetected">true</QUALITY_INDEX>
                    </Global_Index_List>

Whenever you need to trace back the version of MAJA used to process a given product, it is stored at:

<PRODUCTION_SOFTWARE>MAJA 4.6.0</PRODUCTION_SOFTWARE>

Finally, the structure of the different masks are described in the <Mask_List> subgroup and detailed in the section below.

Product masks

The mask layers are bitmasks, not to be confused with classified layers. Each pixel of a bitmask is a 8-bit unsigned integer which could be considered as a vector of 8 booleans (either 0 or 1). Each bit defaults to 0, unless the pixel matches a given mask category and changes to 1.

As an example, consider a cloud mask pixel whose value is 35. This integer is stored as a sequence of bits numbered from 0 to 7. It should be interpreted as follow :

Here, the pixel is affected by a cloud or a cloud shadow (bit 0), and matches the cloud category (except the thinnest) (bit 1), and was detected by the multi-temporal threshold (bit 3). This byte 00001011 is stored as a 8-bit integer of value 11 as illustrated below :

Masks bitcodes

The tables below describe the different bitmasks produces by MAJA

BitCLM mask description (for both R1 and R2)
0all clouds except the thinnest and all shadows
1all clouds (except the thinnest)
2clouds detected via mono-temporal thresholds
3clouds detected via multi-temporal thresholds
4thinnest clouds
5cloud shadows cast by a detected cloud
6cloud shadows cast by a cloud outside image
7high clouds detected by 1.38 µm
Cloud mask CLM description

BitMG2 mask description (for both R1 and R2)
0open water
1all clouds (except the thinnests)
2snow
3all shadows (bit 5 or bit 6 of CLM)
4topographic shadows
5unseen pixels due to topography
6sun too low for a correct terrain correction
7sun direction tangent to slope (inaccurate terrain correction)
Geophysical mask MG2 description

BitIAB mask (for both R1 and R2)
0Water vapour content is an interpolated value
1AOD is an interpolated value
Water vapour and AOD interpolation mask

BitSAT R1 mask
0L1C B2 value is saturated
1L1C B3 value is saturated
2L1C B4 value is saturated
3L1C B8 value is saturated
L1C band saturation mask at 10m resolution

BitSAT R2 mask
0L1C B5 value is saturated
1L1C B6 value is saturated
2L1C B7 value is saturated
3L1C B8A value is saturated
4L1C B11 value is saturated
5L1C B12 value is saturated
L1C band saturation mask at 20m resolution

Search