-
Notifications
You must be signed in to change notification settings - Fork 0
/
autorun-4norway.sh
executable file
·116 lines (109 loc) · 4.88 KB
/
autorun-4norway.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
echo -- 4NORWAY NorESM2-MM downscaling Norway using WRF model: Run this on NIRD --
if [ -z "$3" ]; then
echo "Usage: $0 STARTYEAR ENDYEAR STEP..."
echo " step 1:"
echo " - # Clean old data IM data - interactive"
echo " - Run Extract_vars_RF.py script"
echo " step 2:"
echo " - Submit Hybrid_To_Pres_new.ncl on NIRD IPCC"
echo " step 3:"
echo " - Copy output of NCL-script (NorESM2-MM:1984-01-01_00 ...) from NIRD to BETZY"
echo " step 4:"
echo " - Submit metgrid.exe job on BETZY"
echo " step 5:"
echo " - Submit real.exe job on BETZY"
echo " step 6:"
echo " - Submit wrf.exe job on BETZY"
exit
fi
# Use $IM work folder:
start_year=$1
end_year=$2
if [ "$2" == "-" ]; then
end_year=$start_year
fi
shift
shift
user=$USER
proj=4NORWAY-WRF
IM=IM_NorESM
nird_home=/nird/home/$user
nird_input=$nird_home/proj/4NORWAY-input
nird_proj=$nird_home/proj/4NORWAY-WRF
nird_work=/scratch/$user/4NORWAY
betzy_work=/cluster/work/users/$user/4NORWAY
norce_work=/cluster/work/users/$user/4NORWAY
betzy=login-1.betzy.sigma2.no
nird=login0.nird.sigma2.no
ipcc=ipcc.nird.sigma2.no
norce=login-1.hpc.intra.norceresearch.no
#fram=login-1.fram.sigma2.no
#fram_work=/cluster/work/users/$user/4NORWAY
for (( year=$start_year; year<=$end_year; ++year )); do
echo Year $year
next_year=$(expr $year + 1)
prev_year=$(expr $year - 2)
for step in "$@"; do
case $step in
1)
echo -- 1. NIRD: Clean old and extract variables and create $IM variables...
# Output: NIRD: /scratch/tylo/4NORWAY/1984_intoNCL/atmos_hus.nc ...
#rm -rf $nird_work/$IM/${prev_year}_intoNCL # $nird_work/$IM/OUTPUT_HIS/$prev_year
#python Extract_Vars_RF.py $year $nird_work/$IM
#ssh $user@$nird "rm -r $nird_work/${year}_intoNCL"
ssh $user@$nird "mkdir -p $nird_work/${year}_intoNCL ; cp $nird_proj/Extract_Vars_RF.py $nird_work"
ssh $user@$nird "cp $nird_input/hybrid.nc $nird_input/zsfc.nc $nird_work/${year}_intoNCL"
ssh $user@$nird "cd $nird_work ; nohup nice python ./Extract_Vars_RF.py $year $nird_work/${year}_intoNCL >Extract_Vars_RF.log 2>&1 < /dev/null &"
;;
2)
echo -- 2. IPCC: Run Hybrid_To_Pres_new.ncl script and copy result to betzy.:
# Input: nird: /scratch/tylo/4NORWAY/1984_intoNCL/atmos_hus.nc ...
# Output: nird: /scratch/tylo/4NORWAY/1984_outHIST/NorESM2-MM:1984-01-01_00
#ssh $user@$ipcc "rm -r $nird_work/${year}_outHIST"
ssh $user@$ipcc "mkdir -p $nird_work/${year}_outHIST ; cp $nird_proj/Hybrid_To_Pres_new.ncl $nird_proj/run_ncl.sh $nird_work"
#ssh $user@$ipcc "cd $nird_work ; sh ./run_ncl.sh $year ${year}_intoNCL ${year}_outHIST"
ssh $user@$ipcc "cd $nird_work ; nohup nice sh ./run_ncl.sh $year ${year}_intoNCL ${year}_outHIST >run_ncl-$year.log 2>&1 < /dev/null &"
;;
3betzy)
echo -- 3. NIRD: Copy output from NCL-script to BETZY:
# Input: NIRD: /scratch/tylo/4NORWAY/1984_outHIST/NorESM2-MM:1984-01-01_00
# Output: BETZY: /cluster/work/users/tylo/4NORWAY/1984_outHIST/NorESM2-MM:1984-01-01_00
echo "mkdir -p $betzy_work"
ssh $user@$betzy "mkdir -p $betzy_work"
echo "scp -r $user@$nird:$nird_work/${year}_outHIST $user@$betzy:$betzy_work"
nohup scp -r $user@$nird:$nird_work/${year}_outHIST $user@$betzy:$betzy_work 2>&1 < /dev/null &
;;
3)
echo -- 3. NIRD: Copy output from NCL-script to NORCE HPC:
# Input: NIRD: /scratch/tylo/4NORWAY/1984_outHIST/NorESM2-MM:1984-01-01_00
# Output: NORCE: /cluster/work/users/tylo/4NORWAY/1984_outHIST/NorESM2-MM:1984-01-01_00
echo "mkdir -p $norce_work"
ssh $user@$norce "mkdir -p $norce_work"
echo "scp -3 -r $user@$nird:$nird_work/${year}_outHIST $user@$norce:$norce_work"
nohup scp -3 -r $user@$nird:$nird_work/${year}_outHIST $user@$norce:$norce_work 2>&1 < /dev/null &
;;
4)
echo -- 4. BETZY: run metgrid.exe
# Input: wps/namelist.wps, wps/geo_em.d01, wps/geo_em.d02, IM_NorESM/$year/NorESM2-MM:1984-01-01_00
# Output: wps/metgrid-out-1984/met_em.d01.1984-01-01_00:00:00.nc
#scp wps/run_metgrid.sh $user@$betzy:wps/run_metgrid.sh
ssh $user@$betzy "cd $betzy_work/wps ; sbatch run_metgrid.sh $year"
;;
5)
echo -- 5. BETZY: Run real.exe
# Input: wrf/namelist.input, wrf/met_em*
# Output: wrf/wrfbdy_d01, wrf/wrfinput_d01, wrf/wrfbdy_d02, wrf/wrfinput_d02
echo ssh $user@$betzy "cd $betzy_work/wrf ; sbatch run_real.sh ${year}-01-01 $((year + 1))-01-01"
;;
6)
echo -- 6. BETZY: Run wrf.exe
# Input: namelist.input, wrfbdy_d01, wrfinput_d01, wrfbdy_d02, wrfinput_d02
# Output: wrfout_d01
echo ssh $user@$betzy "cd $betzy_work/wrf ; sbatch run_wrf.sh ${year}-01-01 $((year + 1))-01-01"
;;
*)
echo Wrong input
esac
done
done