NEANIAS Gitlab

Commit d4337bee authored by Carlos H. Brandt's avatar Carlos H. Brandt
Browse files

Update script to download from NASA also

parent 7270b71d
#!/bin/bash
set -ue
#set -ue
DRY_RUN=${DRY_RUN:-""}
......@@ -33,12 +33,20 @@ function usage() {
echo ""
echo " Print (wget) commands for downloading Data for Orbit I957:"
echo ""
echo " $ DRY_RUN=y ORBIT=I975 ./download_sample.sh data"
echo " $ DRY_RUN=y ORBIT=0103 ./download_sample.sh data"
echo ""
}
server='ftp://psa.esac.esa.int'
path='pub/mirror/MARS-EXPRESS/HRSC/MEX-M-HRSC-5-REFDR-DTM-V1.0'
SRV=${SRV:-ESA}
if [ "$SRV" = 'ESA' ]; then
SERVER='ftp://psa.esac.esa.int'
PDSATH='pub/mirror/MARS-EXPRESS/HRSC/MEX-M-HRSC-5-REFDR-DTM-V1.0'
else
[ "$SRV" = 'NASA' ] || { echo '$SRV should be either ESA or NASA'; exit; }
SERVER='ftp://pds-geosciences.wustl.edu'
PDSATH='mex/mex-m-hrsc-5-refdr-dtm-v1/mexhrs_2001'
fi
docs=(AAREADME.TXT CATALOG/CATINFO.TXT DOCUMENT EXTRAS/EXTRINFO.TXT INDEX/INDXINFO.TXT VOLDESC.CAT)
meta=(INDEX)
......@@ -49,15 +57,14 @@ function do_wget() {
#
content=$@
for c in ${content[@]}; do
# REMOVE 'echo' to actually download the content
#
data="${SERVER}/${PDSATH}/${c}"
[ "$SRV" = 'NASA' ] && data=$(echo "$data" | tr '[:upper:]' '[:lower:]')
if [ ! -n "$DRY_RUN" ]; then
# download
echo "Remove this 'echo'"
echo wget -r -nH --cut-dirs=4 --directory-prefix=ESA ${server}/${path}/${c}
wget -r -nH --cut-dirs=4 --directory-prefix=${SRV} ${data}
else
# dry-run
echo wget -r -nH --cut-dirs=4 --directory-prefix=ESA ${server}/${path}/${c}
echo "wget -r -nH --cut-dirs=4 --directory-prefix=${SRV} ${data}"
fi
done
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment