-
Notifications
You must be signed in to change notification settings - Fork 0
/
pism2virna
executable file
·50 lines (32 loc) · 2.32 KB
/
pism2virna
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
#!/bin/bash
echo WARNING: MIGHT BE BUGGY, JUST FOR DEVELOPMENT / TESTING
set -ex
CDO="cdo -s -P 4"
#ICE COVERED PARTS OF ANTARCTICA FIXED TO PRESENT DAY
thk_sh=/work/ba0989/work_bm0948/common/INPUT/RTOPO/thk_mod_SH_10minbil.nc
bedrock_ant=" -setname,topg -selvar,DEPTO /work/ba0989/work_bm0948/common/INPUT/RTOPO/modified-RTopo-2.0.1_30sec_bedrock_topography_10minbil_ncecat.nc"
datadir=/work/ba0989/work_bm0948/common/INPUT/RTOPO/
topo_file=RTopo-2.0.1_30sec_surface_elevation_10minbil.nc # evtl. austauschen!
min_ocean=0
df=1.1296703296703297 # 1028/910, the constants in PISM
for num in $@ ; do
#Files
bedrock_vilma="../vilma/pv_${num}.nc"
ttg=ttg_${num}.nc # Pism values on global grid
# PISM values on global grid
${CDO} -remap,${bedrock_vilma},factors.nc -selvar,thk,topg,usurf,mask ../pism/pv_${num}.nc $ttg
# surface elevation of grounded ice NH
usf_nh="-setmisstoc,0 -ifthen -mul -gtc,10 -selvar,thk $ttg -eqc,2 -selvar,mask $ttg -selvar,usurf $ttg" # only grounded ice, no shelves
ice_nh="-setmisstoc,0 -ifthen -gtc,10 -selvar,thk $ttg -selvar,usurf $ttg" # everything ice covered including shelves
# surface elevation of grounded ice NH (old method)
# usf_nh="-ifthen -gec,-${min_ocean} -add -divc,${df} -selvar,thk ttg_${num}.nc -selvar,topg ttg_${num}.nc -selvar,usurf ttg_${num}.nc" # Ein Feld usurf, wenn thk+topg > -min_ocean
# surface elevation of grounded ice SH
usf_sh=" -setmisstoc,0 -ifthen -gtc,10 -selvar,thk ${thk_sh} -ifthen -gec,-${min_ocean} -add -divc,${df} -selvar,thk ${thk_sh} ${bedrock_ant} -selvar,surface_elevation ${datadir}/${topo_file}" # s.o.
ice_sh=" -setmisstoc,0 -ifthen -gtc,10 -selvar,thk ${thk_sh} -selvar,surface_elevation ${datadir}/${topo_file}" # s.o.
# new surface elevation
${CDO} -f ext -setcode,66 -setname,topg -ifthenelse -add ${usf_sh} ${usf_nh} -add ${usf_sh} ${usf_nh} -add -setclonlatbox,0,0,360,-90,-59 -selvar,topg ${bedrock_vilma} -setclonlatbox,0,0,360,-59,90, ${bedrock_ant} fort.70
topfill
${CDO} -f nc -setname,ocean_mask -setgrid,${bedrock_vilma} fort.71 ocean_mask_${num}.nc
${CDO} -setname,topg -ifthenelse -mul -nec,9 ocean_mask_${num}.nc -add $ice_nh $ice_sh -add $ice_nh $ice_sh -setgrid,${bedrock_vilma} fort.70 usf_${num}.nc
rm ttg_${num}.nc
done