iCOR Landsat 8 error

Hi,

I’m trying to pre-process my Landsat 8 imagery using the iCOR plugin within the SNAP software. I’ve changed the tool executable to “$icorinstalldir/bin/Python27/python.exe” and the working directory to “$icorinstalldir”. However it only runs for one second and does not output any results. I was wondering if anyone had any suggestions on how to overcome this?

Thank you!

Hi Helena,

Are you running iCOR with SNAP 5 or SNAP 6? Currently iCOR is not available for SNAP 6.

Best regards.

You can run iCOR even in command line. I do it in that way and I got no problems both with Sentinel-2 or Landsat 8 data.

Hello Helena,

after checking some details, I have to advice you the replace ‘$icorinstalldir’ for the working directory (not the tool exec) into a concrete directory on your system. This variable will not be replaced correctly when executing icor.
You can fill in any folder with read/write permission. Therefore, depending on your installation the “icorinstalldir” might not be the best choise.

If you still encounter issues, please let me know.

Best regards.

Hmmm, I have used ICor with Snap 6.0 and apart from not saving any cloud mask I had no problem.

Hi icor,

I have the same - or a similar - issue. At least, my ICor run also just finishes after no time without output.

Execution output in 'Processing Parameters ’ tab has the following (see also ps.):

I’m trying to process Sentinel-2 data, though, not Landsat and use the respective S2 plugin. I have changed (independently as well as simultaneous) the working directory (to an explicit path) as well as the tool executable (to my native python2.7 installation, using an explicit path). The problem remains in either case.

I am also using SNAP 6.0, but according to @Cristina_Vrinceanu that shouldn’t be a/the problem?

ps. I have now changed sentinel_metadata.py such that the error message tells me, which "metadata file"causes the problem. Updated the screenshot accordingly. And wonder, why it is trying to access the true color jp2. but well…
(running from command line as suggested by @mdelgado has no immediate issue with a metafile)

Hi Jose,

could you share how you run iCor from command line? What you mean is something like the Sen2cor standalone L2A_Process.bat? Or via snappy or the gpt? I couldn’t find hints in the iCor User Manual.

Yes, it is totally standalone.
Search on the installation directory and you will see a src folder where you will find the icor.py (or similar) script.
If you launch it using python icor.py you will get the usage, specifying also the default parameters for calibrating L8 and S2 datasets.
If I remember properly you should use python 2.7 and it works on CentOS7 and Ubuntu16 (as specified in the user manual)

I hope this helps.

1 Like

ah, thanks (also, for the very fast answer! :slight_smile: ). i’ll give it a try.

(to my dismay, i’m stuck with windows here, though. but let’s see… using conda most python things work surprisingly well, even on windows.)

I think the iCOR package has everything you need (including even python and libraries). check it out!
I hope I remember it well.
But indeed the user manual recommends linux, so it migh be a reason for that.

Let me know

yes, I recognized that, too. however, for now, I’m using my native py27 install.

getting the processing to run from command line took a bit of fumbling (because the interface actually requires all parameters manually specified. and i didn’t find from the command line help, hence went back to SNAP for that and checked the configuration&operator parameters used there for S2…). BUT, at least it started processing. Still running, so no idea whether the output is good. But that’s at least one step further than with the SNAP interface.

thanks. :+1:

update: works. results look reasonable. :slight_smile:

ok, i have to admit i’m a little blind. the user manual has a table of defaults… :man_facepalming:

just found that this issue had been encountered (and reported) with SNAP 6.0 beta already, several months ago:

still no solution? :frowning:

So the command line worked? I am glad my advice had helped you to solve your problem. Any picture?

yep, it did. I am glad, too! :slight_smile:
(still, I’d really like to have to in-SNAP version working, too. perfectionist that I tend to be…)

picture? of the results? not too much too see (a tile full of cumulus). analysis is on hold; still busy with getting all the tools up & running and with understanding what I’m doing :wink:

A closer look into this points towards the plugin not identifying the metafile correctly, or alternatively constructing the metafile name in a wrong way when used with SNAP6.0. As shown in the screenshot in the other post, it passes the TCI.jp2 in the GRANULE[…]\IMG_DATA\ folder as metafile, whereas the correct would be the MTD*.xml in the top level of the *.SAFE folder.

Unfortunately I have no idea where/how to modify the plugin.

Instead, I tweaked sentinel2_metadata.py a little by adding this at the very beginning of the parse method:

    if ((os.path.splitext(input_file)[1]!='MTD_MSIL1C.xml') or
        (os.path.splitext(os.path.split(input_file)[0])[1]!='.SAFE')):
            print('wrong metafile name detected. adapting.')
            input_file = input_file.split('.SAFE')[0]+'.SAFE'+os.sep+'MTD_MSIL1C.xml'
    print('parsing %s' %input_file)

Not 100% sure it works on every system and with any S2 data, but for me & my system & data, it did the trick.

Hello, I am also trying to process Sentinel-2 data using the icor.py script in windows 10 but am getting an error (see screen shot below). I get an “open image failed” message when it tries to open a file within the working directory. The script successfully creates a folder within the working directory but it is empty except for a config.log file. Any ideas? I’ve also shown my input into the command prompt below the “failure” screen shot. Thanks!

Hi,

Are you using SNAP 5 or SNAP 6 for the iCOR atmospheric correction?
Can you try to shorten the Sentinel-2 name/path?

Best regards,
the iCOR team

Thanks for the suggestion. I was trying to run the icor.py script on its own, outside of SNAP. I don’t think the length of the path was the issue because I was under the 260 char limit for windows. I was later able to process S2 using SNAP 5, and Landsat 8 using SNAP 6 so I plan on running SNAP 5 & 6 on different machines so I can process both Landsat and Sentinel data.

ok, i can see why my snippet didn’t work for you, and wonder whether this also affects iCor/SNAP in other places: you haven’t kept the original data folder name containing the sensor identified, sensing/ingestion time, etc. and ending in .SAFE (my snippet uses the ‘.SAFE’ folder name ending to identify the top data folder).