-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_ebm_for_interp
executable file
·47 lines (37 loc) · 1.71 KB
/
prepare_ebm_for_interp
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
#!/bin/bash
#SBATCH --job-name=interp_ebm # Specify job name
#SBATCH --partition=shared # Specify partition name
#SBATCH --ntasks=1 # Specify max. number of tasks to be invoked
#SBATCH --time=5:00:00 # Set a limit on the total run time
#SBATCH --mail-type=FAIL # Notify user by email in case of job failure
#SBATCH --account=ba0989 # Charge resources on this project account
#SBATCH --output=ebm.eo%j # File name for standard output
#SBATCH --error=ebm.eo%j # File name for standard error output
set -evx
#Interpolation on ice sheet grid for different experiments
# needs NOTHING
startyear=${startyear:-1000}
endyear=${endyear:-1049}
pow=2
path=${path:-$(pwd)/script}
workpath=${workpath:-$(pwd)}
workpath=$(readlink -m "$workpath")
path=$(readlink -m "$path")
cd $path
# temp_s = var600
# smb = var601 - var602
# get smb on levels to $workpath/Output_Z${level}.ext
for level in 0000 0100 0200 0300 0400 0500 0625 0750 0875 1000 1125 1250 1375 1500 1625 1750 1875 2000 2500 3000 4000 5000 6000 8000
do
cdo -s -f ext -b 64L -setlevel,${level} -selvar,amelt,acc,temp_s $path/Z${level}/Output_0001.nc $workpath/Output_Z${level}.ext
done
# combine all levels
cdo -s merge $workpath/Output_Z????.ext $workpath/Output_Zall.ext
# split off yearly output and get last timestep of every year of SMB
cdo -s -f nc splityear -setgrid,zs.nc $workpath/Output_Zall.ext $workpath/YEAR
for year in $(seq ${startyear} ${endyear}); do
ncks -d time,-1 $workpath/YEAR${year}.nc $workpath/H1${year}
done
# get all last timesteps (final SMBs of all years)
cdo -s -f ext -b 64L mergetime $workpath/H1???? $workpath/Output_Zall.ext
#rm $workpath/H1???? $workpath/Output_Z????.ext $workpath/YEAR????.nc