SEN2COR wrong metadata in SAFE-compact - gdal sentinel-2 cannot find datasets

Thanks @mengdahl and @marpet!

Hello! any updates regarding this?

Let me join @fabricebrito here :slight_smile:

@obarrilero @kraftek @umwilm, any updates on the matter? I’ve trying to open 2A products generated by Sen2Cor 2.4.0 with gdal 2.1.3 without success… :frowning:

I created a ticket for this issue. The implementation of a possible fix will be decided by the Sentinel-2 Level 2A Mission Performance Center.

Hi @umwilm!

Let us know how this will evolve.

Cheers

Hi, can some say what the actual problem is?
@fabricebrito you started to describe it [quote=“fabricebrito, post:1, topic:5206”]
me that the content is wrong (at least in ).
[/quote]
but then you didn’t finish. :slight_smile:

@umwilm Couldn’t this be fixed in the next sen2core version? Sure, if the MPC is involved things take a while, but I think, this could be solved independent from the MPC, no? If this current output format is corrupt it should be corrected.
If done in the next version it would help at least those users who use sen2cor directly.

The problem is the L2A metadata. It’s not complete and thus gdal cannot build its internal model.

To reproduce:

  • generate a L2A product
  • inspect MTD_MSIL2A.xml

I can not see anything obviously wrong or things which are missing.

Attached two xml files for the same scene. One from SciHub the other processed by myself.
At least they are similar, except minor differences according to version update.

MTD_MSIL2A_sen2cor_v240.xml (52.4 KB)

MTD_MSIL2A_sciHub_v230.xml (52.8 KB)

Hi @marpet,

I’ve found the email exchange with the gdal S2 driver developer we got back in march this year:

 J'ai regardé l'exemple. Les métadonnées du nouveau format sont encore plus "funky" que le L1C "SafeCompact".
 
Par exemple dans MTD_MSIL2A.xml, on a une référence à <IMAGE_FILE_2A>GRANULE/L2A_T29SPA_A008857_20170303T111724/IMG_DATA/R60m/L2A_T29SPA_20170303T110941_TCI_60m</IMAGE_FILE_2A> mais aucun fichier ne commence par L2A_T29SPA_20170303T110941_TCI_60m ... Et il n'y a pas de produit TCI dans le jeu de données. Et les bandes effectivements disponibles ne sont pas listées.
Il y a également des fichiers _geo.jp2 quasi vides et invalides, à côté des véritables .jp2
J'ai l'impression que sen2cor fait des choses pas très propres... Ceci dit, tous les fichiers nécessaires sont là donc on doit pouvoir sans sortir.

Looking at your examples, it looks like it has been addressed. We will check and let you know.

Hi @fabricebrito,

Is this solved?
I converted 1C to 2A using sen2cor 2.4.0 and used GDAL 2.2.3 but still no sub-datasets are shown when calling gdalInfo for MTD_MSIL2A.xml.

Is there a way/workaround to convert L2A to geotiff?

Thanks

Yes, you can open the output in SNAP and then resample it and save it as (Big)GeoTiff.
This might be of interest to you:

Hello @umwilm and @fabricebrito !

Is there any progress on this problem? I am using Gdal to read 2A products created with sen2cor 2.4.0 and I haven’t been able to find a way to read new files.

Thank you!

Hi @fabricebrito, hi @obarrilero,

gdal (I tried both version 2.2.4 and 2.3.1) is still not able to read Sentinel-2 L2A data produced by the latest version of sen2cor (2.5.5). The error message says:

ERROR 1: Cannot find =Level-2A_User_Product.General_Info.L2A_Product_Info
gdalinfo failed - unable to open ‘S2A_MSIL2A_20180827T101021_N0208_R022_T32TPT_20180827T152355.SAFE/MTD_MSIL2A.xml’.

Is there an update or progress on this issue?

Hi @kraftek, hi @umwilm, do you have a solution to this issue? sen2cor L2A products still can’t be read by gdal. Thanks!

Hi,
we can do nothing about the compatibility in gdal. They should be the gdal developers who could update the S2 reader plugin.

When I reported this it was a Sen2cor issue because the XML metadata file was corrupted.
So at that time the correction was on you.

If the XML file is now ok, you’ve done your part of the job. If not, it’s still on you.

The gdal Sentinel driver was developed by Spatialys with funding from Centre National d’Etudes Spatiales (CNES)

Sorry, perhaps I do not have all the information and I do not know what products can be read or not by gdal.
I can only explain the SNAP side: we had to make a module update for supporting the new format L2A some months ago. As far as I know, the ‘official’ format produced by sen2cor changed and we had to adapt our reader to support it. I do not know how this has been managed by the gdal team. And perhaps, as @fabricebrito says, this is something that should be fixed by the sen2cor developers, perhaps there is an issue with the new product, I do not know. I am going to try to talk with them for clarifying this.

I experienced still the same issue with both gdal 2.3.2 or 2.1.0 that Sen2cor output level 2A data files cannot be opened by gdal programs. Sen2Cor is version 02.05.05

Could you please help to get this fixed?

Hi
I think that S2-L2A products are supported now by the latest version of GDAL (since 2.4.0)