-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_dSMB
executable file
·83 lines (55 loc) · 3.09 KB
/
create_dSMB
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
#!/bin/bash
set -evx
usurf_in=$1
climate_in=$2
ocean_in=$3
usurf=${usurf_in/.nc/_yx.nc}
climate=${climate_in/.nc/_yx.nc}
#just so the cdos don't freak out
if [ ! -f $usurf ] ; then
ncpdq -3 -a time,y,x $usurf_in $usurf
fi
if [ ! -f ${climate} ] ; then
ncpdq -3 -a time,y,x $climate_in $climate
fi
# ncap2 -Ovs ';climatic_mass_balance=0.0016*(usurf-2248)+.1011*(lat-71)' $usurf dsmb_$usurf
ncap2 -Ovs 'climatic_mass_balance=0.0016*(usurf-2248)+.1011*(lat-71)' $usurf dsmb_tmp_$usurf
ncap2 -Ovs 'climatic_mass_balance=910*0.072*(climatic_mass_balance>0.072)+910*climatic_mass_balance*(climatic_mass_balance<=0.072)' dsmb_tmp_$usurf dsmb_final_$usurf
if [ ! -f dsmb_05B13_ISMIP6_v2_ec.nc ] ; then
ln -s $PK/common/INITMIP/DSMB/dsmb_05B13_ISMIP6_v2_ec.nc
# ncecat dsmb_05B13_ISMIP6.nc dsmb_05B13_ISMIP6_ec.nc
# ncrename -d record,time dsmb_05B13_ISMIP6_ec.nc
fi # similarly, we want a record dimension.
rm -f ramp_initmip_dSMB_yx.nc ramp_dSMB_${usurf} chained_air_temp.nc
for x in $(seq 0 39) ; do
cdo -s -cat -add -selvar,climatic_mass_balance $climate -mulc,910 -divc,40 -mulc,$x -selvar,DSMB dsmb_05B13_ISMIP6_v2_ec.nc ramp_initmip_dSMB_yx.nc
cdo -s -cat -selvar,ice_surface_temp $climate chained_air_temp.nc
cdo -s -cat -add -selvar,climatic_mass_balance $climate -divc,40 -mulc,$x -selvar,climatic_mass_balance dsmb_final_$usurf ramp_dSMB_${usurf}
done
ncks -Av ice_surface_temp chained_air_temp.nc ramp_initmip_dSMB_yx.nc
ncks -Av ice_surface_temp chained_air_temp.nc ramp_dSMB_${usurf}
rm chained_air_temp.nc
cdo -settaxis,2006-01-16,12:00,1month ramp_initmip_dSMB_yx.nc ramp_initmip_dSMB_yx_time.nc
cdo -settaxis,2006-01-16,12:00,1month ramp_dSMB_${usurf} ramp_dSMB_time_${usurf}
rm ramp_initmip_dSMB_yx.nc ramp_dSMB_${usurf}
ncpdq -3 -O -a time,x,y ramp_initmip_dSMB_yx_time.nc ramp_initmip_dSMB.nc
ncpdq -3 -O -a time,x,y ramp_dSMB_time_${usurf} ramp_dSMB_${usurf_in}
ncks -Av x,y ${usurf} ramp_initmip_dSMB.nc
ncks -Av x,y ${usurf} ramp_dSMB_${usurf_in}
rm ramp_dSMB_time_${usurf} ramp_initmip_dSMB_yx_time.nc
cdo -s -add -selvar,climatic_mass_balance $climate -mulc,910 -selvar,DSMB dsmb_05B13_ISMIP6_v2_ec.nc full_initmip_dSMB_yx.nc
cdo -s -add -selvar,climatic_mass_balance $climate -selvar,climatic_mass_balance dsmb_final_$usurf full_dSMB_${usurf}
ncks -Av ice_surface_temp ${climate} full_initmip_dSMB_yx.nc
ncks -Av ice_surface_temp ${climate} full_dSMB_${usurf}
ncks -Av x,y ${usurf} full_initmip_dSMB_yx.nc
ncks -Av x,y ${usurf} full_dSMB_${usurf}
ncpdq -3 -O -a time,x,y full_initmip_dSMB_yx.nc full_initmip_dSMB.nc
ncpdq -3 -O -a time,x,y full_dSMB_${usurf} full_dSMB_${usurf_in}
~/mPISM/util/create_timeline.py -a 2001-01-01 -e 2041-01-01 -p yearly 40years.nc -d 2001-01-01
ncks -A 40years.nc ramp_dSMB_${usurf_in}
ncks -A 40years.nc ramp_initmip_dSMB.nc
~/mPISM/util/create_timeline.py -a 2001-01-01 -e 2002-01-01 -p monthly 1year.nc -d 2001-01-01
cdo -lmean ${ocean_in} climatological_ocean_year.nc
ncks -Av x,y ${ocean_in} climatological_ocean_year.nc
ncks -A 1year.nc climatological_ocean_year.nc
# rm ramp_initmip_dSMB_yx.nc ramp_dSMB_${usurf} full_initmip_dSMB_yx.nc full_dSMB_${usurf}