From c7ae975b2567dcaa944cb07701dd451136e490d1 Mon Sep 17 00:00:00 2001 From: grallewellyn Date: Thu, 18 Jun 2026 15:10:19 -0700 Subject: [PATCH 1/3] renamed default conda env and no longer using positional args --- convert_to_grayscale/run_grayscale.sh | 16 ++++++++++++++-- gdal_wrapper/environment.yml | 2 +- gdal_wrapper/run_gdal.sh | 20 +++++++++++++++++--- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/convert_to_grayscale/run_grayscale.sh b/convert_to_grayscale/run_grayscale.sh index 1fac55a..6102902 100755 --- a/convert_to_grayscale/run_grayscale.sh +++ b/convert_to_grayscale/run_grayscale.sh @@ -32,8 +32,20 @@ INPUT_DIR=input # Since we only have one input we can list it as below INPUT_IMAGE_PATH=$(ls input/*) -# Read the positional argument as defined in the algorithm registration here -OUTPUT_IMAGE_NAME=$1 +# Parse named arguments instead of positional arguments +while [[ $# -gt 0 ]]; do + case $1 in + --output_image_name) + OUTPUT_IMAGE_NAME="$2" + shift 2 + ;; + *) + echo "Unknown argument: $1" + exit 1 + ;; + esac +done + OUTPUT_IMAGE_PATH="output/${OUTPUT_IMAGE_NAME}" # Call the script using the absolute path diff --git a/gdal_wrapper/environment.yml b/gdal_wrapper/environment.yml index eaf4034..d057e47 100644 --- a/gdal_wrapper/environment.yml +++ b/gdal_wrapper/environment.yml @@ -1,4 +1,4 @@ -name: python +name: notebook channels: - conda-forge - defaults diff --git a/gdal_wrapper/run_gdal.sh b/gdal_wrapper/run_gdal.sh index a5d9585..eb1c308 100755 --- a/gdal_wrapper/run_gdal.sh +++ b/gdal_wrapper/run_gdal.sh @@ -25,9 +25,23 @@ INPUT_DIR=input # Since we only have one input we can list it as below input_filename=$(ls -d input/*) -# Read the positional argument as defined in the algorithm registration here -output_filename=$1 -reduction_size=$2 +# Parse named arguments instead of positional arguments +while [[ $# -gt 0 ]]; do + case $1 in + --output_filename) + output_filename="$2" + shift 2 + ;; + --reduction_size) + reduction_size="$2" + shift 2 + ;; + *) + echo "Unknown argument: $1" + exit 1 + ;; + esac +done # Call the script using the absolute paths # Use the updated environment when calling 'conda run' From f54470b9003f3accf61b33fd4f7ab564b835156f Mon Sep 17 00:00:00 2001 From: grallewellyn Date: Thu, 18 Jun 2026 15:45:19 -0700 Subject: [PATCH 2/3] removed input assumption and all named args --- gdal_wrapper/run_gdal.sh | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/gdal_wrapper/run_gdal.sh b/gdal_wrapper/run_gdal.sh index eb1c308..198708c 100755 --- a/gdal_wrapper/run_gdal.sh +++ b/gdal_wrapper/run_gdal.sh @@ -16,23 +16,18 @@ basedir=$(dirname "$(readlink -f "$0")") mkdir -p output - -# DPS downloads all files provided as inputs to -# this directory called input. -# In our example the image will be downloaded here. -INPUT_DIR=input - -# Since we only have one input we can list it as below -input_filename=$(ls -d input/*) - -# Parse named arguments instead of positional arguments +# Parse named arguments as defined in the CWL file while [[ $# -gt 0 ]]; do case $1 in - --output_filename) + --input_file) + input_filename="$2" + shift 2 + ;; + --output_file) output_filename="$2" shift 2 ;; - --reduction_size) + --outsize) reduction_size="$2" shift 2 ;; From 19047ac96468eaab228492eb68d359c1d508979d Mon Sep 17 00:00:00 2001 From: grallewellyn Date: Thu, 18 Jun 2026 16:48:26 -0700 Subject: [PATCH 3/3] updated conda env name in run command --- gdal_wrapper/run_gdal.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdal_wrapper/run_gdal.sh b/gdal_wrapper/run_gdal.sh index 198708c..21a51fd 100755 --- a/gdal_wrapper/run_gdal.sh +++ b/gdal_wrapper/run_gdal.sh @@ -42,6 +42,6 @@ done # Use the updated environment when calling 'conda run' # This lets us run the same way in a Terminal as in DPS # Any output written to the stdout and stderr streams will be automatically captured and placed in the output dir -# echo conda run --live-stream --name vanilla python ${basedir}/gdal_wrapper.py --input_file ${input_filename} --output_file output/${output_filename} --outsize ${reduction_size} +# echo conda run --live-stream --name notebook python ${basedir}/gdal_wrapper.py --input_file ${input_filename} --output_file output/${output_filename} --outsize ${reduction_size} -conda run --live-stream --name python python ${basedir}/gdal_wrapper.py --input_file ${input_filename} --output_file output/${output_filename} --outsize ${reduction_size} +conda run --live-stream --name notebook python ${basedir}/gdal_wrapper.py --input_file ${input_filename} --output_file output/${output_filename} --outsize ${reduction_size}