From fff39c0755b855eead6656b05100633ccee0836d Mon Sep 17 00:00:00 2001 From: Soren Rasmussen Date: Thu, 10 Oct 2024 14:33:02 -0600 Subject: [PATCH] Add help message and ability to turn on verbose wget output. Wget output devaults to -nv so that the Github Actions output won't be filled with the wget download status. This will make debugging failed testcases easier --- contrib/get_aerosol_climo.sh | 32 +++++++++++++++++++++++++++++++- contrib/get_all_static_data.sh | 32 +++++++++++++++++++++++++++++++- contrib/get_mg_inccn_data.sh | 32 +++++++++++++++++++++++++++++++- contrib/get_thompson_tables.sh | 33 ++++++++++++++++++++++++++++++++- 4 files changed, 125 insertions(+), 4 deletions(-) diff --git a/contrib/get_aerosol_climo.sh b/contrib/get_aerosol_climo.sh index 695d1c7a..7024aab5 100755 --- a/contrib/get_aerosol_climo.sh +++ b/contrib/get_aerosol_climo.sh @@ -1,5 +1,35 @@ #!/bin/bash +# Function to display help message +print_help() { + echo "get_aerosol_climo.sh: contrib/get_aerosol_climo.sh [-v,--verbose]" + echo " Script for downloading/extracting the GOCART climatological aerosol data." + echo "" + echo "Options:" + echo " -v, --verbose Turn on wget verbose output." + echo " --help Show this help message and exit." +} + +verbose="-nv" +# Parse command-line arguments +while [[ "$#" -gt 0 ]]; do + case $1 in + --help) + print_help + exit 0 + ;; + -v|--verbose) + verbose="-v" + ;; + *) + echo "Unknown option: $1" + print_help + exit 1 + ;; + esac + shift +done + #set -ex # Directory where this script is located @@ -20,7 +50,7 @@ data_files=("FV3_aeroclim1" "FV3_aeroclim2" "FV3_aeroclim3" "FV3_aeroclim_optics cd $BASEDIR/scm/data/physics_input_data/ for file in "${data_files[@]}"; do echo "Retrieving $file.tar.gz" - wget https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/${file}.tar.gz + wget ${verbose} https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/${file}.tar.gz tar -xvf ${file}.tar.gz rm -f ${file}.tar.gz done diff --git a/contrib/get_all_static_data.sh b/contrib/get_all_static_data.sh index 99c0cd4d..582f6bd6 100755 --- a/contrib/get_all_static_data.sh +++ b/contrib/get_all_static_data.sh @@ -1,5 +1,35 @@ #!/bin/bash +# Function to display help message +print_help() { + echo "get_all_static_data.sh: contrib/get_all_static_data.sh [-v,--verbose]" + echo " Script for downloading/extracting the processed SCM case data." + echo "" + echo "Options:" + echo " -v, --verbose Turn on wget verbose output." + echo " --help Show this help message and exit." +} + +verbose="-nv" +# Parse command-line arguments +while [[ "$#" -gt 0 ]]; do + case $1 in + --help) + print_help + exit 0 + ;; + -v|--verbose) + verbose="-v" + ;; + *) + echo "Unknown option: $1" + print_help + exit 1 + ;; + esac + shift +done + #set -ex # Directory where this script is located @@ -21,7 +51,7 @@ for file in "${data_files[@]}"; do mkdir -p $BASEDIR/scm/data/$file cd $BASEDIR/scm/data/$file echo "Retrieving $file" - wget https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/${file}.tar.gz + wget ${verbose} https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/${file}.tar.gz tar -xf ${file}.tar.gz rm -f ${file}.tar.gz done diff --git a/contrib/get_mg_inccn_data.sh b/contrib/get_mg_inccn_data.sh index e98c277a..1909a6b7 100755 --- a/contrib/get_mg_inccn_data.sh +++ b/contrib/get_mg_inccn_data.sh @@ -1,5 +1,35 @@ #!/bin/bash +# Function to display help message +print_help() { + echo "get_mg_inccn_data.sh: contrib/get_mg_inccn_data.sh [-v,--verbose]" + echo " Script for downloading/extracting the Morrison-Gettelman data." + echo "" + echo "Options:" + echo " -v, --verbose Turn on wget verbose output." + echo " --help Show this help message and exit." +} + +verbose="-nv" +# Parse command-line arguments +while [[ "$#" -gt 0 ]]; do + case $1 in + --help) + print_help + exit 0 + ;; + -v|--verbose) + verbose="-v" + ;; + *) + echo "Unknown option: $1" + print_help + exit 1 + ;; + esac + shift +done + set -ex # Directory where this script is located @@ -16,7 +46,7 @@ BASEDIR=$MYDIR/.. # Change to directory containing the physics input data, download and extract archive cd $BASEDIR/scm/data/physics_input_data/ -wget https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/MG_INCCN_data.tar.gz +wget ${verbose} https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/MG_INCCN_data.tar.gz tar -xvf MG_INCCN_data.tar.gz rm -f MG_INCCN_data.tar.gz cd $BASEDIR/ diff --git a/contrib/get_thompson_tables.sh b/contrib/get_thompson_tables.sh index 86a9487b..24e7c92a 100755 --- a/contrib/get_thompson_tables.sh +++ b/contrib/get_thompson_tables.sh @@ -1,5 +1,35 @@ #!/bin/bash +# Function to display help message +print_help() { + echo "get_thompson_tables.sh: contrib/get_thompson_tables.sh [-v,--verbose]" + echo " Script for downloading/extracting the Thompson lookup tables." + echo "" + echo "Options:" + echo " -v, --verbose Turn on wget verbose output." + echo " --help Show this help message and exit." +} + +verbose="-nv" +# Parse command-line arguments +while [[ "$#" -gt 0 ]]; do + case $1 in + --help) + print_help + exit 0 + ;; + -v|--verbose) + verbose="-v" + ;; + *) + echo "Unknown option: $1" + print_help + exit 1 + ;; + esac + shift +done + set -ex if [[ $(uname -s) == Darwin ]]; then @@ -15,7 +45,8 @@ BASEDIR=$MYDIR/.. # Change to directory containing the physics input data, download and extract archive cd $BASEDIR/scm/data/physics_input_data/ -wget https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/thompson_tables.tar.gz + +wget ${verbose} https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/thompson_tables.tar.gz tar -xvf thompson_tables.tar.gz rm -f thompson_tables.tar.gz cd $BASEDIR/