MSI S2A newe format

Our atmosphere correction code (l2gen) needs some posList information from gml files in MSI_S2A L1C files (old format), e.g. GRANULE/L1C_T33VUF_A031236_20210615T102244/QI_DATA/
MSK_DETFOO_B07.gml

There is a new format for MSI_S2A L1C files. In the files with the new format, MSK_DETFOO_B07.gml is replaced by MSK_DETFOO_B07.jp2, e.g. GRANULE/L1C_T42QVK_A040128_20230227T061210/QI_DATA/MSK_DETFOO_B07.jp2 and we are not able to find the same posList information any more.

We looked through Copernicus Sentinel-2: Major Products Upgrade Upcoming - Sentinel Online and https://sentinels.copernicus.eu/documents/247904/685211/S2-PDGS-TAS-DI-PSD-V14.9.pdf, but with no success. Does anyone who is familiar with MSI S2A L1C files know?

Thanks in advance,

Hi @xuanyang02

The JP2 can be opened as an XML file; it contains header information in XML format:

    <gml:RectifiedGridCoverage dimension="2" gml:id="RGC0001">
      <gml:rectifiedGridDomain>
        <gml:RectifiedGrid dimension="2">
          <gml:limits>
            <gml:GridEnvelope>
              <gml:low>1 1</gml:low>
              <gml:high>1830 1830</gml:high>
            </gml:GridEnvelope>
          </gml:limits>
          <gml:axisName>x</gml:axisName>
          <gml:axisName>y</gml:axisName>
          <gml:origin>
            <gml:Point gml:id="P0001" srsName="urn:ogc:def:crs:EPSG::32639">
              <gml:pos>600030 4299990</gml:pos>
            </gml:Point>
          </gml:origin>
          <gml:offsetVector srsName="urn:ogc:def:crs:EPSG::32639">60 0</gml:offsetVector>
          <gml:offsetVector srsName="urn:ogc:def:crs:EPSG::32639">0 -60</gml:offsetVector>
        </gml:RectifiedGrid>
      </gml:rectifiedGridDomain>

Cheers

Jan

Thanks, Jan!

The specific information I am looking for in the gml file is
eop:maskMembers
<eop:MaskFeature gml:id=“detector_footprint-B07-02-0”>
<eop:maskType codeSpace=“urn:gs2:S2PDGS:maskType”>DETECTOR_FOOTPRINT</eop:maskType>
eop:extentOf
<gml:Polygon gml:id=“DETECTOR_FOOTPRINT.0_Polygon”>
gml:exterior
gml:LinearRing
<gml:posList srsDimension=“3”>409780 6500940 0 409780 6500880 0 409760 6500880 0 409760 6500820 0 409740 6500820 0 409740 6500760 0 409720 6500760 0 409720 6500700 0 409700 6500700 0 409700 6500640 0 409680 6500640 0 409680 6500580 0 409660 6500580 0 409660 6500500 0 409640 6500500 0 409640 6500440 0 409620 6500440 0 409620 6500380 0 …
406440 6490580 0 406420 6490580 0 406420 6490520 0 406400 6490520 0 406400 6490460 0 406380 6490460 0 406380 6490400 0 406360 6490400 0 406360 6490320 0 406340 6490320 0 406340 6490280 0 406320 6490280 0 406320 6490200 0 409780 6490200 0 409800 6490200 0 409800 6500940 0 409780 6500940 0</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</eop:extentOf>
</eop:MaskFeature>

But I can’t seem to find it in the jp2 files.

Hello @xuanyang02

No worries. Have you tried gdalinfo? I got this from a query
Initial_Imagery_Analysis/S2_Image_Files

/L2A/S2A_MSIL2A_20230618T084601_N0509_R107_T36TVS_20230618T151602.SAFE/GRANULE/L2A_T36TVS_A041717_20230618T085217/QI_DATA/MSK_DETFOO_B02.jp2
Size is 10980, 10980
Coordinate System is:
PROJCS["WGS 84 / UTM zone 36N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AXIS["Latitude",NORTH],
        AXIS["Longitude",EAST],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",33],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","32636"]]
Origin = (399960.000000000000000,5200020.000000000000000)
Pixel Size = (10.000000000000000,-10.000000000000000)
Corner Coordinates:
Upper Left  (  399960.000, 5200020.000) ( 31d41' 7.58"E, 46d56'46.18"N)
Lower Left  (  399960.000, 5090220.000) ( 31d42'32.40"E, 45d57'29.73"N)
Upper Right (  509760.000, 5200020.000) ( 33d 7'41.76"E, 46d57'13.09"N)
Lower Right (  509760.000, 5090220.000) ( 33d 7'33.48"E, 45d57'55.73"N)
Center      (  454860.000, 5145120.000) ( 32d24'43.81"E, 46d27'29.31"N)
Band 1 Block=1024x1024 Type=Byte, ColorInterp=Gray
  Overviews: 5490x5490, 2745x2745, 1372x1372, 686x686
  Overviews: arbitrary
  Image Structure Metadata:
    COMPRESSION=JPEG2000

Cheers

Jan

Thanks, I will look into gdal.

1 Like