-
Notifications
You must be signed in to change notification settings - Fork 670
non interactive ww3_from_ftp.sh #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
7d60a26
bda6629
0561b5b
95e8e80
934edd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/bin/bash | ||
| #!/bin/bash -e | ||
| # --------------------------------------------------------------------------- # | ||
| # # | ||
| # Script for downloading data from ftp # | ||
|
|
@@ -10,19 +10,47 @@ curr_dir=`pwd` | |
| # Set WW3 code version | ||
| ww3ver=v7.12.6 | ||
|
|
||
| interactive='n' | ||
| keep='n' | ||
| if [ $# -eq 1 ] ; then | ||
| if [ "$1" = "-i" ] ; then | ||
| interactive='y' | ||
| elif [ "$1" = "-k" ] ; then | ||
| keep='y' | ||
| else | ||
| echo '[ERROR] input argument not recognized' | ||
| echo ' use -i for interactive mode' | ||
| echo ' use -k to keep tar files' | ||
| exit 1 | ||
| fi | ||
| elif [ $# -gt 1 ] ; then | ||
| echo '[ERROR] only one input argument accepted' | ||
| echo ' use -i for interactive mode' | ||
| echo ' use -k to keep tar files' | ||
| exit 1 | ||
| fi | ||
|
|
||
| model_dir=$(cd $(dirname $(dirname $0)) > /dev/null && pwd -P) | ||
| echo $model_dir | ||
|
|
||
| #Get top level directory of ww3 from user: | ||
| echo -e "\n\n This script will download data from the ftp for WAVEWATCH III " | ||
| echo -e "Enter the relative path to the main/top level directory, this would " | ||
| echo -e "be '../../' if in the model/bin directory or '.' if already in the " | ||
| echo -e "top/main directory:" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're giving the path to the model directory, we should change this description or is this still the same?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| read ww3dir | ||
| if [ "$interactive" = "n" ] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is nice as it allows for previous functionality//backwards compatibility, but we're at a point where we're about to have some big changes and therefore are we willing to break this and just make this a script where you have to give it the model directory path and then you either keep things (optional, make an option) or the default is you do nothing and it doesn't keep things? |
||
| then | ||
| echo $model_dir | ||
| else | ||
| read model_dir | ||
| fi | ||
|
|
||
| #Move to top level directory of ww3: | ||
| cd $ww3dir | ||
| cd $model_dir | ||
|
|
||
| #Download from ftp and uptar: | ||
| echo -e "Downloading and untaring file from ftp:" | ||
| wget https://ftp.emc.ncep.noaa.gov/static_files/public/WW3/ww3_from_ftp.${ww3ver}.tar.gz | ||
| wget --no-check-certificate https://ftp.emc.ncep.noaa.gov/static_files/public/WW3/ww3_from_ftp.${ww3ver}.tar.gz | ||
| tar -xvzf ww3_from_ftp.${ww3ver}.tar.gz | ||
|
|
||
| #Move regtest info from data_regtests to regtests: | ||
|
|
@@ -60,8 +88,13 @@ cp -r data_regtests/ww3_ufs1.2/input/* regtests/ww3_ufs1.2/input/ | |
| cp -r data_regtests/ww3_ufs1.3/input/*nc regtests/ww3_ufs1.3/input/ | ||
| #Do you want to clean up (aka delete tar file, delete the data_regtests directory) | ||
| echo -e "\n\n Do you want to delete the tar file ww3_from_ftp.${ww3ver}.tar.gz [y|n]: " | ||
| read wnew | ||
| if [ "${wnew}" = "Y" ] || [ "${wnew}" = "y" ] | ||
| if [ "$interactive" = "n" ] | ||
| then | ||
| echo $keep | ||
| else | ||
| read keep | ||
| fi | ||
| if [ "${keep}" = "Y" ] || [ "${keep}" = "y" ] | ||
| then | ||
| echo -e '\n Deleting tar file ww3_from_ftp.${ww3ver}.tar.gz' | ||
| rm ww3_from_ftp.${ww3ver}.tar.gz | ||
|
|
@@ -71,8 +104,13 @@ fi | |
|
|
||
| echo -e "\n\n Files were copied from the data_regtests to the regtests folder." | ||
| echo -e "Do you want to delete the data_regtests folder? [y|n]: " | ||
| read wnew2 | ||
| if [ "${wnew2}" = "Y" ] || [ "${wnew2}" = "y" ] | ||
| if [ "$interactive" = "n" ] | ||
| then | ||
| echo $keep | ||
| else | ||
| read keep | ||
| fi | ||
| if [ "${keep}" = "Y" ] || [ "${keep}" = "y" ] | ||
| then | ||
| echo -e '\n Deleting the data_regtests folder' | ||
| rm -rf data_regtests | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.