-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHadgem2WRF.sh
executable file
·68 lines (65 loc) · 1.64 KB
/
Hadgem2WRF.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
#!/bin/bash -
#title :getvars.sh
#description :get hadgem vars
#author :CEMAC - Helen
#date :20200228
#version :0.2
#usage :./getvars.sh
#notes :
#bash_version :4.2.46(2)-release
#============================================================================
print_usage() {
echo "
Hadgem2WRF.sh
A CEMAC script to download, prepare the required variables a for running WRF
from Hadgem generating OUTPUT
Usage:
.\run_all.sh -y z -r -c
Options:
-y1 year
-z year (end date if range)
-r rcp
-e ensemble member (r2i1p1)
-h HELP: prints this message!
**
Code my be modified such as altering version dates for alternative experiments
obtained via https://esgf-node.llnl.gov/search/cmip5/
**
version: 0.4 (beta un-released)
------------------------------------------------
"
}
while getopts 'y:z:r:e:h' flag; do
case "${flag}" in
y) year="${OPTARG}" ;;
z) year2="${OPTARG}" ;;
r) rsp="${OPTARG}" ;;
e) ens="${OPTARG}" ;;
h) print_usage
exit 1 ;;
*) print_usage
exit 1 ;;
esac
done
# if its just one year then set year2 as the same
if [ ! -e $year2 ]; then
year2=$year
fi
# to capture dec the year before and the jan 1st day of year end
# get data from the year before and after range
for yy in $(seq $(($year-1)) $(($year2+1)));
do
./wget_script.sh -y $yy
done
# If one year just run cdo for that year
if [ $year2==$year ]; then
./cdo_script.sh -y $year
else
./cdo_script.sh -y $year -z $year2
fi
# Run ncl script
# NCL runs from dec year minus 1 to jan year plus 1
for yy in $(seq $(($year)) $(($year2)));
do
./ncl_year.sh -y $yy
done