-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprocessseaice
executable file
·77 lines (61 loc) · 4.13 KB
/
processseaice
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
#!/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 -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
#assemble 10d means for each month
cdo -O cat *${year}-12-*.nc ./${suite}i.10d.${year}-12-all.nc
cdo -O cat *$((year+1))-01-*.nc ./${suite}i.10d.$((year+1))-01-all.nc
cdo -O cat *$((year+1))-02-*.nc ./${suite}i.10d.$((year+1))-02-all.nc
cdo -O cat *$((year+1))-03-*.nc ./${suite}i.10d.$((year+1))-03-all.nc
cdo -O cat *$((year+1))-04-*.nc ./${suite}i.10d.$((year+1))-04-all.nc
cdo -O cat *$((year+1))-05-*.nc ./${suite}i.10d.$((year+1))-05-all.nc
cdo -O cat *$((year+1))-06-*.nc ./${suite}i.10d.$((year+1))-06-all.nc
cdo -O cat *$((year+1))-07-*.nc ./${suite}i.10d.$((year+1))-07-all.nc
cdo -O cat *$((year+1))-08-*.nc ./${suite}i.10d.$((year+1))-08-all.nc
cdo -O cat *$((year+1))-09-*.nc ./${suite}i.10d.$((year+1))-09-all.nc
cdo -O cat *$((year+1))-10-*.nc ./${suite}i.10d.$((year+1))-10-all.nc
cdo -O cat *$((year+1))-11-*.nc ./${suite}i.10d.$((year+1))-11-all.nc
#calculate each monthly mean
cdo -O timmean ./${suite}i.10d.${year}-12-all.nc ./processed/${suite}i.1m.${year}-12.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-01-all.nc ./processed/${suite}i.1m.$((year+1))-01.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-02-all.nc ./processed/${suite}i.1m.$((year+1))-02.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-03-all.nc ./processed/${suite}i.1m.$((year+1))-03.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-04-all.nc ./processed/${suite}i.1m.$((year+1))-04.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-05-all.nc ./processed/${suite}i.1m.$((year+1))-05.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-06-all.nc ./processed/${suite}i.1m.$((year+1))-06.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-07-all.nc ./processed/${suite}i.1m.$((year+1))-07.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-08-all.nc ./processed/${suite}i.1m.$((year+1))-08.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-09-all.nc ./processed/${suite}i.1m.$((year+1))-09.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-10-all.nc ./processed/${suite}i.1m.$((year+1))-10.nc
cdo -O timmean ./${suite}i.10d.$((year+1))-11-all.nc ./processed/${suite}i.1m.$((year+1))-11.nc
#delete temporary files
rm ./${suite}i.10d.????-??-all.nc
#assemble 1m means for each season
cdo -O cat ./processed/${suite}i.1m.${year}-12.nc ./processed/${suite}i.1m.$((year+1))-0[12].nc ./${suite}i.1m.${year}-12-all.nc
cdo -O cat ./processed/${suite}i.1m.$((year+1))-0[345].nc ./${suite}i.1m.$((year+1))-03-all.nc
cdo -O cat ./processed/${suite}i.1m.$((year+1))-0[678].nc ./${suite}i.1m.$((year+1))-06-all.nc
cdo -O cat ./processed/${suite}i.1m.$((year+1))-{09,10,11}.nc ./${suite}i.1m.$((year+1))-09-all.nc
#calculate seasonal means
cdo -O timmean ./${suite}i.1m.${year}-12-all.nc ./processed/${suite}i.1s.${year}-12.nc
cdo -O timmean ./${suite}i.1m.$((year+1))-03-all.nc ./processed/${suite}i.1s.$((year+1))-03.nc
cdo -O timmean ./${suite}i.1m.$((year+1))-06-all.nc ./processed/${suite}i.1s.$((year+1))-06.nc
cdo -O timmean ./${suite}i.1m.$((year+1))-09-all.nc ./processed/${suite}i.1s.$((year+1))-09.nc
#delete temporary files
rm ./${suite}i.1m.${year}-12-all.nc ./${suite}i.1m.$((year+1))-0[369]-all.nc
#assemble 1s means for the year
cdo -O cat ./processed/${suite}i.1s.${year}-12.nc ./processed/${suite}i.1s.$((year+1))-0[369].nc ./${suite}i.1s.${year}-all.nc
#calculate annual mean
cdo -O timmean ./${suite}i.1s.${year}-all.nc ./processed/${suite}i.1y.${year}.nc
#delete temporary files
rm ./${suite}i.1s.${year}-all.nc
done
cd processed
rename .nc -eorca1.nc *.nc