-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwgetAWSgefsv12winds_grib2.sh
executable file
·70 lines (53 loc) · 1.73 KB
/
wgetAWSgefsv12winds_grib2.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
# Shell script to dowload GEFSv12 from AWS: simple wget without postproc
# https://noaa-gefs-retrospective.s3.amazonaws.com/index.html
# Only 10m wind components
# two arguments: year and output-path
# examples:
# ./wgetAWSgefsv12_grib2.sh 2000 /home/name/Downloads
# nohup ./wgetAWSgefsv12winds_grib2.sh 2000 /home/name/Downloads >> nohupout_wgetAWSgefsv12winds_grib2_2000.txt 2>&1 &
year=$1
dpath=$2
cd $dpath
SERVER="http://noaa-gefs-retrospective.s3.amazonaws.com/GEFSv12/reforecast"
# variables
vars=(u v)
# float array resolution (decimals)
dp=3
for month in `seq 1 12`; do
for day in `seq 1 31`; do
date=$year`printf %2.2d $month``printf %2.2d $day`
# forecast range
wday=$(date -d "$year-`printf %2.2d $month`-`printf %2.2d $day`" +%u)
if [ "$wday" -eq 3 ]; then
frg=(1-10 10-35)
else
frg=(1-10 10-16)
fi
for em in `seq 0 10`; do
if [ ${em} -eq 0 ]; then
# Control Member
sem="c00"
else
# Ensemble Members
sem="p`printf %2.2d $em`"
fi
# two slices of forecast ranges
for fg in ${frg[*]}; do
# variables U and V
for var in ${vars[*]}; do
fname=${var}"grd_hgt_"${date}"00_"${sem}
wget --no-check-certificate --no-proxy -l1 -H -t1 -nd -N -np -erobots=off --tries=3 ${SERVER}/${year}/${date}"00/"${sem}"/Days:"${fg}"/"${fname}".grib2" &&
sleep 1
test -f ${var}"grd_hgt_"${date}"00_"${sem}".grib2" &&
TE=$?
if [ "$TE" -eq 0 ]; then
mv ${fname}".grib2" ${fname}".D"${fg}".grib2"
fi
done
done
done
echo " Ok "${date}
done
done
echo "Download GEFSv12 AWS wind for "$year" is complete, at "$dpath