Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions convert_to_grayscale/run_grayscale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gdal_wrapper/environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: python
name: notebook
channels:
- conda-forge
- defaults
Expand Down
37 changes: 23 additions & 14 deletions gdal_wrapper/run_gdal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,32 @@ 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/*)

# Read the positional argument as defined in the algorithm registration here
output_filename=$1
reduction_size=$2
# Parse named arguments as defined in the CWL file
while [[ $# -gt 0 ]]; do
case $1 in
--input_file)
input_filename="$2"
shift 2
;;
--output_file)
output_filename="$2"
shift 2
;;
--outsize)
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'
# 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}