1 | #--Update Th.Lurton 18/06/2018 for v.1.2.0 |
---|
2 | # |
---|
3 | #--Update Th.Lurton 05/02/2018 for paths to new version |
---|
4 | # ** species-directory take hyphens instead of underscores previously; |
---|
5 | # ** likewise for species names within filenames; |
---|
6 | # ** variable names stay with underscores. |
---|
7 | |
---|
8 | #--v3 of my script to extract global mean and put to IGCM format |
---|
9 | |
---|
10 | #--according to Malte Meinsheausen two options are possible |
---|
11 | # CFC11=CFC11eq and CCFC12=CFC12 |
---|
12 | # or CFC11=HFC134a-eq * (0.0100/62.7)/(0.062/238) [values from AR5] and CFC12=CFC12eq |
---|
13 | # in the second case the HFC134a-eq is converted into CFC11eq using RF efficiencies from AR5 in Wm-2pptv-1 |
---|
14 | |
---|
15 | #--11/10/2016 New format for the data, now global, NH and SH means are in a sector dimension |
---|
16 | #--hence I parse the first value from the cdo outputf to get the global mean |
---|
17 | #--outputf is used with format %12.4e to make sure there is a space between values and 3 values per line |
---|
18 | |
---|
19 | #--dir for annual mean data |
---|
20 | dirin1='/prodigfs/project/input4MIPs/CMIP6/ScenarioMIP/UoM/' |
---|
21 | dirin2='gr1-GMNHSH/v20180611/' |
---|
22 | |
---|
23 | dirout='./OUTPUT/' |
---|
24 | if [ ! -d ${dirout} ] ; then mkdir ${dirout} ; fi |
---|
25 | |
---|
26 | rm -f years.txt |
---|
27 | for i in `seq -w 2015 2500` |
---|
28 | do |
---|
29 | echo 'Annee_'$i'=' >> years.txt |
---|
30 | done |
---|
31 | |
---|
32 | for scenario in 'ssp119' 'ssp126' 'ssp245' 'ssp370' 'ssp434' 'ssp460' 'ssp534' 'ssp585' |
---|
33 | do |
---|
34 | |
---|
35 | if [ ${scenario} == 'ssp119' ] ; then prefixe='IMAGE' ; fi |
---|
36 | if [ ${scenario} == 'ssp126' ] ; then prefixe='IMAGE' ; fi |
---|
37 | if [ ${scenario} == 'ssp245' ] ; then prefixe='MESSAGE-GLOBIOM' ; fi |
---|
38 | if [ ${scenario} == 'ssp370' ] ; then prefixe='AIM' ; fi |
---|
39 | if [ ${scenario} == 'ssp434' ] ; then prefixe='GCAM4' ; fi |
---|
40 | if [ ${scenario} == 'ssp460' ] ; then prefixe='GCAM4' ; fi |
---|
41 | if [ ${scenario} == 'ssp534' ] ; then prefixe='REMIND-MAGPIE' ; fi |
---|
42 | if [ ${scenario} == 'ssp585' ] ; then prefixe='REMIND-MAGPIE' ; fi |
---|
43 | |
---|
44 | if [ ${scenario} == 'ssp119' ] ; then suffixe='' ; fi |
---|
45 | if [ ${scenario} == 'ssp126' ] ; then suffixe='' ; fi |
---|
46 | if [ ${scenario} == 'ssp245' ] ; then suffixe='' ; fi |
---|
47 | if [ ${scenario} == 'ssp370' ] ; then suffixe='' ; fi |
---|
48 | if [ ${scenario} == 'ssp434' ] ; then suffixe='' ; fi |
---|
49 | if [ ${scenario} == 'ssp460' ] ; then suffixe='' ; fi |
---|
50 | if [ ${scenario} == 'ssp534' ] ; then suffixe='over-' ; fi |
---|
51 | if [ ${scenario} == 'ssp585' ] ; then suffixe='' ; fi |
---|
52 | |
---|
53 | |
---|
54 | #--N2O we leave unit to ppb |
---|
55 | GHG='N2O' |
---|
56 | name='nitrous-oxide' |
---|
57 | namevar='nitrous_oxide' |
---|
58 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
59 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
60 | rm -f tmp.txt ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
61 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
62 | paste years.txt tmp.txt > ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
63 | |
---|
64 | #--CH4 here we leave unit in ppb |
---|
65 | GHG='CH4' |
---|
66 | name='methane' |
---|
67 | namevar='methane' |
---|
68 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
69 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
70 | rm -f tmp.txt ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
71 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
72 | paste years.txt tmp.txt > ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
73 | |
---|
74 | #--CO2 here we leave unit in ppm |
---|
75 | GHG='CO2' |
---|
76 | name='carbon-dioxide' |
---|
77 | namevar='carbon_dioxide' |
---|
78 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
79 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
80 | rm -f tmp.txt ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
81 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
82 | paste years.txt tmp.txt > ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
83 | |
---|
84 | #--CFC11eq we leave in pptv |
---|
85 | #--not used for CMIP6 |
---|
86 | GHG='CFC11eq' |
---|
87 | name='cfc11eq' |
---|
88 | namevar=${name} |
---|
89 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
90 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
91 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
92 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
93 | paste years.txt tmp.txt > ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
94 | |
---|
95 | #--CFC12eq we leave in pptv |
---|
96 | GHG='CFC12eq' |
---|
97 | name='cfc12eq' |
---|
98 | namevar=${name} |
---|
99 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
100 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
101 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
102 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
103 | paste years.txt tmp.txt > ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
104 | #--we will use CFC12eq for CMIP6 |
---|
105 | cp ${dirout}/${GHG}_${scenario}_2015_2500.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
106 | |
---|
107 | #--CFC11 we leave in pptv |
---|
108 | #--not used for CMIP6 |
---|
109 | GHG='CFC11' |
---|
110 | name='cfc11' |
---|
111 | namevar=${name} |
---|
112 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
113 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
114 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
115 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
116 | paste years.txt tmp.txt > ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
117 | |
---|
118 | #--CFC12 we leave in pptv |
---|
119 | #--not used for CMIP6 |
---|
120 | GHG='CFC12' |
---|
121 | name='cfc12' |
---|
122 | namevar=${name} |
---|
123 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
124 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
125 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
126 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
127 | paste years.txt tmp.txt > ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
128 | |
---|
129 | #--HFC134aeq we leave in pptv |
---|
130 | GHG='HFC134aeq' |
---|
131 | name='hfc134aeq' |
---|
132 | namevar=${name} |
---|
133 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
134 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
135 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt ${dirout}/CFC11eq_CMIP6_${scenario}_2015_2500.txt |
---|
136 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
137 | paste years.txt tmp.txt > ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
138 | #--HFC134a-eq converted to CFC11-eq for CMIP6 |
---|
139 | #--by multiplying by (0.0100/62.7)/(0.062/238)=0.6122344 |
---|
140 | cdo outputf,%12.4e,3 -mulc,0.6122344 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt |
---|
141 | paste years.txt tmp.txt > ${dirout}CFC11eq_CMIP6_${scenario}_2015_2500.txt |
---|
142 | |
---|
143 | done |
---|
144 | #--fin boucle sur scenarios |
---|
145 | |
---|
146 | #--clean up |
---|
147 | rm -f tmp.txt years.txt |
---|
148 | |
---|