-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_sea_ice_bgc_to_restart.sh
executable file
·67 lines (49 loc) · 1.38 KB
/
add_sea_ice_bgc_to_restart.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
#!/usr/bin/env sh
module load nco
set -x
set -e
#Add sea-ice BGC tracers to the restart file and i2o.nc and o2i.nc.
#Below, you need to define 'path2restart' and 'filename' for the restart file.
#Define the path to the restart file you want to add BGC tracers
path2restart=/g/data/ik11/restarts/access-om2-01/01deg_jra55v140_iaf_cycle3/restart731
#Define the name of the restart file
filename=iced.2019-01-01-00000.nc
#Copy the restart file to pwd
cp ${path2restart}/ice/${filename} .
#Add 2D fields.
for j in algalN nit
do
ncap2 -O -s ${j}=iceumask*0 ${filename} ${filename}
done
#Add 3D fields.
for j in bgc_N_sk bgc_Nit_sk
do
ncap2 -O -s ${j}=aicen*0 ${filename} ${filename}
done
#Next i2o.nc and o2i.nc
filename=i2o.nc
#Copy the restart file to pwd
cp ${path2restart}/ice/${filename} .
for j in wnd10_io nit_io alg_io
do
ncap2 -O -s ${j}=licefh_io*0 ${filename} ${filename}
done
filename=o2i.nc
#Copy the restart file to pwd
cp ${path2restart}/ice/${filename} .
for j in ssn_i ssalg_i
do
ncap2 -O -s ${j}=sst_i*0 ${filename} ${filename}
done
# Also ocean_sbc.res.nc
filename=ocean_sbc.res.nc
#Copy the restart file to pwd
cp ${path2restart}/ocean/${filename} .
for j in n_surf alg_surf
do
ncap2 -O -s ${j}=t_surf*0 ${filename} ${filename}
for a in long_name units checksum
do # remove attributes
ncatted -O -a ${a},${j},d,, ${filename} ${filename}
done
done