Sen2cor 2.8 fails on product from early 2016 - 'bool' object has no attribute 'SPACECRAFT_NAME'

The product is newly downloaded from SciHub. I guess it is nonetheless faulty somehow. Sad story.

Sentinel-2 Level 2A Processor (Sen2Cor). Version: 2.8.0, created: 2019.02.20, supporting Level-1C product version 14.2 - 14.5 started ...
Old product version 14.2 detected, - will be updated to 14.5
Processing baseline will also be updated
Operation mode: TOOLBOX
Processing baseline: 99.99
Progress[%]:  0.00 : Generating datastrip metadata
Syntax error in metadata, see report file for details.
Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema/S2_PDI_Level-1C_Datastrip_Metadata.xsd
Details: Element 'Image_Display_Order': This element is not expected. Expected is ( Spectral_Information_List ).
Incorrect datastrip L1C xml format
Traceback (most recent call last):
  File "/home/myuser/Sen2Cor-02.08.00-Linux64/lib/python2.7/site-packages/sen2cor/L2A_Process.py", line 534, in <module>
    sys.exit(main())
  File "/home/myuser/Sen2Cor-02.08.00-Linux64/lib/python2.7/site-packages/sen2cor/L2A_Process.py", line 482, in main
    L2A_TILES = config.updateTiles()
  File "/home/myuser/Sen2Cor-02.08.00-Linux64/lib/python2.7/site-packages/sen2cor/L2A_Config.py", line 3669, in updateTiles
    if self.create_L2A_Tile():
  File "/home/myuser/Sen2Cor-02.08.00-Linux64/lib/python2.7/site-packages/sen2cor/L2A_Config.py", line 3694, in create_L2A_Tile
    self.getEntriesFromDatastrip()
  File "/home/myuser/Sen2Cor-02.08.00-Linux64/lib/python2.7/site-packages/sen2cor/L2A_Config.py", line 3635, in getEntriesFromDatastrip
    self.spacecraftName = di.SPACECRAFT_NAME.text
AttributeError: 'bool' object has no attribute 'SPACECRAFT_NAME'

Sen2cor 2.5.5 does process the product fine.

Operation mode PDGS is not supported for Product version 14.2.
Operation mode will be reset to TOOLBOX.

Sentinel-2 Level 2A Processor (Sen2Cor). Version: 2.5.5, created: 2018.03.19, supporting Level-1C product version <= 14.5 started ...
Product version: 14.2. Operation mode: TOOLBOX. Processing baseline: 02.01.
 Selected resolution: 10 m.
Progress[%]: 0.02 : PID-106203, 20 m resolution must be processed first, elapsed time[s]: 0.416, total: 0:00:02.646545
Progress[%]: 0.03 : PID-106203, L2A_ProcessTile: processing with resolution 20 m, elapsed time[s]: 0.305, total: 0:00:02.951272
Progress[%]: 0.03 : PID-106203, L2A_ProcessTile: start of pre processing, elapsed time[s]: 0.001, total: 0:00:02.951812
Progress[%]: 0.03 : PID-106203, L2A_Tables: start import, elapsed time[s]: 0.072, total: 0:00:03.024197

So the format detection is perhaps off in both - both report 14.2, but that should be supported by Sen2cor 2.8.0.

ah, no. I now get this weird error Sen2Cor-02.05.05-win64 - AttributeError: 'L2A_Tables' Object has no attribute '_L2A_Tile_PVI_File'

Progress[%]: 5.73 : PID-106203, L2A_ProcessTile: start of Atmospheric Correction, elapsed time[s]: 0.001, total: 0:02:19.837029
Progress[%]: 5.81 : PID-106203, L2A_AtmCorr: end of calculation terrain maps, elapsed time[s]: 1.785, total: 0:02:21.622464
Progress[%]: 5.81 : PID-106203, L2A_AtmCorr: start of AOT retrieval at 550nm, elapsed time[s]: 0.001, total: 0:02:21.623488
Progress[%]: 6.08 : PID-106203, L2A_AtmCorr: end of internal classification, elapsed time[s]: 6.641, total: 0:02:28.264442
Progress[%]: 6.12 : PID-106203, L2A_AtmCorr: end of interpolation LUTs, elapsed time[s]: 0.821, total: 0:02:29.085315
Progress[%]: 6.12 : PID-106203, L2A_AtmCorr: end retrieving reference pixels for dark areas, elapsed time[s]: 0.001, total: 0:02:29.085974
Progress[%]: 11.07 : PID-106203, L2A_AtmCorr: end of check for dense bright vegetation pixels, elapsed time[s]: 118.846, total: 0:04:27.931544
Progress[%]: 11.41 : PID-106203, L2A_AtmCorr: end of receiving atmospheric functions for all altitudes and visibilities, elapsed time[s]: 8.150, total: 0:04:36.081846
Progress[%]: 11.41 : PID-106203, L2A_AtmCorr: end of AOT retrieval at 550nm, elapsed time[s]: 0.001, total: 0:04:36.082485
Progress[%]: 11.41 : PID-106203, L2A_AtmCorr: start of water vapour retrieval, elapsed time[s]: 0.000, total: 0:04:36.082803
Progress[%]: 11.47 : PID-106203, L2A_AtmCorr: end of water vapour retrieval preparation, elapsed time[s]: 1.315, total: 0:04:37.397534
Progress[%]: 17.80 : PID-106203, L2A_AtmCorr: end of water vapour retrieval, elapsed time[s]: 152.010, total: 0:07:09.407656
Progress[%]: 17.80 : PID-106203, L2A_AtmCorr: preparation of surface reflectance retrieval, elapsed time[s]: 0.001, total: 0:07:09.408424
Progress[%]: 18.10 : PID-106203, L2A_AtmCorr: end of surface reflectance retrieval preparation, elapsed time[s]: 7.292, total: 0:07:16.700271
Progress[%]: 20.67 : PID-106203, L2A_AtmCorr: end of surface reflectance retrieval, elapsed time[s]: 61.571, total: 0:08:18.270964
Progress[%]: 22.85 : PID-106203, L2A_AtmCorr: end of rho retrieval step 2, elapsed time[s]: 52.305, total: 0:09:10.576365
Progress[%]: 22.85 : PID-106203, L2A_ProcessTile: start of post processing, elapsed time[s]: 0.009, total: 0:09:10.585833
Progress[%]: 22.85 : PID-106203, L2A_Tables: start export, elapsed time[s]: 0.001, total: 0:09:10.586410
Progress[%]: 22.96 : PID-106203, L2A_Tables: band B02 exported, elapsed time[s]: 2.596, total: 0:09:13.182747
Progress[%]: 23.06 : PID-106203, L2A_Tables: band B03 exported, elapsed time[s]: 2.592, total: 0:09:15.775037
Progress[%]: 23.17 : PID-106203, L2A_Tables: band B04 exported, elapsed time[s]: 2.596, total: 0:09:18.371102
Progress[%]: 23.28 : PID-106203, L2A_Tables: band B05 exported, elapsed time[s]: 2.571, total: 0:09:20.941782
Progress[%]: 23.39 : PID-106203, L2A_Tables: band B06 exported, elapsed time[s]: 2.592, total: 0:09:23.533389
Progress[%]: 23.50 : PID-106203, L2A_Tables: band B07 exported, elapsed time[s]: 2.595, total: 0:09:26.128496
Progress[%]: 23.60 : PID-106203, L2A_Tables: band B8A exported, elapsed time[s]: 2.600, total: 0:09:28.728708
Progress[%]: 23.71 : PID-106203, L2A_Tables: band B11 exported, elapsed time[s]: 2.499, total: 0:09:31.228100
Progress[%]: 23.81 : PID-106203, L2A_Tables: band B12 exported, elapsed time[s]: 2.485, total: 0:09:33.712944
Progress[%]: 23.85 : PID-106203, L2A_Tables: band SCL exported, elapsed time[s]: 0.853, total: 0:09:34.565614
Progress[%]: 23.87 : PID-106203, L2A_Tables: band SNW exported, elapsed time[s]: 0.612, total: 0:09:35.177524
Progress[%]: 23.92 : PID-106203, L2A_Tables: band CLD exported, elapsed time[s]: 1.172, total: 0:09:36.349767
Progress[%]: 23.95 : PID-106203, L2A_Tables: band AOT exported, elapsed time[s]: 0.777, total: 0:09:37.127194
Progress[%]: 24.00 : PID-106203, L2A_Tables: band WVP exported, elapsed time[s]: 1.220, total: 0:09:38.346903
Progress[%]: 24.03 : PID-106203, L2A_Tables: band VIS exported, elapsed time[s]: 0.638, total: 0:09:38.984767
Process L2A_ProcessTile-1:
Traceback (most recent call last):
  File "/home/myuser/Sen2Cor-02.05.05-Linux64/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/myuser/Sen2Cor-02.05.05-Linux64/lib/python2.7/site-packages/sen2cor/L2A_ProcessTile.py", line 136, in run
    if not self.process_10():
  File "/home/myuser/Sen2Cor-02.05.05-Linux64/lib/python2.7/site-packages/sen2cor/L2A_ProcessTile.py", line 179, in process_10
    if not self.process_20():
  File "/home/myuser/Sen2Cor-02.05.05-Linux64/lib/python2.7/site-packages/sen2cor/L2A_ProcessTile.py", line 158, in process_20
    return self.process()
  File "/home/myuser/Sen2Cor-02.05.05-Linux64/lib/python2.7/site-packages/sen2cor/L2A_ProcessTile.py", line 229, in process
    if self.postprocess() == False:
  File "/home/myuser/Sen2Cor-02.05.05-Linux64/lib/python2.7/site-packages/sen2cor/L2A_ProcessTile.py", line 311, in postprocess
    if not self.tables.exportBandList():
  File "/home/myuser/Sen2Cor-02.05.05-Linux64/lib/python2.7/site-packages/sen2cor/L2A_Tables.py", line 2307, in exportBandList
    fn = os.path.basename(self._L2A_Tile_PVI_File)
AttributeError: 'L2A_Tables' object has no attribute '_L2A_Tile_PVI_File'

But that seems to be because I ask for --resolution 10 and Sen2Cor 2.5.5. has this really sad bug there.

Hi,

Have you tried to select ‘all’ resolutions? There is a known bug in that version of sen2cor if choosing only 10 m, but if you select ALL or you don’t set the resolution if running in the command line, it should finish properly.

I had the same issue for S2 data downloaded from google.
In my case the issue turned out to be a missing AUX_DATA directory.
After adding an empty AUX_DATA folder under the root of the SAFE directory it worked. :smile:

Edit: This may have been a different issue. Just noticed that your’s was an old product version, while mine was recent (14.5)

2 Likes

Seriously, @bleutner, this very same AttributeError during XML parsing because of a missing directory that does not even need to contain any files?

@j08lue I am also getting the same problem. I am using sen2cor 2.8 on mac os. Moreover, I have not changed the directory structure as mentioned in the screenshot. I have downloaded the data from Copernicus Open Access Hub.

Below is the error i am also getting :

Syntax error in metadata, see report file for details.
Schema file: S2-PDGS-TAS-DI-PSD-V14.5_Schema/S2_PDI_Level-1C_Datastrip_Metadata.xsd
Details: Element '{https://psd-12.sentinel2.eo.esa.int/PSD/S2_PDI_Level-1C_Datastrip_Metadata.xsd}Level-1C_DataStrip_ID': No matching global declaration available for the validation root.
Incorrect datastrip L1C xml format
Traceback (most recent call last):
  File "/Users/Naresh/sen2cor280/lib/python2.7/site-packages/sen2cor/L2A_Process.py", line 534, in <module>
    sys.exit(main())
  File "/Users/Naresh/sen2cor280/lib/python2.7/site-packages/sen2cor/L2A_Process.py", line 482, in main
    L2A_TILES = config.updateTiles()
  File "/Users/Naresh/sen2cor280/lib/python2.7/site-packages/sen2cor/L2A_Config.py", line 3669, in updateTiles
    if self.create_L2A_Tile():
  File "/Users/Naresh/sen2cor280/lib/python2.7/site-packages/sen2cor/L2A_Config.py", line 3694, in create_L2A_Tile
    self.getEntriesFromDatastrip()
  File "/Users/Naresh/sen2cor280/lib/python2.7/site-packages/sen2cor/L2A_Config.py", line 3635, in getEntriesFromDatastrip
    self.spacecraftName = di.SPACECRAFT_NAME.text
AttributeError: 'bool' object has no attribute 'SPACECRAFT_NAME'

Hi,
Were you able to resolve this error?
I have the same… I processed for 2019, 2018 and 2017… but for 2016 and 2015 I had this error:

L2A_Process.bat --output_dir F:\RR_area\S2\Sen2Cor\2015 F:\RR_area\S2\SL1C\2015\S2A_MSIL1C_20151223T142942_N0201_R053_T20NQH_20151223T143132\S2A_MSIL1C_20151223T142942_N0201_R053_T20NQH_20200117T192811.SAFE

Sentinel-2 Level 2A Processor (Sen2Cor). Version: 2.8.0, created: 2019.02.20, supporting Level-1C product version 14.2 - 14.5 started …
Old product version 14.2 detected, - will be updated to 14.5
Processing baseline will also be updated
Operation mode: TOOLBOX
Processing baseline: 99.99
Progress[%]: 0.00 : Generating datastrip metadata
Syntax error in metadata, see report file for details.
Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_PDI_Level-1C_Datastrip_Metadata.xsd
Details: Element ‘Image_Display_Order’: This element is not expected. Expected is ( Spectral_Information_List ).
Incorrect datastrip L1C xml format
Traceback (most recent call last):
File “C:\Users\prudente.snap\auxdata\Sen2Cor-02.08.00-win64\Lib\site-packages\sen2cor\L2A_Process.py”, line 534, in
sys.exit(main())
File “C:\Users\prudente.snap\auxdata\Sen2Cor-02.08.00-win64\Lib\site-packages\sen2cor\L2A_Process.py”, line 482, in main
L2A_TILES = config.updateTiles()
File “C:\Users\prudente.snap\auxdata\Sen2Cor-02.08.00-win64\Lib\site-packages\sen2cor\L2A_Config.py”, line 3669, in updateTiles
if self.create_L2A_Tile():
File “C:\Users\prudente.snap\auxdata\Sen2Cor-02.08.00-win64\Lib\site-packages\sen2cor\L2A_Config.py”, line 3694, in create_L2A_Tile
self.getEntriesFromDatastrip()
File “C:\Users\prudente.snap\auxdata\Sen2Cor-02.08.00-win64\Lib\site-packages\sen2cor\L2A_Config.py”, line 3635, in getEntriesFromDatastrip
self.spacecraftName = di.SPACECRAFT_NAME.text
AttributeError: ‘bool’ object has no attribute ‘SPACECRAFT_NAME’
(‘Process image 2 in 18.1499998569 seconds’, ‘/n’)
L2A_Process.bat --output_dir F:\RR_area\S2\Sen2Cor\2015 F:\RR_area\S2\SL1C\2015\S2A_MSIL1C_20151223T142942_N0201_R053_T20NQJ_20151223T143132\S2A_MSIL1C_20151223T142942_N0201_R053_T20NQJ_20200117T192033.SAFE

Same problem here after processing 2016 sentinel-2 image either with sen2coral 2.55 or 2.80. I also used iCOR - S2 processor and the procedure completed successfully but I never managed to open an rgb compose of the image. Did anyone else used iCOR as an alternative solution?

Could be an issue with the file system format on your harddrive.

I had the same problem (Ubuntu 16.04). I eventually discovered that the error dissapeared when I changed the output_dir to a different harddrive. The harddrive I was using for input and output was formatted with NTFS file system. When I reformated the harddrive to EXT4-format the error dissapeared, even when output_dir was on this harddrive.

Hey,
Worked for me!
Thank you!

Hi bleutner,
I got exactly the same error and I added an empty folder AUX_DATA, it worked!
Thank you

1 Like

I’ve been having the same issue with regards the SPACECRAFT_NAME issue.

I’ve identified that it seems to affect images prior to April 2016. For example, the image S2A_MSIL1C_20160327T114352_N0201_R123_T30VVH_20160327T114352.SAFE produces the error, but the image S2A_MSIL1C_20160403T113322_N0201_R080_T30VVH_20160403T113352.SAFE from a few days later completes with no error.

I’ve added the AUX_DATA folder, and I doubt it is anything to do with the format of the HD given I can get sen2cor to run on other images.

I can get sen2cor to work on the images that produce an error by replacing the datastrip MTD_DS.xml from an image that runs successfully. The result is obviously incorrect, however I think therefore there is an issue with the datastrip MTD_DS.xml in the images that fail. However, what the issue is I don’t know.

Has anybody got any ideas/thoughts how to solve this issue?

Try FORCE https://force-eo.readthedocs.io/en/latest/

Hi, it has been solved the same problem using Sen2Cor 2.5.5 for L1C older then 2017 and Sen2Cor 2.8 for L1C data newer than 2017 for me. Actually it all seems to be about PSD version only, which is writen in S2A_MSIL1C_…SAFE\DATASTRIP\DS_EPAE_…\MTD_DS.xml
like
<n1:Level-1C_DataStrip_ID xmlns:n1="https://psd-14.sentinel2.eo.esa.int
or
<n1:Level-1C_DataStrip_ID xmlns:n1=“https://psd-12.sentinel2.eo.esa.int
etc.
See: https://step.esa.int/main/third-party-plugins-2/sen2cor/
" Sen2Cor_v2.5.5 is the previous release and it is needed if the user intends to process old Sentinel-2 L1C data generated with the Products Specification Document older than 14.2 and not reprocessed by ESA.”

Hello, I am using the Sen2Cor 2.5.5 version for L1C to process data since 2016, but I find the following error. Do you know what it could be?

Operation mode PDGS is not supported for Product version 14.2.
Operation mode will be reset to TOOLBOX.

Sentinel-2 Level 2A Processor (Sen2Cor). Version: 2.5.5, created: 2018.03.19, supporting Level-1C product version <= 14.5 started …
Product version: 14.2. Operation mode: TOOLBOX.Syntax error in metadata, see report file for details.
[ERROR] L2A_XmlParse: 120 Schema file: L2A_GIPP.xsd
[ERROR] L2A_XmlParse: 120 Schema file: L2A_GIPP.xsd
[ERROR] L2A_XmlParse: 121 Details: Element ‘Nr_Threads’: This element is not expected. Expected is ( Operation_Mode ).
[ERROR] L2A_XmlParse: 121 Details: Element ‘Nr_Threads’: This element is not expected. Expected is ( Operation_Mode ).
Parsing error:
Schema file: L2A_GIPP.xsd
Details: Element ‘Nr_Threads’: This element is not expected. Expected is ( Operation_Mode ).
Traceback (most recent call last):
File “/home/urielm/sargazo_lage/Sen2Cor-02.05.05-Linux64/lib/python2.7/site-packages/sen2cor/L2A_Process.py”, line 354, in
sys.exit(main())
File “/home/urielm/sargazo_lage/Sen2Cor-02.05.05-Linux64/lib/python2.7/site-packages/sen2cor/L2A_Process.py”, line 301, in main
result = config.readPreferences()
File “/home/urielm/sargazo_lage/Sen2Cor-02.05.05-Linux64/lib/python2.7/site-packages/sen2cor/L2A_Config.py”, line 4140, in readPreferences
par = node.Nr_Processes
File “src/lxml/lxml.objectify.pyx”, line 229, in lxml.objectify.ObjectifiedElement.getattr (src/lxml/lxml.objectify.c:3837)
File “src/lxml/lxml.objectify.pyx”, line 450, in lxml.objectify._lookupChildOrRaise (src/lxml/lxml.objectify.c:6541)
AttributeError: no such child: Nr_Processes

thank you

Hi, @j08lue. I am encountering the exact same problem for 50 out of 100 scenes I am going to work with. Have you found the solution that actually worked?
Thanks!

Did you try adding empty AUX_DATA folders, as proposed above? Not sure whether / how I made this work…

Unfortunately, it didn’t work for me. Thanks anyway!

All products that I tried to process with sen2cor_2.8 and downloaded since March 30, 2021 generate the same error: AttributeError: ‘bool’ object has no attribute 'SPACECRAFT_NAME’

These products can be perfectly corrected when processed with sen2cor2.5.5

3 Likes