OpenJPEG library error: Cannot handle box of undefined sizes

Hello there,

I already processed L2A Data (10m) successfully with sen2cor a few weeks ago on my Windows-64bit machine.
Since i had the data i did some processing on, i didnt use sen2cor for a while now.
I tried to follow the discussion and all possible workarounds presented in the forum anyway.

No i tried to process some more data and encountered a new error, which is not yet covered in the forum:

IOError: OpenJPEG library error: Cannot handle box of undefined sizes

Here some additional information:

1.Scene name

S2A_OPER_MTD_SAFL1C_PDMC_20151211T205504_R024_V20151211T135948_20151211T135948

2.Path to SAFE-Folder

D:\beck_ct\data\s2a\L1C\asuncion\L1C_20151211T205504_R024

3.Output of L2A_Process -h

usage: L2A_Process-script.py [-h] [--resolution {10,20,60}] [--sc_only]
                             [--profile]
                             directory
Sentinel-2 Level 2A Prototype Processor (Sen2Cor). Version: 2.0.6, created:
2015.12.02, supporting Level-1C product version: 13.
positional arguments:
  directory             Directory where the Level-1C input files are located
optional arguments:
  -h, --help            show this help message and exit
  --resolution {10,20,60}
                        Target resolution, must be 10, 20 or 60 [m]
  --sc_only             Performs only the scene classification at 60m
                        resolution
  --profile             Profiles the processor's performance

4.Output of L2A_Process.exe D:\beck_ct\data\s2a\L1C\asuncion\L1C_20151211T205504_R024:

Traceback (most recent call last):
File “C:\Users\beck_ct\Programs\Anaconda2\Scripts\L2A_Process-script.py”, line 9, in
load_entry_point(‘sen2cor==2.0.6’, ‘console_scripts’, ‘L2A_Process’)()
File “C:\Users\beck_ct\Programs\Anaconda2\lib\site-packages\sen2cor-2.0.6-py2.7.egg\sen2cor\L2A_Process.py”, line 283, in main
result = processor.selectAndProcess(tile)
File “C:\Users\beck_ct\Programs\Anaconda2\lib\site-packages\sen2cor-2.0.6-py2.7.egg\sen2cor\L2A_Process.py”, line 117, in selectAndProcess
self._processed60 = self.process()
File “C:\Users\beck_ct\Programs\Anaconda2\lib\site-packages\sen2cor-2.0.6-py2.7.egg\sen2cor\L2A_Process.py”, line 132, in process
if(self.preprocess() == False):
File “C:\Users\beck_ct\Programs\Anaconda2\lib\site-packages\sen2cor-2.0.6-py2.7.egg\sen2cor\L2A_Process.py”, line 180, in preprocess
if(self.tables.importBandList() == False):
File “C:\Users\beck_ct\Programs\Anaconda2\lib\site-packages\sen2cor-2.0.6-py2.7.egg\sen2cor\L2A_Tables.py”, line 822, in importBandList
self.importBand(i, filename)
File “C:\Users\beck_ct\Programs\Anaconda2\lib\site-packages\sen2cor-2.0.6-py2.7.egg\sen2cor\L2A_Tables.py”, line 1092, in importBand
indataArr = indataset[:]
File “c:\users\beck_ct\programs\anaconda2\lib\site-packages\glymur-0.8.0-py2.7.egg\glymur\jp2k.py”, line 945, in getitem
return self._read()
File “c:\users\beck_ct\programs\anaconda2\lib\site-packages\glymur-0.8.0-py2.7.egg\glymur\jp2k.py”, line 1043, in _read
img = self._read_openjp2(**kwargs)
File “c:\users\beck_ct\programs\anaconda2\lib\site-packages\glymur-0.8.0-py2.7.egg\glymur\jp2k.py”, line 1237, in _read_openjp2
image = opj2.read_header(stream, codec)
File “c:\users\beck_ct\programs\anaconda2\lib\site-packages\glymur-0.8.0-py2.7.egg\glymur\lib\openjp2.py”, line 915, in read_header
OPENJP2.opj_read_header(stream, codec, ctypes.byref(imagep))
File “c:\users\beck_ct\programs\anaconda2\lib\site-packages\glymur-0.8.0-py2.7.egg\glymur\lib\openjp2.py”, line 591, in check_error
raise IOError(msg)
IOError: OpenJPEG library error: Cannot handle box of undefined sizes

5.Environment Variables (SET) Output

AGSDESKTOPJAVA=C:\Program Files (x86)\ArcGIS\Desktop10.3
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\beck_ct\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=EOC-000755
ComSpec=C:\WINDOWS\system32\cmd.exe
ENVI53_GPTOOLS=C:\Program Files\Exelis\IDL85
FP_NO_HOST_CHECK=NO
GDAL_DATA=C:\Users\beck_ct\Programs\Anaconda2\Lib\site-packages\osgeo\data\gdal
GPT_HOME=C:\Programme\snap\bin
HOMEDRIVE=H:
HOMEPATH=
HOMESHARE=\afhome2\beck_ct
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Adobe\Adobe PDF iFilter 11 for 64-bit platforms\bin;C:\Program Files (x86)\Blue Coat\ProxyClient;C:\Program Files\Hexagon\ERDAS IMAGINE 2015;C:\Program Files\GDAL;C:\Users\beck_ct\Programs\Anaconda2;C:\Users\beck_ct\Programs\Anaconda2\Scripts;C:\Users\beck_ct\Programs\Anaconda2\Library\bin;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Adobe\Adobe PDF iFilter 11 for 64-bit platforms\bin;C:\Program Files (x86)\Blue Coat\ProxyClient;C:\Program Files\Hexagon\ERDAS IMAGINE 2015;C:\Users\beck_ct\Programs\Anaconda\Lib\site-packages\osgeo;C:\Users\beck_ct\Programs\snap\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 63 Stepping 2, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3f02
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
PYTHONPATH=C:\Program Files\Hexagon\ERDAS IMAGINE 2015\usr\lib\Win32Release\python
QD=C:\ProgramData\Intergraph\QD
SEN2COR_BIN=C:\Users\beck_ct\Programs\Anaconda2\Lib\site-packages\sen2cor-2.0.6-py2.7.egg\sen2cor
SEN2COR_HOME=C:\Users\beck_ct\documents\sen2cor
SESSIONNAME=Console

What i already did:

  1. Uninstalled sen2cor over pip (pip uninstall sen2cor)
  2. reinstalled my complete Anaconda installation
  3. Checked the relevant environment variable (GDAL_DATA, SEN2COR_BIN, SEN2COR_HOME)

Does anybody have a suggestion how to solve my problem? Im really stuck over here!

Thank you for your help.

Christian

Hi,

i resolved my issue. It turned out, the problem was an external GDAL-Library (http://www.gisinternals.com/).

The GDAL_DATA user environment variable was set also as system environemnt variable from an external GDAL Installation. The system environemnt variable was also named GDAL_DATA. Therefore sen2cor was pointing to this library during the installation.

Solution:

  • Uninstall Anaconda
  • Remove the duplicate GDAL_DATA from system environment variables
  • Remove links to external GDAL Library from system PATH environment
    variable
  • Reinstall Anaconda + sen2cor

Christian