Opened 8 years ago

Closed 8 years ago

Last modified 3 years ago

#6303 closed defect (fixed)

GDAL cannot open L2A Sentinel 2

Reported by: bboughton Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: normal Keywords: l2a, sentinel
Cc: bboughton@…

Description (last modified by bboughton)

I built GDAL today with JPEG2000 driver.

Works: gdalinfo S2A_OPER_PRD_MSIL1C_PDMC_20160101T090858_R030_V20160101T000915_20160101T000915.SAFE

I successfully ran sen2cor to create L2A data.

Fails: gdalinfo S2A_USER_MTD_SAFL2A_PDMC_20160101T090858_R030_V20160101T000915_20160101T000915.xml

Error: gdalinfo failed - unable to open '...'

The fake Sentinel L2A works (gdal/autotest/gdrivers/autotest/data/fake_sentinel2_l2a/S2A_USER_PRD_MSIL2A.SAFE/S2A_USER_MTD_SAFL2A.xml)

I used sen2cor 2.0.6

Failing xml file attached.

Attachments (2)

S2A_USER_MTD_SAFL2A_PDMC_20160101T090858_R030_V20160101T000915_20160101T000915.xml (94.0 KB ) - added by bboughton 8 years ago.
Failing Sentinel2 L2A xml file
MTD_MSIL2A.xml (49.6 KB ) - added by ascarth 7 years ago.
New L2A metadata format produced by sen2cor

Download all attachments as: .zip

Change History (15)

by bboughton, 8 years ago

Failing Sentinel2 L2A xml file

comment:1 by bboughton, 8 years ago

Fresh download and clean install on new virtual machine gives exactly the same results.

comment:2 by bboughton, 8 years ago

Description: modified (diff)

comment:3 by bboughton, 8 years ago

Will try with sen2cor 2.0.5 and report back.

comment:4 by Jukka Rahkonen, 8 years ago

You do not want to use JPEG2000 driver for any serious work because it is so slow but bug is a bug, though.

comment:5 by bboughton, 8 years ago

Thanks but I need a command line utility to convert Sentinel2 imagery to 4 band geotiff.

comment:6 by Even Rouault, 8 years ago

Should be fixed with r32951: "SENTINEL2: be less restrictive on the identification of L2A products (#6303)"

When you write "Works: gdalinfo S2A_OPER_PRD_MSIL1C_PDMC_20160101T090858_R030_V20160101T000915_20160101T000915.SAFE", what is S2A_OPER_PRD_MSIL1C_PDMC_20160101T090858_R030_V20160101T000915_20160101T000915.SAFE ? A directory or a file ? It is supposed to be a directory but I cannot explain which driver would open it.

comment:7 by bboughton, 8 years ago

I entered the wrong working command above. The L1C data works. This command works:

gdalinfo S2A_OPER_MTD_SAFL1C_PDMC_20160101T090858_R030_V20160101T000915_20160101T000915.xml

Once I run sen2cor and convert the L1C to L2A gdalinfo cannot read the output xml.

gdalinfo S2A_USER_MTD_SAFL2A_PDMC_20160101T090858_R030_V20160101T000915_20160101T000915.xml

v2.0.5 of sen2cor made no difference. I will try with your above fix and report back.

comment:8 by Jukka Rahkonen, 8 years ago

With my comment about "JPEG2000" I meant that the other drivers which GDAL has for JPEG2000 are much faster than this driver http://www.gdal.org/frmt_jpeg2000.html, for example the JP2OpenJPEG one http://www.gdal.org/frmt_jp2openjpeg.html which is also open source.

Last edited 8 years ago by Jukka Rahkonen (previous) (diff)

comment:9 by bboughton, 8 years ago

Working now. Thank-you.

And thank-you jratike80 for your help also, I will try the other drivers.

comment:10 by Even Rouault, 8 years ago

Resolution: fixed
Status: newclosed

comment:11 by ascarth, 7 years ago

GDAL 2.1.3 supports the new 'safe compact' naming scheme for Sentinel 2 data, which works for L1C products. However, the corresponding L2A products derived from sen2cor v2.3+ are not readable in this version.

gdalinfo recognises the driver as Sentinel 2 but cannot find the subdatasets (as with previous L2A products). I will attach the corresponding metadata required to open the product.

by ascarth, 7 years ago

Attachment: MTD_MSIL2A.xml added

New L2A metadata format produced by sen2cor

comment:12 by mschott, 3 years ago

@ascarth: this is still the case, right? Should we file a new issue or reopen this one?

in reply to:  12 comment:13 by Even Rouault, 3 years ago

Replying to mschott:

@ascarth: this is still the case, right? Should we file a new issue or reopen this one?

Please make sure you use a recent GDAL version first. And if you do have issues, please file a ticket at https://github.com/OSGeo/gdal/issues/new

Note: See TracTickets for help on using tickets.