Bulk processing with GPT - command not found

In the bash, remove the parameterFilePath (Line 26-27)
and reduce the index of the following parameters
sourceDirectory="$2", and so on.
I think this causes the problems.

Zip files of S1 data products can be read.

I got the same error,

But I’m not sure if I got your second point,

You have this code block:

############################################
# Command line handling
############################################

# first parameter is a path to the graph xml
graphXmlPath="$1"
#graphXmlPath="/home/rus/Desktop/shared/Training/IMAGE2017/split/sp.xml"

# second parameter is a path to a parameter file
parameterFilePath="$2"

# use third parameter for path to source products
sourceDirectory="$3"
#sourceDirectory="/home/rus/Desktop/shared/Training/IMAGE2017"

# use fourth parameter for path to target products
targetDirectory="$4"
#targetDirectory="/home/rus/Desktop/shared/Training/IMAGE2017/out"

# the fifth parameter is a file prefix for the target product name, typically indicating the type of processing
targetFilePrefix="$5"

#targetFilePrefix="split"

But you don’t use the parameterFilePath on the command line.
So it should actually be:

############################################
# Command line handling
############################################

# first parameter is a path to the graph xml
graphXmlPath="$1"
#graphXmlPath="/home/rus/Desktop/shared/Training/IMAGE2017/split/sp.xml"

# second parameter is a path to a parameter file
#parameterFilePath="$2"

# use third parameter for path to source products
sourceDirectory="$2"
#sourceDirectory="/home/rus/Desktop/shared/Training/IMAGE2017"

# use fourth parameter for path to target products
targetDirectory="$3"
#targetDirectory="/home/rus/Desktop/shared/Training/IMAGE2017/out"

# the fifth parameter is a file prefix for the target product name, typically indicating the type of processing
targetFilePrefix="$4"

#targetFilePrefix="split"
1 Like

This is the updated bash file,

processDataset.bash (1.8 KB)

I got now one error, the path of the directory,

What’s the file extension of the S1 files?
Do they have the extension in capital letters?
It makes a difference:

The extension of the S1 file is zip, and they have extension in small letters, I edited it up in bash file as well, and run the call, now it gives the following error,

Good, that’s progress. Scanning the source is working and we entered the actual Java code.
Now it seem the target file is not properly set.
You could add echos to the loop body:
To see how the variables are set

  sourceFile="$(realpath "$F")"
  echo ${sourceFile}
  targetFile="${targetDirectory}/${targetFilePrefix}_$(removeExtension "$(basename ${F})").dim"
  echo ${targetFile}
  echo "${gptPath} ${graphXmlPath} -e -p ${parameterFilePath} -t ${targetFile} ${sourceFile}"
1 Like

Hi Marco,

his problem is the parameters part. I sent to him new bash file before with echo in RUS Support chat room but I don’t know why he still uses the last one

1 Like

his bash file must be like this:

#!/bin/bash

enable next line for debugging purpose

set -x

############################################

User Configuration

############################################

adapt this path to your needs

#export PATH=~/Research/Checking_Bulk_GPT/output:$PATH
#gptPath="~/snap.bak/bin/gpt"
export PATH=~/progs/snap/bin:$PATH
gptPath="/home/shosseini/snap.bak/bin/gpt"
#gptPath=“gpt”

############################################

Command line handling

############################################

first parameter is a path to the graph xml

graphXmlPath="$1"
#graphXmlPath="/home/shosseini/Research/Checking_Bulk_GPT/outout/spk.xml"

second parameter is a path to a parameter file

#parameterFilePath="$2"

use third parameter for path to source products

sourceDirectory="$2"
#sourceDirectory="/home/shosseini/Research/Checking_Bulk_GPT"

use fourth parameter for path to target products

targetDirectory="$3"
#targetDirectory="/home/shosseini/Research/Checking_Bulk_GPT/output"

the fifth parameter is a file prefix for the target product name, typically indicating the type of processing

targetFilePrefix="$4"
#targetFilePrefix=“spk”

############################################

Helper functions

############################################
removeExtension() {
file="1" echo "(echo “file" | sed -r 's/\.[^\.]*//’)”
}

############################################

Main processing

############################################

Create the target directory

mkdir -p “${targetDirectory}”

the d option limits the elemeents to loop over to directories. Remove it, if you want to use files.

for F in (ls -1d "{sourceDirectory}"/S1*.SAFE); do
sourceFile="$(realpath “F")" targetFile="{targetDirectory}/{targetFilePrefix}_(removeExtension “(basename {F})”).dim”

echo “Executing :” “{gptPath} {graphXmlPath} -e -t {targetFile} {sourceFile}”
#echo “===============”
#{gptPath} {graphXmlPath} -e -p {parameterFilePath} -t {targetFile} {sourceFile} {gptPath} {graphXmlPath} -e -t {targetFile} ${sourceFile}
done

1 Like

Hi Samira, I tried the last one you sent, but it has problem, also as I edit up the file, it is not necessary to unzip the files because the code could read the zip, I’ll give this try, of @marpet

Hi Falah, the one that you use is not last version.
in the last version there is echo to show the path and I removed the parameters part…

Yes you’re totally right, but I meant that I tried the last one you sent with echo correction, it gave error, but might be the capital letter ZIP, was used, your comment is important :wink:, so now the one I used is available here, anything else to edit or add up,

processDataset.bash (2.0 KB)

1 Like

why you have this part in your bash file: -p ${parameterFilePath}

I added up the echo, as the last version here,

but still gives error,

in this line:
{gptPath} {graphXmlPath} -e -p {parameterFilePath} -t {targetFile} ${sourceFile}

remove -p ${parameterFilePath}

that’s why i tell you it is not last version

I just now added it up according to @marpet suggestion,

OK you must remove -p {parameterFilePath} because in your bash (upper parts) it is uncommented. you didn't introduce parametes file to it. then remove this part(-p {parameterFilePath} ) in your bash file.

the whole statement should be removed, or only the -p

only -p ${parameterFilePath}