-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_merra2_ges_disc.sh
executable file
·59 lines (45 loc) · 1.7 KB
/
get_merra2_ges_disc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
#
# Author: Manabendra Saharia Aug 2019
# Purpose: Downloads MERRA2 data for a particular month
#======================================================
#======================================================
# USER ENTRY
#======================================================
# Login Credentials. Change this to your own.
WEBSITE=https://goldsmr4.gesdisc.eosdis.nasa.gov/
cmd='--no-check-certificate'
usr='--http-user='
pw='--http-password='
# MERRA Variables for downloading.
# Make list from here: https://goldsmr4.gesdisc.eosdis.nasa.gov/data/MERRA2/
merravarlist=(
"M2T1NXFLX.5.12.4"
"M2I1NXLFO.5.12.4"
"M2T1NXRAD.5.12.4"
"M2SDNXSLV.5.12.4"
)
# MERRA download directory - where data is to be dowloaded
WORKDIR=/gpfsm/dnb04/projects/p84/msaharia/autoservir/MERRA2_400
#======================================================
# USER PROMPT
#======================================================
echo "You will download MERRA2 data for a particular year and month."
read -p "Enter the year (e.g. 2019): " YEAR
read -p "Enter the month (e.g. 4): " MONTH
read -p "Continue to download data? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
MONTH=$(printf %02d $MONTH)
#======================================================
# DOWNLOADING
#======================================================
downloaddir=$WORKDIR/'Y'$YEAR/'M'$MONTH
mkdir -p $downloaddir && cd "$_"
declare -a merravarlist
# Read the array values with space
for merravar in "${merravarlist[@]}"; do
merradir=$WEBSITE/data/MERRA2/$merravar/$YEAR/$MONTH/
wget $cmd $usr $pw -r $merradir -c -nH -nd -np -A nc4 --content-disposition
done
rm -rf robots*
echo "MERRA2 data download complete for $YEAR$MONTH!"
exit 0