Skip to content
Snippets Groups Projects
ich.sh 1.05 KiB
Newer Older
#!/usr/bin/env bash

set -xuo pipefail

basedir=$(dirname "$(readlink -f "$0")")
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed

source activate ich-env

ich_py="python ${basedir}/src/ich/InSAR_canopy_height.py"
# Ensure there is at least one file of each type
correlationFile=$(ls input/*_corr.tif 2>/dev/null || { echo "No correlation files found"; exit 1; })
cal_ht=$(ls input/*_lidar.tif 2>/dev/null || { echo "No lidar files found"; exit 1; })
# Initialize options array
options=()

# Add options based on provided arguments
[[ "${1:-}" != "-" ]] && options+=("--lower_limit" "${1}")
[[ "${2:-}" != "-" ]] && options+=("--upper_limit" "${2}")
[[ "${3:-}" != "-" ]] && options+=("--window" "${3}")
[[ "${4:-}" != "-" ]] && options+=("--validation" "${4}")
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
[[ "${5:-}" != "-" ]] && options+=("--algorithm" "${5}")
[[ "${6:-}" != "-" ]] && options+=("--overlap" "${6}")
Narayanarao Bhogapurapu's avatar
Narayanarao Bhogapurapu committed
[[ "${7:-}" != "-" ]] && options+=("--filter" "${7}")
[[ "${7:-}" != "-" ]] && options+=("--minshots" "${8}")
# Run the Python script with the determined options
${ich_py} --correlationFile "${correlationFile}" --cal_ht "${cal_ht}" "${options[@]}"