ICOR not running "GDAL "

Thanks, Here I have several file in opt/vito/icor/src/icor/

I am confused with edit **I have 2 file 1) Sentinel2.py 2) sentinel3.py

Inside Sentinel2.py
!/usr/bin/env python

import os
import os.path
import glob
import threading

from . import context

from . import sentinel2_metadata

from . import glintcor

import gdal

In sentinel3.py file

import os
import os.path
import glob
import threading

from . import context

from . import sentinel3_metadata

(I can able to see import gdal missing inside sentinel3.py) is I need to change ?

I assume you were working with Sentinel 2 data, so you should edit /opt/vito/icor/src/icor/sentinel2.py. This is needed because you are using a more recent Ubuntu and Python versions than were used by the ICOR developers and the organization of the Python modules has changed. You may encounter other changes once you get past this issue. Unless you need Anaconda Python 3 for other reasons (e.g., you aren’t allowed to install distro packages) you may be better off using Ubuntu packages for the required Python modules. You should check that the other required modules can be loaded with /usr/bin/python3 -c 'import <module>'.

I am work with sentinel3 images , Also I tried to add (from . import glintcor
import gdal) into sentinel3.py file but cannot edit the sentinel3.py file.

Also I tried with this command
(base) hello@hello-Lenovo-Z50-70:~$ /usr/bin/python3 -c ‘import numpy’

(base) hello@hello-Lenovo-Z50-70:~$ /usr/bin/python3 -c ‘import pandas’

(base) hello@hello-Lenovo-Z50-70:~$ /usr/bin/python3 -c ‘import rasterio’

(base) hello@hello-Lenovo-Z50-70:~$ /usr/bin/python3 -c ‘import gdal’
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘gdal’

also see in SNAP tool

The above picture in snap tool say gdal version not found , is it possible to import manually ? if okay how to import mannually what file i need to import and from where?

This is because the gdal module is now provided by osgeo, so you need:

from osgeo import gdal

It is a bit surprising that Sentinel 3 processing used sentinel2.py, but there may be some common functions. It is sentinel2.py that needs the “try-except” edit.

The ICOR instructions say you need sudo to install. I just used sudo mkdir /opt/vito and then sudo chown <myusername>:<mygroupname> and then ran the installer. If you ran the installer using sudo you need to use sudo to edit sentinel2.py (or just change ownership of the whole installation).

I think you will find things easier if you spend some time with a basic linux command-line tutorial such as Linux Command.

You mean I need to edit sentinel2.py ? if yes, kindly ensure below command is right?

import gdal
except ImportError:
from osgeo import gdal

You have the right words, but Python uses indentation to mark blocks.

See: How to Edit Python Code and then just copy the block of text from sentinal3.py with correct indentation.

You should spend some time with one of the many excellent introductions to Python 3. “Learn Python 3 the Hard Way” by Zed Shaw is one of the best introductory texts for people with no previous programming experience. Python.org Beginner’s Guide is also excellent.

1 Like

Hai finally it Works
I edited sentinel2.py file
Tried S3 image file load in ICOR , iThe process successfully finished.

I just checked GDAL version by SNAP- options- S2 toolbox -say ICOR version is not found .


you people time is priceless for others. I wanted to say thanks to gnwiii and others for help run ICOR and teaching


hai Hope you good

Again i have some issue in output file
I used S3 L1 data OLCI 21 band
But Icor gives 19 band after processing , also the file not show lat, long ,
Due to this i couldnot do reprojection…How to solve ?May I know what happened ?

The iCor manual contains on page 17 a table which tells you which band is which.

Yes thanks for your reference , I have seen that file manual, On that I could able see projection option or apply projection but my Icor processing screen its not available ? anything i want add from snap?

I can’t help with it. I’ve never used iCOR. Sorry.

Thanks for your time

I don’t use ICOR, only considered it for a project looking at water “clarity” near land. I think ICOR without projection preserves the original geolocation, so you should be able to add lon, lat using band maths. With projection, the details should be in the geotiff metadata, so you should not need lon,lat bands to map the data. It looks like the “Processing Parameters” window no longer has the projection option. What does gdalinfo give for your output GeoTIFF file?

Not a geotiff file , its .dim

Even better. ( was confused by seeing TIFF metadata). BEAM DIMAP is the most robust format for working with SNAP. Does SNAP give lon,lat values in the image view of the bands? Is there any geolocation metadata? If you load the input S3A file do you get the same size arrays? If so, you can try using band maths to add “missing” bands from the input file to the ICOR results. This will fail if SNAP can’t determine that the missing bands have the same size and mapping as the ICOR results.

Sometimes band maths fail due to minor metadata inconsistencies. With BEAP DIMAP, there is global metadata in the .dim file using ASCII text, and band details in the .hdr files for each band image. You can export “missing” bands as BEAM DIMAP and compare the details in the .hdr files to understand differences in the metadata.

I could not find lat long in RGB image view, band1, also no geolocation

try using band maths to add “missing” bands from the input file to the ICOR results. This step i am confused … currently I am in ICOR AC Output file… In bandmath what expression I need to enter to get lat long.

You can’t add bands to a product that isn’t geolocated. What you will be able to do depends on what geolocation is present in the ICOR (BEAM DIMAP?) product.

I try to merge lat long layer using QGIS merge tool , in result I have 23 band previously 21 band , and RGB or Band Image not open

What could be the reason ?

“Out of memory” sometimes translates to “spend money”, but you need to check that some other program isn’t using a lot of memory. Linux provides many tools to monitor memory usage. I like bpytop because is a text app that I can use locally and on remote systems). Also check the value you are using for the Java h eap (Xmx) (see Java Stack and Heap for an explanation of Java memory management).


Now that merged layer file opened but it block images