Newer
Older
#!/usr/bin/env bash
set -xuo pipefail
basedir=$(dirname "$(readlink -f "$0")")
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; })
# Add options based on provided arguments
[[ "${1:-}" != "-" ]] && options+=("--lower_limit" "${1}")
[[ "${2:-}" != "-" ]] && options+=("--upper_limit" "${2}")
[[ "${3:-}" != "-" ]] && options+=("--window" "${3}")
[[ "${4:-}" != "-" ]] && options+=("--validation" "${4}")
[[ "${5:-}" != "-" ]] && options+=("--algorithm" "${5}")
[[ "${6:-}" != "-" ]] && options+=("--overlap" "${6}")
[[ "${7:-}" != "-" ]] && options+=("--minshots" "${8}")
# Run the Python script with the determined options
${ich_py} --correlationFile "${correlationFile}" --cal_ht "${cal_ht}" "${options[@]}"