-
Notifications
You must be signed in to change notification settings - Fork 2
/
processocean
executable file
·85 lines (66 loc) · 6.42 KB
/
processocean
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
#!/usr/bin/env bash
mkdir processed
echo -n "Enter the suite ID omitting the prefix, e.g. ac926 : "
read suite
echo "Processing the data for : $suite"
echo "Bear in mind for the next questions that for a 1 year validation note the
start and end years are the same!"
echo -n "Enter the start year (December) : "
read year1
echo "Processing the data for : $year1"
echo -n "Enter the end year (November) : "
read year2
echo "Processing the data for : $year2"
for year in $(seq $year1 $year2); do
for filetype in U V T; do
#assemble 10d means for each month
cdo -O cat *${year}12*${filetype}.nc ./${suite}o_10d_${year}1201_${year}1230_eorca1_${filetype}.nc
cdo -O cat *$((year+1))01*${filetype}.nc ./${suite}o_10d_$((year+1))0101_$((year+1))0130_eorca1_${filetype}.nc
cdo -O cat *$((year+1))02*${filetype}.nc ./${suite}o_10d_$((year+1))0201_$((year+1))0230_eorca1_${filetype}.nc
cdo -O cat *$((year+1))03*${filetype}.nc ./${suite}o_10d_$((year+1))0301_$((year+1))0330_eorca1_${filetype}.nc
cdo -O cat *$((year+1))04*${filetype}.nc ./${suite}o_10d_$((year+1))0401_$((year+1))0430_eorca1_${filetype}.nc
cdo -O cat *$((year+1))05*${filetype}.nc ./${suite}o_10d_$((year+1))0501_$((year+1))0530_eorca1_${filetype}.nc
cdo -O cat *$((year+1))06*${filetype}.nc ./${suite}o_10d_$((year+1))0601_$((year+1))0630_eorca1_${filetype}.nc
cdo -O cat *$((year+1))07*${filetype}.nc ./${suite}o_10d_$((year+1))0701_$((year+1))0730_eorca1_${filetype}.nc
cdo -O cat *$((year+1))08*${filetype}.nc ./${suite}o_10d_$((year+1))0801_$((year+1))0830_eorca1_${filetype}.nc
cdo -O cat *$((year+1))09*${filetype}.nc ./${suite}o_10d_$((year+1))0901_$((year+1))0930_eorca1_${filetype}.nc
cdo -O cat *$((year+1))10*${filetype}.nc ./${suite}o_10d_$((year+1))1001_$((year+1))1030_eorca1_${filetype}.nc
cdo -O cat *$((year+1))11*${filetype}.nc ./${suite}o_10d_$((year+1))1101_$((year+1))1130_eorca1_${filetype}.nc
#calculate each monthly mean
cdo -O timmean ./${suite}o_10d_${year}1201_${year}1230_eorca1_${filetype}.nc ./processed/${suite}o_1m_${year}1201_${year}1230_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))0101_$((year+1))0130_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))0101_$((year+1))0130_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))0201_$((year+1))0230_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))0201_$((year+1))0230_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))0301_$((year+1))0330_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))0301_$((year+1))0330_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))0401_$((year+1))0430_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))0401_$((year+1))0430_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))0501_$((year+1))0530_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))0501_$((year+1))0530_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))0601_$((year+1))0630_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))0601_$((year+1))0630_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))0701_$((year+1))0730_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))0701_$((year+1))0730_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))0801_$((year+1))0830_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))0801_$((year+1))0830_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))0901_$((year+1))0930_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))0901_$((year+1))0930_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))1001_$((year+1))1030_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))1001_$((year+1))1030_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_10d_$((year+1))1101_$((year+1))1130_eorca1_${filetype}.nc ./processed/${suite}o_1m_$((year+1))1101_$((year+1))1130_eorca1_${filetype}.nc
#delete temporary files
rm ./*10d*??????01_??????30*${filetype}.nc
#assemble 1m means for each season
cdo -O cat ./processed/*1m*${year}12*${filetype}.nc ./processed/*1m*$((year+1))0[12]*${filetype}.nc ./${suite}o_1m_${year}1201_$((year+1))0230_eorca1_${filetype}.nc
cdo -O cat ./processed/*1m*$((year+1))0[345]*${filetype}.nc ./${suite}o_1m_$((year+1))0301_$((year+1))0530_eorca1_${filetype}.nc
cdo -O cat ./processed/*1m*$((year+1))0[678]*${filetype}.nc ./${suite}o_1m_$((year+1))0601_$((year+1))0830_eorca1_${filetype}.nc
cdo -O cat ./processed/*1m*$((year+1))09*${filetype}.nc ./processed/*1m*$((year+1))1[012]*${filetype}.nc ./${suite}o_1m_$((year+1))0901_$((year+1))1130_eorca1_${filetype}.nc
#calculate seasonal means
cdo -O timmean ./${suite}o_1m_${year}1201_$((year+1))0230_eorca1_${filetype}.nc ./processed/${suite}o_1s_${year}1201_$((year+1))0230_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_1m_$((year+1))0301_$((year+1))0530_eorca1_${filetype}.nc ./processed/${suite}o_1s_$((year+1))0301_$((year+1))0530_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_1m_$((year+1))0601_$((year+1))0830_eorca1_${filetype}.nc ./processed/${suite}o_1s_$((year+1))0601_$((year+1))0830_eorca1_${filetype}.nc
cdo -O timmean ./${suite}o_1m_$((year+1))0901_$((year+1))1130_eorca1_${filetype}.nc ./processed/${suite}o_1s_$((year+1))0901_$((year+1))1130_eorca1_${filetype}.nc
#delete temporary files
rm ./${suite}o_1m_${year}1201_$((year+1))0230_eorca1_${filetype}.nc ./${suite}o_1m_$((year+1))0301_$((year+1))0530_eorca1_${filetype}.nc ./${suite}o_1m_$((year+1))0601_$((year+1))0830_eorca1_${filetype}.nc ./${suite}o_1m_$((year+1))0901_$((year+1))1130_eorca1_${filetype}.nc
#assemable 1s means for the year
cdo -O cat ./processed/*1s*${year}12*${filetype}.nc ./processed/*1s*$((year+1))0[369]*${filetype}.nc ./${suite}o_1s_${year}1201_$((year+1))1130_eorca1_${filetype}.nc
#calculate annual mean
cdo -O timmean ./${suite}o_1s_${year}1201_$((year+1))1130_eorca1_${filetype}.nc ./processed/${suite}o_1y_${year}1201_$((year+1))1130_eorca1_${filetype}.nc
#delete temporary files
rm ./${suite}o_1s_${year}1201_$((year+1))1130_eorca1_${filetype}.nc
done
done
#edit file metadata which is needed for the MOC calculations to work
#cd processed
#for file in *V*.nc; do ncatted -a coordinates,,m,c,'time nav_lat nav_lon' $file; done