Skip to content
Snippets Groups Projects
ich.sh 827 B
#!/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; })

# 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}")

# Run the Python script with the determined options
${ich_py} --correlationFile "${correlationFile}" --cal_ht "${cal_ht}" "${options[@]}"