#!/bin/bash
# enable next line for debugging purpose
# set -x 

############################################
# User Configuration
############################################

# adapt this path to your needs
export PATH="$PATH:/home/saioam/snap/bin/"
gptPath="gpt"

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

# first parameter is a path to the graph xml
graphXmlPath="/home/saioam/Desktop/S1_subset.xml"


# use third parameter for path to source products
sourceDirectory="/home/saioam/Desktop/S1_Images"

# use fourth parameter for path to target products
targetDirectory="/home/saioam/Desktop/S1_Images/2016/procesed_images"

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

   
############################################
# 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}"); do
  sourceFile="$(realpath "$F")"
  targetFile=${targetDirectory}/${targetFilePrefix} #$(removeExtension "$(basename ${F})").dim"
  ${gptPath} ${graphXmlPath} -e -p ${parameterFilePath} -t ${target1} ${input1}
done
