From 9eb1f5aebeb7ce215a658ba12ca5255a27af50d1 Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Tue, 1 Mar 2022 14:45:10 -0800 Subject: [PATCH 01/13] Add algo config, imgspec run file and supporting script for registering an imgspec algorithm. --- .imgspec/algorithm_config.yaml | 25 +++++++++++++ .imgspec/get_paths_from_granules.py | 56 +++++++++++++++++++++++++++++ .imgspec/imgspec_run.sh | 50 ++++++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 .imgspec/algorithm_config.yaml create mode 100644 .imgspec/get_paths_from_granules.py create mode 100644 .imgspec/imgspec_run.sh diff --git a/.imgspec/algorithm_config.yaml b/.imgspec/algorithm_config.yaml new file mode 100644 index 0000000..054eb58 --- /dev/null +++ b/.imgspec/algorithm_config.yaml @@ -0,0 +1,25 @@ +# DO NOT DELETE +# THIS CONFIG IS AUTO-GENERATED BY ADE UI +algo_name: SpectralUnmixing +version: imgspec +environment: ubuntu +repository_url: https://github.com/emit-sds/SpectralUnmixing.git +docker_url: registry.imgspec.org/root/ade_base_images/spectral-unmixing:latest + +# fill out these fields +# explain what this algorithm does +description: A general, fast, and flexible package for spectral unmixing. +# path to the wrapper script for running the algorithm +run_command: SpectralUnmixing/.imgspec/imgspec_run.sh +# set a storage value in GB or MB or KB, e.g. "100GB", "20MB", "10KB" +disk_space: 80GB +inputs: +# remove below this line if no inputs +# rename and set algorithm input names accordingly + - name: reflectance_granule + type: file + - name: endmember_library + type: positional + - name: endmember_column + type: positional + default: "class" diff --git a/.imgspec/get_paths_from_granules.py b/.imgspec/get_paths_from_granules.py new file mode 100644 index 0000000..b712731 --- /dev/null +++ b/.imgspec/get_paths_from_granules.py @@ -0,0 +1,56 @@ +#! /usr/bin/python + +import argparse +import glob +import os +import sys +import tarfile + + +def parse_args(): + parser = argparse.ArgumentParser() + products = ["rfl"] + formats = ["envi"] + parser.add_argument("-p", "--product", + help=("Choose one of the following product types: " + ", ".join(products))) + parser.add_argument("-f", "--format", + help=("Choose one of the following formats: " + ", ".join(formats))) + args = parser.parse_args() + + if args.product: + if args.product not in products: + print("ERROR: Product \"%s\" is not a valid product choice." % args.product) + sys.exit(1) + if args.format: + if args.format not in formats: + print("ERROR: Format \"%s\" is not a valid format choice." % args.format) + sys.exit(1) + return args + + +def main(): + args = parse_args() + + # Unzip and untar granules + input_dir = "input" + granule_paths = glob.glob(os.path.join(input_dir, "*.tar.gz")) + for g in granule_paths: + tar_file = tarfile.open(g) + tar_file.extractall(input_dir) + tar_file.close() + os.remove(g) + + # Get paths based on product type file matching + paths = [] + if args.product == "rfl": + # AVIRIS SDS uses *rfl*img and *corr*img for distributed files + paths = glob.glob(os.path.join(input_dir, "*", "*rfl*img")) + paths += glob.glob(os.path.join(input_dir, "*", "*corr*img")) + # ISOFIT uses *rfl for processed reflectance files + paths += glob.glob(os.path.join(input_dir, "*", "*rfl")) + + print(",".join(paths)) + + +if __name__ == "__main__": + main() diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh new file mode 100644 index 0000000..3457299 --- /dev/null +++ b/.imgspec/imgspec_run.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Description: +# +# The top-level run script to execute unmix.jl on ImgSPEC. This script accepts the inputs described in the +# algorithm_config.yaml file and pre-processes them as needed to pass into SpectralUnmixing/unmix.jl. This script +# is currently compatible with AVIRIS Classic, AVIRIS-NG, and PRISMA data. +# +# Inputs: +# +# $1: URL of endmember library +# $2: Column name from endmember library that describes the library classes (default is "class") +# +# In addition to the positional arguments, this script expects a downloaded reflectance granule to be present in a +# folder called "input". + + +imgspec_dir=$( cd "$(dirname "$0")" ; pwd -P ) +specun_dir=$(dirname ${imgspec_dir}) + +input="input" +mkdir -p output + +# Spectral Unmixing paths +unmix_exe="$specun_dir/unmix.jl" +endmember_library_path="$input/endmember_library.csv" + +# Get reflectance path from input granule +echo "Looking for input granule gzip and extracting to get reflectance path..." +rfl_path=$(python ${imgspec_dir}/get_paths_from_granules.py -p rfl) +echo "Found input reflectance file: $rfl_path" + +# Process positional args to get EcoSIS CSV files +echo "Getting endmember library..." +curl --retry 10 --output $endmember_library_path $1 + +# Get output base from reflectance path +rfl_name=$(basename $rfl_path) +output_base="output" +if [[ rfl_name == f* ]]; then + output_base=$(echo rfl_name | cut -c1-16) +elif [[ rfl_name == ang* ]]; then + output_base=$(echo rfl_name | cut -c1-18) +elif [[ rfl_name == PRS* ]]; then + output_base=$(echo rfl_name | cut -c1-38) +fi + +cmd="julia $unmix_exe $rfl_path $endmember_library_path $2 $output_base" +echo "Executing command: $cmd" +$cmd From a064f99e51de60d91a5056f2ae34436f34e5ab62 Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Tue, 1 Mar 2022 15:49:09 -0800 Subject: [PATCH 02/13] Install Julia deps before running command. --- .imgspec/imgspec_run.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh index 3457299..fd202ee 100644 --- a/.imgspec/imgspec_run.sh +++ b/.imgspec/imgspec_run.sh @@ -14,7 +14,6 @@ # In addition to the positional arguments, this script expects a downloaded reflectance granule to be present in a # folder called "input". - imgspec_dir=$( cd "$(dirname "$0")" ; pwd -P ) specun_dir=$(dirname ${imgspec_dir}) @@ -45,6 +44,9 @@ elif [[ rfl_name == PRS* ]]; then output_base=$(echo rfl_name | cut -c1-38) fi +echo "Setting up Julia dependencies..." +julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' + cmd="julia $unmix_exe $rfl_path $endmember_library_path $2 $output_base" echo "Executing command: $cmd" $cmd From c16d0081a3ed8ed4c129d0b5345853249b4dfc66 Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Tue, 1 Mar 2022 15:51:08 -0800 Subject: [PATCH 03/13] Make imgspec_run.sh executable. --- .imgspec/imgspec_run.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .imgspec/imgspec_run.sh diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh old mode 100644 new mode 100755 From 267b235d5728adaa416c3ad5686a86764ee9e18b Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Tue, 1 Mar 2022 16:10:58 -0800 Subject: [PATCH 04/13] Fix output base path - this version works when running in ADE. --- .imgspec/imgspec_run.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh index fd202ee..54984e9 100755 --- a/.imgspec/imgspec_run.sh +++ b/.imgspec/imgspec_run.sh @@ -14,12 +14,20 @@ # In addition to the positional arguments, this script expects a downloaded reflectance granule to be present in a # folder called "input". +# Define some useful directories imgspec_dir=$( cd "$(dirname "$0")" ; pwd -P ) specun_dir=$(dirname ${imgspec_dir}) - +cur_dir=$(pwd -P) input="input" mkdir -p output +# Set up Julia dependencies and project +echo "Setting up Julia dependencies..." +cd $specun_dir +julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' +export JULIA_PROJECT=$specun_dir +cd $cur_dir + # Spectral Unmixing paths unmix_exe="$specun_dir/unmix.jl" endmember_library_path="$input/endmember_library.csv" @@ -36,17 +44,17 @@ curl --retry 10 --output $endmember_library_path $1 # Get output base from reflectance path rfl_name=$(basename $rfl_path) output_base="output" -if [[ rfl_name == f* ]]; then - output_base=$(echo rfl_name | cut -c1-16) -elif [[ rfl_name == ang* ]]; then - output_base=$(echo rfl_name | cut -c1-18) -elif [[ rfl_name == PRS* ]]; then - output_base=$(echo rfl_name | cut -c1-38) +if [[ $rfl_name == f* ]]; then + output_base=$(echo $rfl_name | cut -c1-16) +elif [[ $rfl_name == ang* ]]; then + output_base=$(echo $rfl_name | cut -c1-18) +elif [[ $rfl_name == PRS* ]]; then + output_base=$(echo $rfl_name | cut -c1-38) fi +output_base_path="output/$output_base" +echo "Output base path: $output_base_path" -echo "Setting up Julia dependencies..." -julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' - -cmd="julia $unmix_exe $rfl_path $endmember_library_path $2 $output_base" +# Build command and execute +cmd="julia $unmix_exe $rfl_path $endmember_library_path $2 $output_base_path" echo "Executing command: $cmd" $cmd From 34787e67623b7d1b27c882a40247beeef208c8a0 Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Wed, 2 Mar 2022 15:16:33 -0800 Subject: [PATCH 05/13] Add JULIA_DEPOT_PATH and some logging to debug. --- .imgspec/imgspec_run.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh index 54984e9..b0e4792 100755 --- a/.imgspec/imgspec_run.sh +++ b/.imgspec/imgspec_run.sh @@ -24,6 +24,9 @@ mkdir -p output # Set up Julia dependencies and project echo "Setting up Julia dependencies..." cd $specun_dir +echo "JULIA_DEPOT_PATH before: $JULIA_DEPOT_PATH" +export JULIA_DEPOT_PATH=/app/.julia +echo "JULIA_DEPOT_PATH after: $JULIA_DEPOT_PATH" julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' export JULIA_PROJECT=$specun_dir cd $cur_dir From 8ea8f3a0dada4e6af941a918264de6db1420f20c Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Thu, 3 Mar 2022 10:03:10 -0800 Subject: [PATCH 06/13] Use vanilla base image for Docker and execute all Julia installation steps in run script. --- .imgspec/algorithm_config.yaml | 2 +- .imgspec/imgspec_run.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.imgspec/algorithm_config.yaml b/.imgspec/algorithm_config.yaml index 054eb58..e695e45 100644 --- a/.imgspec/algorithm_config.yaml +++ b/.imgspec/algorithm_config.yaml @@ -4,7 +4,7 @@ algo_name: SpectralUnmixing version: imgspec environment: ubuntu repository_url: https://github.com/emit-sds/SpectralUnmixing.git -docker_url: registry.imgspec.org/root/ade_base_images/spectral-unmixing:latest +docker_url: registry.imgspec.org/root/ade_base_images/vanilla:latest # fill out these fields # explain what this algorithm does diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh index b0e4792..cf35111 100755 --- a/.imgspec/imgspec_run.sh +++ b/.imgspec/imgspec_run.sh @@ -23,12 +23,12 @@ mkdir -p output # Set up Julia dependencies and project echo "Setting up Julia dependencies..." +conda install -c conda-forge julia=1.7 cd $specun_dir -echo "JULIA_DEPOT_PATH before: $JULIA_DEPOT_PATH" -export JULIA_DEPOT_PATH=/app/.julia -echo "JULIA_DEPOT_PATH after: $JULIA_DEPOT_PATH" julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' export JULIA_PROJECT=$specun_dir + +# Return to original directory for remainder of script cd $cur_dir # Spectral Unmixing paths From 400496fc77e16e4655697551870548572b0d78fe Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Fri, 4 Mar 2022 09:57:25 -0800 Subject: [PATCH 07/13] Add debugging --- .imgspec/algorithm_config.yaml | 2 +- .imgspec/imgspec_run.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.imgspec/algorithm_config.yaml b/.imgspec/algorithm_config.yaml index e695e45..2c48dc1 100644 --- a/.imgspec/algorithm_config.yaml +++ b/.imgspec/algorithm_config.yaml @@ -4,7 +4,7 @@ algo_name: SpectralUnmixing version: imgspec environment: ubuntu repository_url: https://github.com/emit-sds/SpectralUnmixing.git -docker_url: registry.imgspec.org/root/ade_base_images/vanilla:latest +docker_url: registry.imgspec.org/root/ade_base_images/plant:latest # fill out these fields # explain what this algorithm does diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh index cf35111..0762bb4 100755 --- a/.imgspec/imgspec_run.sh +++ b/.imgspec/imgspec_run.sh @@ -23,6 +23,7 @@ mkdir -p output # Set up Julia dependencies and project echo "Setting up Julia dependencies..." +echo `id` conda install -c conda-forge julia=1.7 cd $specun_dir julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' From 41e8571fb66f1eccb9efc41039d884c92a414ada Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Tue, 22 Mar 2022 10:12:28 -0700 Subject: [PATCH 08/13] Add install.sh script to handle install of Julia and dependencies. --- .imgspec/algorithm_config.yaml | 4 +++- .imgspec/imgspec_run.sh | 11 +---------- .imgspec/install.sh | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 .imgspec/install.sh diff --git a/.imgspec/algorithm_config.yaml b/.imgspec/algorithm_config.yaml index 2c48dc1..cb0aade 100644 --- a/.imgspec/algorithm_config.yaml +++ b/.imgspec/algorithm_config.yaml @@ -4,11 +4,13 @@ algo_name: SpectralUnmixing version: imgspec environment: ubuntu repository_url: https://github.com/emit-sds/SpectralUnmixing.git -docker_url: registry.imgspec.org/root/ade_base_images/plant:latest +docker_url: registry.imgspec.org/root/ade_base_images/vanilla:latest # fill out these fields # explain what this algorithm does description: A general, fast, and flexible package for spectral unmixing. +# path to the build script for installing and building the algorithm in the docker image +build_command: SpectralUnmixing/.imgspec/install.sh # path to the wrapper script for running the algorithm run_command: SpectralUnmixing/.imgspec/imgspec_run.sh # set a storage value in GB or MB or KB, e.g. "100GB", "20MB", "10KB" diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh index 0762bb4..bf1482e 100755 --- a/.imgspec/imgspec_run.sh +++ b/.imgspec/imgspec_run.sh @@ -17,21 +17,12 @@ # Define some useful directories imgspec_dir=$( cd "$(dirname "$0")" ; pwd -P ) specun_dir=$(dirname ${imgspec_dir}) -cur_dir=$(pwd -P) input="input" mkdir -p output -# Set up Julia dependencies and project -echo "Setting up Julia dependencies..." -echo `id` -conda install -c conda-forge julia=1.7 -cd $specun_dir -julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' +# Export JULIA_PROJECT again in case it doesn't carry over from install.sh export JULIA_PROJECT=$specun_dir -# Return to original directory for remainder of script -cd $cur_dir - # Spectral Unmixing paths unmix_exe="$specun_dir/unmix.jl" endmember_library_path="$input/endmember_library.csv" diff --git a/.imgspec/install.sh b/.imgspec/install.sh new file mode 100644 index 0000000..20b98fa --- /dev/null +++ b/.imgspec/install.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Install script to 1) install Julia via conda, and 2) install the Julia dependencies for this project + +set -x + +# Define some useful directories +imgspec_dir=$( cd "$(dirname "$0")" ; pwd -P ) +specun_dir=$(dirname ${imgspec_dir}) +cur_dir=$(pwd -P) + +# Install Julia and then install Julia dependencies +conda install -c conda-forge julia=1.7 +cd $specun_dir +julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' +export JULIA_PROJECT=$specun_dir + +# Return to original directory +cd $cur_dir From c1e029fe651f89b4df13e53e9e840c6dd6cb469b Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Tue, 22 Mar 2022 10:13:30 -0700 Subject: [PATCH 09/13] Make install script executable. --- .imgspec/install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .imgspec/install.sh diff --git a/.imgspec/install.sh b/.imgspec/install.sh old mode 100644 new mode 100755 From e5eada0520d0c29fa042aaef6cd9ac05c14a079a Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Tue, 22 Mar 2022 15:05:31 -0700 Subject: [PATCH 10/13] Add -y flag to conda install --- .imgspec/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.imgspec/install.sh b/.imgspec/install.sh index 20b98fa..28921bf 100755 --- a/.imgspec/install.sh +++ b/.imgspec/install.sh @@ -10,7 +10,7 @@ specun_dir=$(dirname ${imgspec_dir}) cur_dir=$(pwd -P) # Install Julia and then install Julia dependencies -conda install -c conda-forge julia=1.7 +conda install -y -c conda-forge julia=1.7 cd $specun_dir julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' export JULIA_PROJECT=$specun_dir From 821ab6fdfe24afc6c3e8a442ff2fd22a169ce329 Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Wed, 23 Mar 2022 09:21:32 -0700 Subject: [PATCH 11/13] Create conda env in install script and source it in run script. Use vanilla 1.0 docker. --- .imgspec/algorithm_config.yaml | 2 +- .imgspec/imgspec_run.sh | 3 +++ .imgspec/install.sh | 10 ++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.imgspec/algorithm_config.yaml b/.imgspec/algorithm_config.yaml index cb0aade..51bc9e7 100644 --- a/.imgspec/algorithm_config.yaml +++ b/.imgspec/algorithm_config.yaml @@ -4,7 +4,7 @@ algo_name: SpectralUnmixing version: imgspec environment: ubuntu repository_url: https://github.com/emit-sds/SpectralUnmixing.git -docker_url: registry.imgspec.org/root/ade_base_images/vanilla:latest +docker_url: registry.imgspec.org/root/ade_base_images/vanilla:1.0 # fill out these fields # explain what this algorithm does diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh index bf1482e..1230243 100755 --- a/.imgspec/imgspec_run.sh +++ b/.imgspec/imgspec_run.sh @@ -20,6 +20,9 @@ specun_dir=$(dirname ${imgspec_dir}) input="input" mkdir -p output +# Activate conda environment +source activate spectral-unmixing + # Export JULIA_PROJECT again in case it doesn't carry over from install.sh export JULIA_PROJECT=$specun_dir diff --git a/.imgspec/install.sh b/.imgspec/install.sh index 28921bf..9da1a1c 100755 --- a/.imgspec/install.sh +++ b/.imgspec/install.sh @@ -7,13 +7,11 @@ set -x # Define some useful directories imgspec_dir=$( cd "$(dirname "$0")" ; pwd -P ) specun_dir=$(dirname ${imgspec_dir}) -cur_dir=$(pwd -P) # Install Julia and then install Julia dependencies -conda install -y -c conda-forge julia=1.7 -cd $specun_dir +conda create -n spectral-unmixing -y -c conda-forge julia=1.7 python=3.9 +source activate spectral-unmixing +pushd $specun_dir julia -e 'using Pkg; Pkg.activate("."); Pkg.add(path="https://github.com/kmsquire/ArgParse2.jl"); Pkg.instantiate()' export JULIA_PROJECT=$specun_dir - -# Return to original directory -cd $cur_dir +popd From 5b2c4e3fb1f0ac7b906693284ba7f19980dcecd5 Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Fri, 1 Apr 2022 10:37:33 -0700 Subject: [PATCH 12/13] Add support for more args: n_cores, refl_nodata, refl_scale, and normalization --- .imgspec/algorithm_config.yaml | 14 ++++++++++++++ .imgspec/imgspec_run.sh | 27 ++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/.imgspec/algorithm_config.yaml b/.imgspec/algorithm_config.yaml index 51bc9e7..51299c4 100644 --- a/.imgspec/algorithm_config.yaml +++ b/.imgspec/algorithm_config.yaml @@ -25,3 +25,17 @@ inputs: - name: endmember_column type: positional default: "class" + - name: n_cores + type: positional + default: "1" + - name: refl_nodata + type: positional + default: "None" + - name: refl_scale + type: positional + default: "None" + - name: normalization + type: positional + default: "None" + + diff --git a/.imgspec/imgspec_run.sh b/.imgspec/imgspec_run.sh index 1230243..61a9193 100755 --- a/.imgspec/imgspec_run.sh +++ b/.imgspec/imgspec_run.sh @@ -10,6 +10,11 @@ # # $1: URL of endmember library # $2: Column name from endmember library that describes the library classes (default is "class") +# $3: Number of cores to use (default is "1") +# $4: Nodata value expected in input reflectance data (default is "None" - will use the repo's default) +# $5: Scale image data (divide it by) this amount (default is "None" - will use the repo's default) +# $6: Flag to indicate the scaling type. Options = [none, brightness, specific wavelength] (default is "None" - will +# use the repo's default) # # In addition to the positional arguments, this script expects a downloaded reflectance granule to be present in a # folder called "input". @@ -53,6 +58,26 @@ output_base_path="output/$output_base" echo "Output base path: $output_base_path" # Build command and execute -cmd="julia $unmix_exe $rfl_path $endmember_library_path $2 $output_base_path" +cmd="julia" + +# Add number of cores +if [[ $3 != "1" ]]; then + cmd="$cmd -p $3" +fi + +# Add the required args (and assume mode is sma for now) +cmd="$cmd $unmix_exe $rfl_path $endmember_library_path $2 $output_base_path --mode=sma" + +# Add the optional args +if [[ $4 != "None" ]]; then + cmd="$cmd --refl_nodata=$4" +fi +if [[ $5 != "None" ]]; then + cmd="$cmd --refl_scale=$5" +fi +if [[ $6 != "None" ]]; then + cmd="$cmd --normalization=$6" +fi + echo "Executing command: $cmd" $cmd From 0cc248a678c84d43ea87ac92da135c52f571cb61 Mon Sep 17 00:00:00 2001 From: Winston Olson-Duvall Date: Thu, 21 Apr 2022 08:59:38 -0700 Subject: [PATCH 13/13] Use version 0.1.0 for imgspec. --- .imgspec/algorithm_config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.imgspec/algorithm_config.yaml b/.imgspec/algorithm_config.yaml index 51299c4..93c6c5a 100644 --- a/.imgspec/algorithm_config.yaml +++ b/.imgspec/algorithm_config.yaml @@ -1,7 +1,7 @@ # DO NOT DELETE # THIS CONFIG IS AUTO-GENERATED BY ADE UI algo_name: SpectralUnmixing -version: imgspec +version: 0.1.0 environment: ubuntu repository_url: https://github.com/emit-sds/SpectralUnmixing.git docker_url: registry.imgspec.org/root/ade_base_images/vanilla:1.0