OLCI C2RCC bulk processing

Hello everyone, I am trying to perform C2RCC batch processing on OLCI, but when I created the processDataset.bat file and the parameter file named c2rcc.properties and the c2rcc.xml file, I called the command in cmd but there was no file output.

The source products are located in the directory ‘F:\SNAP_download\Processing\subset\2016\6’ and the XML graph file and the parameter are in the same directory as the batch file. The processed files will go to ‘F:\SNAP_download\Processing\C2RCC\2016\6’ and have the prefix c2rcc

When I use the .xml to process one product of OLCI, the xml file is available, so I think the problem should lie in the .bat file.I looked up a lot of answers in the forums but they didn’t solve my problem. Can someone tell me which step is the problem?, thank you in advance for your help.

Attaching files below:
c2rcc.xml (600 Bytes) c2rcc.properties (133 Bytes)
processDataset.bat (2.2 KB)

Hi
You have hardcoded the path to the xml and the properties, which is fine for you use case, but then you don’t need to provde them anymore on the command line.

What I’ve noticed is that you should remove the ‘/D’, because you specify a file.
Alternatively, you can change the for-loop header to:

for /D /R %sourceDirectory% %%F in (S3*.SEN3) do (

I guess this will work too.

Hi marpet,

Thank you very much for your answer, but I tried to change the content of processDataset.bat to
for /D /R %sourceDirectory% %%F in (S3*.SEN3) do (
Or for /D /R %sourceDirectory% %%F in (S3*.SEN3/xfdumanifest.xml) do (
But still no results are produced in cmd.

My cmd command is:

processDataset.bat c2rcc.xml c2rcc.properties F:\SNAP_download\Processing\subset\2016\6 F:\SNAP_download\Processing\C2RCC\2016\6 c2rcc

I tried changing the command to processDataset.bat c2rcc.xml c2rcc.properties
But still no results.Is there something wrong with one of my steps? Thank you again for your patience!

This is my CMD interface.


This was a bit tricky.

But if you remove the quotes around the pathes you have entred then it should work.

set sourceDirectory="F:\SNAP_download\Processing\subset\2016\6"

set sourceDirectory=F:\SNAP_download\Processing\subset\2016\6

Also, the other paths in the loop.
The gptPath variable has those quotes in the original script, but it is used differently. The quotes could be used there, too.

P.S. A funny note:
I tried to translate image
It was translated to: “The order language law is not positively confirmed.”
Which is a nice description of the English: “Syntax error”

1 Like

I think that in the last part of the .bat file, the Main processing, there you have already included the paths to your xml and properties and you do not need to write it again when you run the batch mode.

Hi marpet!

I deleted all the path quotation marks in Command line handling and Main processing(except for the path quotation marks of gpt.exe), but when I enter the cmd command, this time no Syntax error is reported but there is still no result output.

This is my cmd interface and .bat file.



I tried writing the path and not writing the path in the CMD command, but no results were output.
processDataset.bat (2.2 KB)

Hi abruescas.

You mean to enter the following commands in the command line?
processDataset.bat c2rcc.xml c2rcc.properties

I tried the above command, but there is no output. The cmd window is the same as what I said to marpet.I don’t know where the error occurred. Thank you for your kind help!
https://forum.step.esa.int/uploads/default/original/3X/d/a/da744ad273438fbb2206bba39b38f124d66274c0.png

Try this loop header:
for /R %sourceDirectory% %%F in (xfdumanifest.xml) do (
or this one:
for /D /R %sourceDirectory% %%F in (*.SEN3) do (

And please familiarise yourself with the command line.
There are some entry points at the bottom of the wiki page:
Bulk Processing with GPT - SNAP Wiki

Thank you very much, Sir!!!

CMD is finally up and running, but I’m working with a subset of images that have been batch processed in the SNAP software, and there’s no xfdumanifest.xml in the file, which is a bug.

If I want to batch C2RCC for subset images, should I change
for /R %sourceDirectory% %%F in (xfdumanifest.xml) do (
to for /R %sourceDirectory% %%F in (*.img) do ( ?

If you have the results to BEAM-DIMAP you might use:
for /R %sourceDirectory% %%F in (*.dim) do (

Hi Marpet,
I used C2RCC batch processing OLCI data based on python platform, but there are some INFO and Warning, want to know why this is. Here is the code, and errors in python. This code can handle all the data, but finally read the data after all 0 or NAN, such as I want to read rrs_1 or rhown_1. If you can answer I will be grateful!
import os
import time
import datetime
from subprocess import call
filepath1=‘H:/Data/’ #Original data downloaded from website
outputdir=‘H:/C2RCC/’ #C2RCC atmospheric corrected data
filelist1=os.listdir(filepath1)
inputlist=[]
outputlist=[]
for fl1 in filelist1:
outfile1=outputdir+fl1+‘_C2RCC.nc’
if os.path.exists(outfile1):
continue
else:
outputlist.append(outfile1)
filepath2=filepath1+fl1
filelist2=os.listdir(filepath2)
filepath3=filepath2+‘/’+filelist2[0]
filelist3=os.listdir(filepath3)
for fl3 in filelist3:
fl3l=fl3.split(‘.’)
if fl3l[-1]==‘xml’:
filepath4=filepath3+‘/’+fl3
inputlist.append(filepath4)
else:
continue
for inputfile,outputfile in zip(inputlist,outputlist):
try:
print(‘Start processing-----------’+str(datetime.datetime.now()))
print(inputfile)
cmdline=‘gpt c2rcc.olci -SsourceProduct="’+inputfile+‘" -PoutputAsRrs=“true” -t "’+outputfile+‘" -f “NetCDF4-BEAM”’
call(cmdline)
print(‘End of processing-----------’+str(datetime.datetime.now()))
print(‘\n\n’)
except:
print(inputfile+‘Processing failed’)
continue

I:/Sentinel-3/all/S3A_OL_1_EFR____20200726T040207_20200726T040507_20200727T081400_0179_061_047_2340_LN1_O_NT_002/S3A_OL_1_EFR____20200726T040207_20200726T040507_20200727T081400_0179_061_047_2340_LN1_O_NT_002.SEN3/xfdumanifest.xml
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: GDAL not found on system. Internal GDAL 3.2.1 from distribution will be used. (f0)
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.2.1 set to be used by SNAP.
SEVERE: org.esa.s2tbx.dataio.gdal.GDALLoader: Failed to initialize GDAL native drivers. GDAL readers and writers were disabled.Illegal char <:> at index 35: E:\anaconda\Library\mingw-w64\bin D:\Anaconda\Library\usr\bin
INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.2.1 set to be used by SNAP.
WARNING: org.esa.s3tbx.c2rcc.olci.C2rccOlciOperator$Spi: TSMfakBpart and TSMfakBwit are deprecated parameters and shall not be used anymore.Please use TSMfac and TSMexp instead. Please consult the help for more information.
INFO: org.esa.s3tbx.c2rcc.olci.C2rccOlciOperator: c2rcc initial tile : null, configured tile: java.awt.Dimension[width=1217,height=1023]
INFO: org.hsqldb.persist.Logger: dataFileCache open start
Executing operator…

How to use the c2rcc.xml and processDataset.bat et.al. to process? What is the detail? Thanks!

How the processDataset.bat can be used is explained here: Bulk Processing with GPT - SNAP

Thanks. But resample_s2.xml is S2, what about S3 olci? And what is the resample-20m mean?

You have to adapt this to your sensor. We can’t provide it examples for every sensor.
The file resample_s2.xml is just an example for a graph xml.
You can use any other graph file. And the file resample-20m.properties contains the parameters specific for the graph. When using C2RCC you could put the parameters in a c2rcc.properties files for example.

You can first step through the example. Afterwards you probably know what you need to adapt.

Thank you. I will start to try it, but why resample?

Just an example. Sentinel-2 must be often resampled because it comes in multiple resolutions (10, 20 and 60 meter)

Thanks. What about S3?

OLCI is provided at ~300m.
So, if you use OLCI for C2RCC you don’t need to resample it

Thanks. But there still some problems. Sorry to bother you again.


It always showed there should not be %% F of %F.
Thanks for your time!