olivierhagolle / Start_maja

To process a Sentinel-2 time series with MAJA cloud detection and atmospheric correction processor
Other
51 stars 15 forks source link

Sentinel2XMLTileFileHandler(0xafdc30): Error while reading the value xml node '//Mean_Viewing_Incidence_Angle_List/Mean_Viewing_Incidence_Angle[@bandId='4']/ZENITH_ANGLE' #4

Closed j08lue closed 6 years ago

j08lue commented 6 years ago

I tried to run MAJA on Sentinel 2 L1C products downloaded with sentinelhub from Amazon AWS in .SAFE format (http://sentinelhub-py.readthedocs.io/en/latest/examples/aws_request.html#Data-into-.SAFE-structure).

The .SAFE structure is complete and other tools like Sen2Cor do not complain.

However, MAJA fails already in the initialization phase when trying to read those files:

****************************************************************  [vnsMajaMainProcessor.cxx:main:127]
PreProcessing: vns::Data::ERROR: Sentinel2XMLTileFileHandler(0xafdc30): Error while reading the value xml node '//Mean_Viewing_Incidence_Angle_List/Mean_Viewing_Incidence_Angle[@bandId='4']/ZENITH_ANGLE' in the xml file /data/input/S2A_OPER_PRD_MSIL1C_PDMC_20160311T202349_R108_V20150819T103028_20150819T103028.SAFE/GRANULE/S2A_OPER_MSI_L1C_TL_EPA__20160311T044054_A000820_T32UNG_N02.01/S2A_OPER_MTD_L1C_TL_EPA__20160311T044054_A000820_T32UNG.xml! [vnsXMLFileHandler.cxx:449] [MAJA Data Exception]  [vnsMajaMainProcessor.cxx:main:127]

The XML does exist, looks fine and with other tools, I can parse and extract the viewing angles fine.

What could be the reason why MAJA cannot parse the XML file?

I would be happy to help finding the bug, but the MAJA code is not open-source... (yet?)

j08lue commented 6 years ago

Here is the XML file in question:

S2A_OPER_MTD_L1C_TL_EPA__20160311T044054_A000820_T32UNG.zip

olivierhagolle commented 6 years ago

OK, now I know. There was a period of time (February March 2016) when ESA level 1C were missing (quite randomly) some files which provide detailed information on the viewing angles (the DETFOO (detector footprint) files). Sen2cor does a much less accurate work regarding viewing angles, and does not use this detailed information. As a result, MAJA is not able to process these products while sen2cor is. I know some users who manually edited the DETFOO files using those from another date acquired from the same track (a multiple of 10 days later). That's probably not perfectly accurate, but could make MAJA work.

Best regards, Olivier

j08lue commented 6 years ago

The product was actually from 2015-08-19, but apparently re-processed in that dark period you named.

But the error message sounds like an XML parsing error, not like files that were not found?

Anyways, I can confirm that MAJA does work with an AWS/sentinelhub-downloaded product from 2017 that I just tried, so this is not a systematic issue with reconstructed AWS products but apparently just due to faulty products from ESA.