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?
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.
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)
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 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.
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.
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)!='MTD_MSIL1C.xml') or
print('wrong metafile name detected. adapting.')
input_file = input_file.split('.SAFE')+'.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!
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).