Bulk processing with GPT - command not found

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}

It’ll be in this form, right?

echo “{gptPath} {graphXmlPath} -e -t {targetFile} {sourceFile}”

it must be like this: {gptPath} {graphXmlPath} -e -t {targetFile} {sourceFile}

with out echo

in the for loop must be wrriten:

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}

sourceFile="$(realpath “F")" echo {sourceFile}
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}


Is this one right?

yes.I think it is right…