0

What is the problem with gdal info for sentinel 2 level 2A?

gdalinfo SENTINEL2_L2A:S2A_MSIL2A_20181227T125301_N0211_R052_T24LXN_20181227T145100.SAFE/MTD_MSIL2A.xml 
ERROR 1: Invalid syntax for SENTINEL2_L2A:
gdalinfo failed - unable to open 'SENTINEL2_L2A:S2A_MSIL2A_20181227T125301_N0211_R052_T24LXN_20181227T145100.SAFE/MTD_MSIL2A.xml'.
3

There are good examples in https://gdal.org/frmt_sentinel2.html but you must follow them carefully. Use the name of the subdataset literally as it is reported by gdalinfo. The name does not stop into ".xml" but also something like ":10m:EPSG_32632" is included.

Subdatasets:
  SUBDATASET_1_NAME=SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/MTD_MSIL2A.xml:10m:EPSG_32632
  SUBDATASET_1_DESC=Bands B2, B3, B4, B8 with 10m resolution, UTM 32N
  SUBDATASET_2_NAME=SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/MTD_MSIL2A.xml:20m:EPSG_32632

Whole gdalinfo report of one subdataset (notice that I opened the zip file directly through /vsizip/:

gdalinfo SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/MTD_MSIL2A.xml:10m:EPSG_32632
Driver: SENTINEL2/Sentinel 2
Files: /vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/MTD_MSIL2A.xml
       /vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/GRANULE/L2A_T32TPR_A013461_20180119T101331/MTD_TL.xml
       /vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/GRANULE/L2A_T32TPR_A013461_20180119T101331/MTD_TL.xml
       /vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/GRANULE/L2A_T32TPR_A013461_20180119T101331/MTD_TL.xml
       /vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/GRANULE/L2A_T32TPR_A013461_20180119T101331/IMG_DATA/R10m/T32TPR_20180119T101331_B04_10m.jp2
       /vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/GRANULE/L2A_T32TPR_A013461_20180119T101331/IMG_DATA/R10m/T32TPR_20180119T101331_B03_10m.jp2
       /vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/GRANULE/L2A_T32TPR_A013461_20180119T101331/IMG_DATA/R10m/T32TPR_20180119T101331_B02_10m.jp2
       /vsizip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.zip/S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE/GRANULE/L2A_T32TPR_A013461_20180119T101331/IMG_DATA/R10m/T32TPR_20180119T101331_B08_10m.jp2
Size is 10980, 10980
Coordinate System is:
PROJCRS["WGS 84 / UTM zone 32N",
    BASEGEOGCRS["WGS 84",
        DATUM["World Geodetic System 1984",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]]],
    CONVERSION["UTM zone 32N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",9,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["easting",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["northing",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    ID["EPSG",32632]]
Data axis to CRS axis mapping: 1,2
Origin = (600000.000000000000000,5100000.000000000000000)
Pixel Size = (10.000000000000000,-10.000000000000000)
Metadata:
  AOT_QUANTIFICATION_VALUE=1000.0
  AOT_QUANTIFICATION_VALUE_UNIT=none
  AOT_RETRIEVAL_ACCURACY=0.0
  BOA_QUANTIFICATION_VALUE=10000
  BOA_QUANTIFICATION_VALUE_UNIT=none
  CLOUD_COVERAGE_ASSESSMENT=6.267092
  CLOUD_SHADOW_PERCENTAGE=6.170878
  DARK_FEATURES_PERCENTAGE=17.796581
  DATATAKE_1_DATATAKE_SENSING_START=2018-01-19T10:13:31.026Z
  DATATAKE_1_DATATAKE_TYPE=INS-NOBS
  DATATAKE_1_ID=GS2A_20180119T101331_013461_N02.06
  DATATAKE_1_SENSING_ORBIT_DIRECTION=DESCENDING
  DATATAKE_1_SENSING_ORBIT_NUMBER=22
  DATATAKE_1_SPACECRAFT_NAME=Sentinel-2A
  DEGRADED_ANC_DATA_PERCENTAGE=0.0
  DEGRADED_MSI_DATA_PERCENTAGE=0
  FORMAT_CORRECTNESS=PASSED
  GENERAL_QUALITY=PASSED
  GENERATION_TIME=2018-10-27T23:16:11Z
  GEOMETRIC_QUALITY=PASSED
  HIGH_PROBA_CLOUDS_PERCENTAGE=3.146809
  MEDIUM_PROBA_CLOUDS_PERCENTAGE=2.172884
  NODATA_PIXEL_PERCENTAGE=0.000040
  NOT_VEGETATED_PERCENTAGE=18.709394
  PREVIEW_GEO_INFO=Not applicable
  PREVIEW_IMAGE_URL=Not applicable
  PROCESSING_BASELINE=02.06
  PROCESSING_LEVEL=Level-2Ap
  PRODUCT_START_TIME=2018-01-19T10:13:31.026Z
  PRODUCT_STOP_TIME=2018-01-19T10:13:31.026Z
  PRODUCT_TYPE=S2MSI2Ap
  PRODUCT_URI=S2A_MSIL2A_20180119T101331_N0206_R022_T32TPR_20180119T135441.SAFE
  RADIATIVE_TRANSFER_ACCURACY=0.0
  RADIOMETRIC_QUALITY=PASSED
  REFLECTANCE_CONVERSION_U=1.03351843785607
  SATURATED_DEFECTIVE_PIXEL_PERCENTAGE=0.000000
  SENSOR_QUALITY=PASSED
  SNOW_ICE_PERCENTAGE=3.474767
  SPECIAL_VALUE_NODATA=0
  SPECIAL_VALUE_SATURATED=65535
  THIN_CIRRUS_PERCENTAGE=0.947399
  UNCLASSIFIED_PERCENTAGE=21.413908
  VEGETATION_PERCENTAGE=22.282921
  WATER_PERCENTAGE=3.884458
  WATER_VAPOUR_RETRIEVAL_ACCURACY=0.0
  WVP_QUANTIFICATION_VALUE=1000.0
  WVP_QUANTIFICATION_VALUE_UNIT=cm
Image Structure Metadata:
  COMPRESSION=JPEG2000
Corner Coordinates:
Upper Left  (  600000.000, 5100000.000) ( 10d17'33.12"E, 46d 2'46.56"N)
Lower Left  (  600000.000, 4990200.000) ( 10d16'12.27"E, 45d 3'29.51"N)
Upper Right (  709800.000, 5100000.000) ( 11d42'37.96"E, 46d 1'17.12"N)
Lower Right (  709800.000, 4990200.000) ( 11d39'48.62"E, 45d 2' 3.08"N)
Center      (  654900.000, 5045100.000) ( 10d59' 2.99"E, 45d32'31.93"N)
Band 1 Block=128x128 Type=UInt16, ColorInterp=Red
  Description = B4, central wavelength 665 nm
  Metadata:
    BANDNAME=B4
    BANDWIDTH=30
    BANDWIDTH_UNIT=nm
    SOLAR_IRRADIANCE=1512.06
    SOLAR_IRRADIANCE_UNIT=W/m2/um
    WAVELENGTH=665
    WAVELENGTH_UNIT=nm
Band 2 Block=128x128 Type=UInt16, ColorInterp=Green
  Description = B3, central wavelength 560 nm
  Metadata:
    BANDNAME=B3
    BANDWIDTH=35
    BANDWIDTH_UNIT=nm
    SOLAR_IRRADIANCE=1823.24
    SOLAR_IRRADIANCE_UNIT=W/m2/um
    WAVELENGTH=560
    WAVELENGTH_UNIT=nm
Band 3 Block=128x128 Type=UInt16, ColorInterp=Blue
  Description = B2, central wavelength 490 nm
  Metadata:
    BANDNAME=B2
    BANDWIDTH=65
    BANDWIDTH_UNIT=nm
    SOLAR_IRRADIANCE=1959.72
    SOLAR_IRRADIANCE_UNIT=W/m2/um
    WAVELENGTH=490
    WAVELENGTH_UNIT=nm
Band 4 Block=128x128 Type=UInt16, ColorInterp=Undefined
  Description = B8, central wavelength 842 nm
  Metadata:
    BANDNAME=B8
    BANDWIDTH=115
    BANDWIDTH_UNIT=nm
    SOLAR_IRRADIANCE=1041.63
    SOLAR_IRRADIANCE_UNIT=W/m2/um
    WAVELENGTH=842
    WAVELENGTH_UNIT=nm
  • Nothing happen here. It didn't work or I am not run it right. – Diogo Caribé Mar 14 at 15:04
  • ~/Sentinel2$ ls S2A_MSIL2A_20181227T125301_N0211_R052_T24LXN_20181227T145100.zip ~/Sentinel2$ gdalinfo SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20181227T125301_N0211_R052_T24LXN_20181227T145100.zip/S2A_MSIL2A_20181227T125301_N0211_R052_T24LXN_20181227T145100.SAFE/MTD_MSIL2A.xml:10m:EPSG_32724 ERROR gdalinfo failed open 'SENTINEL2_L2A:/vsizip/S2A_MSIL2A_20181227T125301_N0211_R052_T24LXN_20181227T145100.zip/S2A_MSIL2A_20181227T125301_N0211_R052_T24LXN_20181227T145100.SAFE/MTD_MSIL2A.xml:10m:EPSG_32724' – Diogo Caribé Mar 14 at 15:59
  • So good anwer but I am not recognize what happen here that doesn't work well. – Diogo Caribé Mar 14 at 16:00
  • The problem is that my gdal version was 2.3.2 and it only works with bigger than 2.4 version – Diogo Caribé May 12 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.