1 | #--v3 of my script to extract global mean and put to IGCM format |
---|
2 | |
---|
3 | #--according to Malte Meinsheausen two options are possible |
---|
4 | # CFC11=CFC11eq and CCFC12=CFC12 |
---|
5 | # or CFC11=HFC134a-eq * (0.0100/62.7)/(0.062/238) [values from AR5] and CFC12=CFC12eq |
---|
6 | # in the second case the HFC134a-eq is converted into CFC11eq using RF efficiencies from AR5 in Wm-2pptv-1 |
---|
7 | |
---|
8 | #--11/10/2016 New format for the data, now global, NH and SH means are in a sector dimension |
---|
9 | #--hence I parse the first value from the cdo outputf to get the global mean |
---|
10 | #--outputf is used with format %12.4e to make sure there is a space between values and 3 values per line |
---|
11 | |
---|
12 | #--dir for annual mean data |
---|
13 | dirin1='/prodigfs/project/input4MIPs/UoM/GHGConcentrations/CMIP/UoM-CMIP-1-2-0/yr/' |
---|
14 | dirin2='gr1-GMNHSH/v20160902' |
---|
15 | |
---|
16 | dirout='./OUTPUT' |
---|
17 | if [ ! -d ${dirout} ] ; then mkdir ${dirout} ; fi |
---|
18 | |
---|
19 | rm -f years.txt |
---|
20 | for i in `seq -w 0 2014` |
---|
21 | do |
---|
22 | echo 'Annee_'$i'=' >> years.txt |
---|
23 | done |
---|
24 | |
---|
25 | #--N2O we leave unit to ppb |
---|
26 | GHG='N2O' |
---|
27 | name='nitrous_oxide' |
---|
28 | file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc' |
---|
29 | rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt |
---|
30 | dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2} |
---|
31 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
32 | paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt |
---|
33 | |
---|
34 | #--CH4 here we leave unit in ppb |
---|
35 | GHG='CH4' |
---|
36 | name='methane' |
---|
37 | file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc' |
---|
38 | dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2} |
---|
39 | rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt |
---|
40 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
41 | paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt |
---|
42 | |
---|
43 | #--CO2 here we leave unit in ppm |
---|
44 | GHG='CO2' |
---|
45 | name='carbon_dioxide' |
---|
46 | file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc' |
---|
47 | dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2} |
---|
48 | rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt |
---|
49 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
50 | paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt |
---|
51 | |
---|
52 | #--CFC11eq we leave in en pptv |
---|
53 | #--not used for CMIP6 |
---|
54 | GHG='CFC11eq' |
---|
55 | name='cfc11eq' |
---|
56 | file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc' |
---|
57 | dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2} |
---|
58 | rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt |
---|
59 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
60 | paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt |
---|
61 | |
---|
62 | #--CFC12eq we leave in en pptv |
---|
63 | GHG='CFC12eq' |
---|
64 | name='cfc12eq' |
---|
65 | file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc' |
---|
66 | dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2} |
---|
67 | rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt |
---|
68 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
69 | paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt |
---|
70 | #--we will use CFC12eq for CMIP6 |
---|
71 | cp ${dirout}/${GHG}_0000_2014.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt |
---|
72 | |
---|
73 | #--CFC11 we leave in en pptv |
---|
74 | #--not used for CMIP6 |
---|
75 | GHG='CFC11' |
---|
76 | name='cfc11' |
---|
77 | file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc' |
---|
78 | dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2} |
---|
79 | rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt |
---|
80 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
81 | paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt |
---|
82 | |
---|
83 | #--CFC12 we leave in en pptv |
---|
84 | #--not used for CMIP6 |
---|
85 | GHG='CFC12' |
---|
86 | name='cfc12' |
---|
87 | file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc' |
---|
88 | dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2} |
---|
89 | rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt |
---|
90 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
91 | paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt |
---|
92 | |
---|
93 | #--HFC134aeq we leave in en pptv |
---|
94 | GHG='HFC134aeq' |
---|
95 | name='hfc134aeq' |
---|
96 | file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc' |
---|
97 | dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2} |
---|
98 | rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt ${dirout}/CFC11eq_CMIP6_0000_2014.txt |
---|
99 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
100 | paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt |
---|
101 | #--HFC134a-eq converted to CFC11-eq for CMIP6 |
---|
102 | #--by multiplying by (0.0100/62.7)/(0.062/238)=0.6122344 |
---|
103 | cdo outputf,%12.4e,3 -mulc,0.6122344 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
104 | paste years.txt tmp.txt > ${dirout}/CFC11eq_CMIP6_0000_2014.txt |
---|
105 | |
---|
106 | #--clean up |
---|
107 | rm -f tmp.txt years.txt |
---|