Command line iCOR 2.0 failing for S2 data

Hello

We have recently installed iCOR 2.0 to process Landsat 8 and Sentinel 2 data (ubuntu 18.04 LTS). We are mainly insterested on batch processing. Some time ago we worked with iCOR previous version, and after a iCOR developers feedback we used a command line call to icor.py in order to process the data.

Currently, these command line call is working correctly por Landsat 8, however are failing for Sentinel 2. We show an example of the S2-iCOR call and their output:

/usr/bin/python /opt/vito/icor/src/icor.py --keep_intermediate true --cloud_average_threshold 0.19 --cloud_low_band B01 --cloud_low_threshold 0.25 --cirrus true --aot true --aot_window_size 500 --simec true --watervapor true --bg_window 1 --cirrus_threshold 0.01 --aot_override 0.1 --ozone_override 0.33 --wv_override 2.0 --water_band B08 --water_threshold 0.05 --data_type S2 --output_file /media/seasnet/ext10tb_02/sentinel2/procesamiento/canarias/20190312_S2A/S2A_20190312_T28RBS.tif /media/seasnet/ext10tb_02/sentinel2/procesamiento/canarias/20190312_S2A/S2A_MSIL1C_20190312T115211_N0207_R123_T28RBS_20190312T151823.SAFE/MTD_MSIL1C.xml
parsing arguments
done
icor installation folder /opt/vito/icor
running icor for Sentinel2 …
reading config /opt/vito/icor/src/config/local_sentinel2_simec.ini
output path = /media/seasnet/ext10tb_02/sentinel2/procesamiento/canarias/20190312_S2A/S2A_20190312_T28RBS.tif
iCOR temp folder : /tmp/icor_ttCvEv_proc
workflow = simec
Traceback (most recent call last):
File "/opt/vito/icor/src/icor.py", line 45, in process_product
icor.sentinel2.process_saf(context, product,working_folder)
File "/opt/vito/icor/src/icor/sentinel2.py", line 72, in process_saf
granules = sentinel2_metadata.parse(path,bandList)
File "/opt/vito/icor/src/icor/sentinel2_metadata.py", line 310, in parse
raise Exception("Something went wrong while parsing the S2 metadata file: %s" % str(e))
Exception: Something went wrong while parsing the S2 metadata file: coercing to Unicode: need string or buffer, NoneType found

Due to that I have test the SNAP plugin to interactively run iCOR fo S2 data and it works on our system. Please find enclosed the succesful SNAP interactive iCOR usage “Display Execution Output” in the attached file S2_SNAP_interactive_iCOR.txt. Why is not working from command line call?

Regards
Josep

S2_SNAP_interactive_iCOR.txt (6.4 KB)

Hello,

the quick solution to this problem is to provide the link to an image file in the ‘IMAGE_DATA’ folder as the input file.
In stead of
/media/seasnet/ext10tb_02/sentinel2/procesamiento/canarias/20190312_S2A/S2A_MSIL1C_20190312T115211_N0207_R123_T28RBS_20190312T151823.SAFE/MTD_MSIL1C.xml

you can provide
/media/seasnet/ext10tb_02/sentinel2/procesamiento/canarias/20190312_S2A/S2A_MSIL1C_20190312T115211_N0207_R123_T28RBS_20190312T151823.SAFE/GRANULE/L1C_T28RBS_A019425_20190312T115214/IMG_DATA/T28RBS_20190312T115211_B01.jp2

OR

as an administrator, change a line code in
/opt/vito/icor/src/icor/sentinel2_metadata.py
line 162
from
if str(input_file).find(“GRANULE”):
to
if str(input_file).find(“GRANULE”) != -1:

this bug will be fixed in a next release/patch.

Hope this works out for you.
Stefan Adriaensen

2 Likes

Hello,

Thank you very much for the support. Following your instructions I have changed the line 162 in sentinel2_metadata.py and currently the processing is working

Josep