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


#1

Hello!

I’ve processed Sentinel-2 data with SEN2COR v2.3.0 and then tried to convert the output to geotiff with gdal 2.1.3 with the Sentinel-2 driver which states:

“Driver for Sentinel-2 Level-1B, Level-1C and Level-2A products. (GDAL >= 2.1). Starting with GDAL 2.1.3, Level-1C with “Safe Compact” encoding are also supported.”

The driver fails to identify datasets for SEN2COR processed L2A products. Looking at the MTD_MSIL2A.xml file, it seems to me that the content is wrong (at least in <L2A_Product_Organisation>).

We have contacted the gdal Sentinel-2 driver developers that confirmed that the format as implemented is messy.

Can this issue be addressed by the SEN2COR team?


#2

I have the same problem.
SNAP 4.0 is not able to open any scene with a new naming convention (since Dec 2016). xml is simply not valid and does not work. It is occurs on a gradule as well as, dataset level.
Apparently, Sen2Cor 2.3.0 runs on these images (in a batch mode), but then obviously an outcome still has corrupted xml.

I would be grateful if someone could look into in.


#3

Please try with updated SNAP5.0, as the older versions are not supported. We are planning to keep supporting 5.0 alongside later versions for a period in the future so upgrading to 5.0 is a rather safe move for operational users as well.


#4

thank you. It was my obvious mistake.


#5

Yes maybe SNAP 5.0 ignores the wrong format but the right approach here is to submit an issue on sen2cor to correct the format implementation of the S2 L2A products. The metadata is simply wrong and prevents gdal sentinel-2 driver from reading the datasets.

@mengdahl can you do that?


#6

Hello Fabrice,

I’m not dealing with the optical side of SNAP but I can try and flag the developers for their comments @Nicolas @umwilm @marpet

Marcus


#7

Yes, I think @obarrilero, @kraftek and/or @umwilm should have a look at this.


#8

Thanks @mengdahl and @marpet!


#9

Hello! any updates regarding this?


#10

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:


#11

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.


#12

Hi @umwilm!

Let us know how this will evolve.

Cheers


#13

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.


#14

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


#15

To reproduce:

  • generate a L2A product
  • inspect MTD_MSIL2A.xml

#16

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)


#17

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.


#18

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


#19

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:


#20

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!