Reprojection_S3 OLCI L2 product

Hello everyone,

I am very new to this area and to the batch processing function using windows batch file. I am trying to reproject S3 OLCI products, but somehow having issue reading the source product (xfudamanifest.xml) from the S3 (.SEN3) subfolders. The issue is somehow related to how I have set up the sourceDirectory and the batch processing command at the end. I would appreciate much if anyone who have experience with batch processing could look at the batch processing script below, and suggest me where I am going wrong, especially the sourceDirectory and the main batch processing command function. I have tried to highlight those in the attached screenshot.

@echo off
rem enable delayed expansion - used to resolve variable in loop
rem variable has to be used with '!' instead of '%'

:: User Configuration
rem adapt this path to your needs
set gptPath="c:\Program Files\snap\bin\gpt.exe"
:: Command line handling

rem first parameter is a path to the graph xml
set graphXmlPath=C:\Users\au\Desktop\Trial\Reprojection_SU.xml
rem second parameter is a path to a parameter file
set parameterFilePath=""
rem use third parameter for path to source products
set sourceDirectory=C:\Users\au\Desktop\Trial\Slave\*.SEN3\xfdumanifest.xml\
set template="C:\Users\au\Desktop\Trial\"
rem use third parameter for path to target products
set targetDirectory=C:\Users\au\Desktop\Trial\Reprojected\
rem the fourth parameter is a file prefix for the target product name, 
rem typically indicating the type of processing
set targetFilePrefix=reproj_

rem Create the target directory
rem md %targetDirectory%

:: Main processing

rem double '%' in batch file and only a single '%' on command line
for /R %sourceDirectory% %%F in (*.xml) do (
  rem '~fF' means abolute path of 'F' 
  set sourceFile=%%~fF
    rem '~nF' means filename without extension of 'F'
                set procCmd=%gptPath% %graphXmlPath% -e -f  NetCDF4-BEAM -t "!targetFile!" -Ssource="!sourceFile!" -Smaster="!template!"  
  call !procCmd!

Thank you very much.


the problem is probably that you already point to a file with the sourcedirectory.

try the following, change the sourceDirectory and the header of the loop:

set sourceDirectory=C:\Users\au\Desktop\Trial\Slave

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

This will use the directory as a parameter for the directory.

Thank you @marpet for your reply, appreciate it very much.
I tried the code you suggested and it now comes up with the error that reads as, “org.esa.snap.core.gpf.graph.GraphException: [NodeId: ReadOp@master] The ‘file’ parameter is not set”. Do you have idea on what it could be related to?

Thank you very much.
Command_prompt_error_reprojection.txt (3.2 KB)

This is probably related to your graph xml file.
The read operator is not correctly configured. Maybe you can post it?

Here is my graph xml file.

Reprojection_SU.xml (1.1 KB)

Thanks for graph file.
This might cause the error. Just use
The ‘!’ are only necessary for variables which are reset within the loop.

However, you can remove this parameter at all because you are not using the master/template in the graph.

Hi again @marpet,

Thank you for your suggestion and for your time helping me with this. I really appreciate it very much.

I tried both -Smaster=%template% and removing the parameter,as per your suggestion. Now it is coming with a different error that reads as “Error: [NodeId: Reproject] Operator ‘ReprojectionOp’: Mandatory source product (field ‘sourceProduct’) not set.” I have a feeling it is something to do with the graph xml file now, as you yourself mentioned earlier.
Command_prompt_error_reprojection_new.txt (3.9 KB)

Maybe you can use echo in your script to print out the value of sourceFile.
It could be that this variable is not yet correctly.

That’s probably my last reply today. Need to do other things, sorry.

Hi @marpet

I understand. Thank you for all your support. Appreciate it very much.