Sen2Cor 2.5.5 failing for Product version: 14.5

I keep getting an error when i run Sen2Cor 2.5.5 on this product “S2A_MSIL1C_20171030T104151_N0206_R008_T32UND_20171030T141121.SAFE”, which has a product version of 14.5. Sen2Cor runs successfully for other product versions. The error traceback is shown below:

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.5. Operation mode: PDGS. Processing baseline: 02.06.
Traceback (most recent call last):
File “C:\Users\tetteh\Downloads\Sen2Cor-02.05.05-win64\Lib\site-packages\sen2cor\L2A_Process.py”, line 354, in
sys.exit(main())
File “C:\Users\tetteh\Downloads\Sen2Cor-02.05.05-win64\Lib\site-packages\sen2cor\L2A_Process.py”, line 309, in main
L2A_TILES = updateTiles(config)
File “C:\Users\tetteh\Downloads\Sen2Cor-02.05.05-win64\Lib\site-packages\sen2cor\L2A_Process.py”, line 40, in updateTiles
L1C_TILES = config.createOrUpdateL2A_UserProduct()
File “C:\Users\tetteh\Downloads\Sen2Cor-02.05.05-win64\Lib\site-packages\sen2cor\L2A_Config.py”, line 3356, in createOrUpdateL2A_UserProduct
self.createAtmDataFilename()
File “C:\Users\tetteh\Downloads\Sen2Cor-02.05.05-win64\Lib\site-packages\sen2cor\L2A_Config.py”, line 4572, in createAtmDataFilename
delta = self.assignOzoneContent()
File “C:\Users\tetteh\Downloads\Sen2Cor-02.05.05-win64\Lib\site-packages\sen2cor\L2A_Config.py”, line 4620, in assignOzoneContent
self.ozoneContent = min(columns, key=columns.get)
AttributeError: ‘NoneType’ object has no attribute ‘get’

Has anyone encountered this problem and what was the solution.

Thanks a lot in advance.

So, I solved this directly in the code by setting the product version to 14.2 instead of using the default version of 14.5, so that TOOLBOX is used as the operation mode instead of PDGS. Sen2Cor 2.5.5 reported some XML validation errors, but was able to successfully create the BOA products.

My problem is different: the process works almost until the end then fails to export the files (in Windows 10; in Win 8.1, it works), either within SNAP or in command line. Maybe what you did, changing the product version, could do the trick. How did you do that?
Thanks

I get the same issue when using “AUTO” rather than preselected “WINTER” or “SUMMER” which is not a good idea in an automated processing chain.
The reaons is that sen2cor\L2A_Config.py", line 4620, does not contain any code to support “AUTO” detection…

1 Like

I made the change directly in the code by inserting the code block below after line 4748 in the “setProductVersion” function of the “L2A_Config.py” file.

                    if self.productVersion > float32(14.2):
                      self.productVersion = float32(14.2)

Hope it helps you guys!

2 Likes

Very good! Thank you.

By the way I solved my problem with exporting the files at the end of the process: I reinstalled everything from scratch after hours and hours of unsuccessful trial and error. Now, it works fine, at least from within SNAP. My feeling is that when something gets wrong in the first, in Sen2Cor some files have been modified in a way that there’s no easy turnaround.

I normally use the CLI and not SNAP. Thanks for the pointers.

1 Like

Same problem here Markus, with Sen2Cor-02.05.05-win64.

I also get problems when Aerosol_Type is set to AUTO.

This should be fixed asap.

Hello, thanks for the comments on how to solve this issue.
I am using windows 10/64 bit with sen2cor version 2.5.5 and working with the command promt.

I had processed without problem imagery of 2018-09-14 (Y-M-D) and now that I want to process imagery of 2018-12-13 I got the same error message as posted in the first message.

I went to folder: Sen2Cor-02.05.05-win64\Lib\site-packages\sen2cor and there I found the L2A_Config.py file. I got into the setProductVersion part and insert the code suggested by gotetteh. However, I got another error message that I paste below:

L2A_Process S2A_MSIL1C_20181213T161651_N0207_R140_T16PDU_20181213T194039.SAFE --resolution=10
Processing baseline 02.1 is not implemented yet.
Product version 14.5 will be used but errors during processing might occur.
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.07.
[CRITICAL] L2A_Config: 3181 Error in creating L2A User Product
[CRITICAL] L2A_Config: 3181 Error in creating L2A User Product

For clarification the original code at line 4721 was:

                    # get the baseline from L1C metadata:
                    tree = root['General_Info']
                    pi = tree['{}' + 'Processing_Info']
                    processingBaseline = pi.PROCESSING_BASELINE.pyval
                    if (productVersion <= int(14)) & (processingBaseline < float32(2.05)):
                        if self.namingConvention == 'SAFE_STANDARD':
                            productVersion = float32(13.1)
                        else:
                            productVersion = float32(14.2)
                    elif (productVersion <= int(14)) & (processingBaseline < float32(2.06)):
                        productVersion = float32(14.2)
                    elif (productVersion == int(14)) & (processingBaseline < float32(2.07)):
                        productVersion = defaultProductVersion
                    elif productVersion > float32(14.0):
                        stdoutWrite('Product version %04.1f is not implemented yet.\n' % (productVersion))
                        stdoutWrite('Version 14.5 will be used but warnings during validation might occur.\n')
                        productVersion = defaultProductVersion
                    elif processingBaseline > float32(2.06):
                        stdoutWrite('Processing baseline %04.1f is not implemented yet.\n' % (processingBaseline))
                        stdoutWrite('Product version 14.5 will be used but errors during processing might occur.\n')
                        productVersion = defaultProductVersion
                except:
                    stdoutWrite('Product version cannot be read.\n')
                    stdoutWrite('14.5 will be used by default, but warnings during validation might occur.\n')
                if not self.processingBaseline:
                    self.processingBaseline = processingBaseline
                self.productVersion = productVersion
                return True
    stdoutWrite('Product metadata file cannot be read.\n')
    return False

After I change the code it was:

                    # get the baseline from L1C metadata:
                    tree = root['General_Info']
                    pi = tree['{}' + 'Processing_Info']
                    processingBaseline = pi.PROCESSING_BASELINE.pyval
                    if (productVersion <= int(14)) & (processingBaseline < float32(2.05)):
                        if self.namingConvention == 'SAFE_STANDARD':
                            productVersion = float32(13.1)
                        else:
                            productVersion = float32(14.2)
                    elif (productVersion <= int(14)) & (processingBaseline < float32(2.06)):
                        productVersion = float32(14.2)
                    elif (productVersion == int(14)) & (processingBaseline < float32(2.07)):
                        productVersion = defaultProductVersion
                    elif productVersion > float32(14.0):
                        stdoutWrite('Product version %04.1f is not implemented yet.\n' % (productVersion))
                        stdoutWrite('Version 14.5 will be used but warnings during validation might occur.\n')
                        productVersion = defaultProductVersion
                    elif processingBaseline > float32(2.06):
                        stdoutWrite('Processing baseline %04.1f is not implemented yet.\n' % (processingBaseline))
                        stdoutWrite('Product version 14.5 will be used but errors during processing might occur.\n')
                        productVersion = defaultProductVersion
                except:
                    stdoutWrite('Product version cannot be read.\n')
                    stdoutWrite('14.5 will be used by default, but warnings during validation might occur.\n')

                if not self.processingBaseline:
                    self.processingBaseline = processingBaseline
                self.productVersion = productVersion
                if self.productVersion > float32(14.2):
                  self.productVersion = float32(14.2)
	return True

    stdoutWrite('Product metadata file cannot be read.\n')
    return False

What am I doing wrong?
Thank your for your help. I appreciate it.

Hi,

When I was using Sen2Cor to process L1C data,S2A_MSIL1C_20160430T030932_N0201_T50RKU_20160430T030928,I encountered the similar problem.I would like to ask you how to change the operation mode from PDGS to TOOLBOX.The specific problems are as follows:Sen2 Cor 2.5.5—How to convert operation mode PDGS to TOOLBOX?

Thank you so much.