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 | rep=${scenario}'/' |
---|
36 | |
---|
37 | if [ ${scenario} == 'ssp119' ] ; then prefixe='IMAGE' ; fi |
---|
38 | if [ ${scenario} == 'ssp126' ] ; then prefixe='IMAGE' ; fi |
---|
39 | if [ ${scenario} == 'ssp245' ] ; then prefixe='MESSAGE-GLOBIOM' ; fi |
---|
40 | if [ ${scenario} == 'ssp370' ] ; then prefixe='AIM' ; fi |
---|
41 | if [ ${scenario} == 'ssp434' ] ; then prefixe='GCAM4' ; fi |
---|
42 | if [ ${scenario} == 'ssp460' ] ; then prefixe='GCAM4' ; fi |
---|
43 | if [ ${scenario} == 'ssp534' ] ; then prefixe='REMIND-MAGPIE' ; fi |
---|
44 | if [ ${scenario} == 'ssp585' ] ; then prefixe='REMIND-MAGPIE' ; fi |
---|
45 | |
---|
46 | if [ ${scenario} == 'ssp119' ] ; then suffixe='' ; fi |
---|
47 | if [ ${scenario} == 'ssp126' ] ; then suffixe='' ; fi |
---|
48 | if [ ${scenario} == 'ssp245' ] ; then suffixe='' ; fi |
---|
49 | if [ ${scenario} == 'ssp370' ] ; then suffixe='' ; fi |
---|
50 | if [ ${scenario} == 'ssp434' ] ; then suffixe='' ; fi |
---|
51 | if [ ${scenario} == 'ssp460' ] ; then suffixe='' ; fi |
---|
52 | if [ ${scenario} == 'ssp534' ] ; then suffixe='over-' ; fi |
---|
53 | if [ ${scenario} == 'ssp585' ] ; then suffixe='' ; fi |
---|
54 | |
---|
55 | if [ ! -d ${dirout}${rep} ] ; then mkdir -p ${dirout}${rep} ; fi |
---|
56 | |
---|
57 | #--N2O we leave unit to ppb |
---|
58 | GHG='N2O' |
---|
59 | name='nitrous-oxide' |
---|
60 | namevar='nitrous_oxide' |
---|
61 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
62 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
63 | rm -f tmp.txt ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
64 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
65 | paste years.txt tmp.txt > ${dirout}${rep}${GHG}_CMIP6_2015_2500.txt |
---|
66 | |
---|
67 | #--CH4 here we leave unit in ppb |
---|
68 | GHG='CH4' |
---|
69 | name='methane' |
---|
70 | namevar='methane' |
---|
71 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
72 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
73 | rm -f tmp.txt ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
74 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
75 | paste years.txt tmp.txt > ${dirout}${rep}${GHG}_CMIP6_2015_2500.txt |
---|
76 | |
---|
77 | #--CO2 here we leave unit in ppm |
---|
78 | GHG='CO2' |
---|
79 | name='carbon-dioxide' |
---|
80 | namevar='carbon_dioxide' |
---|
81 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
82 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
83 | rm -f tmp.txt ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
84 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
85 | paste years.txt tmp.txt > ${dirout}${rep}${GHG}_CMIP6_2015_2500.txt |
---|
86 | |
---|
87 | #--CFC11eq we leave in pptv |
---|
88 | #--not used for CMIP6 |
---|
89 | GHG='CFC11eq' |
---|
90 | name='cfc11eq' |
---|
91 | namevar=${name} |
---|
92 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
93 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
94 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
95 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
96 | paste years.txt tmp.txt > ${dirout}${rep}${GHG}_2015_2500.txt |
---|
97 | |
---|
98 | #--CFC12eq we leave in pptv |
---|
99 | GHG='CFC12eq' |
---|
100 | name='cfc12eq' |
---|
101 | namevar=${name} |
---|
102 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
103 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
104 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
105 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
106 | paste years.txt tmp.txt > ${dirout}${rep}${GHG}_2015_2500.txt |
---|
107 | #--we will use CFC12eq for CMIP6 |
---|
108 | cp ${dirout}${rep}${GHG}_2015_2500.txt ${dirout}${rep}${GHG}_CMIP6_2015_2500.txt |
---|
109 | |
---|
110 | #--CFC11 we leave in pptv |
---|
111 | #--not used for CMIP6 |
---|
112 | GHG='CFC11' |
---|
113 | name='cfc11' |
---|
114 | namevar=${name} |
---|
115 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
116 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
117 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
118 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
119 | paste years.txt tmp.txt > ${dirout}${rep}${GHG}_2015_2500.txt |
---|
120 | |
---|
121 | #--CFC12 we leave in pptv |
---|
122 | #--not used for CMIP6 |
---|
123 | GHG='CFC12' |
---|
124 | name='cfc12' |
---|
125 | namevar=${name} |
---|
126 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
127 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
128 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt |
---|
129 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
130 | paste years.txt tmp.txt > ${dirout}${rep}${GHG}_2015_2500.txt |
---|
131 | |
---|
132 | #--HFC134aeq we leave in pptv |
---|
133 | GHG='HFC134aeq' |
---|
134 | name='hfc134aeq' |
---|
135 | namevar=${name} |
---|
136 | dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2} |
---|
137 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc' |
---|
138 | rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt ${dirout}/CFC11eq_CMIP6_${scenario}_2015_2500.txt |
---|
139 | cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
140 | paste years.txt tmp.txt > ${dirout}${rep}${GHG}_2015_2500.txt |
---|
141 | #--HFC134a-eq converted to CFC11-eq for CMIP6 |
---|
142 | #--by multiplying by (0.0100/62.7)/(0.062/238)=0.6122344 |
---|
143 | cdo outputf,%12.4e,3 -mulc,0.6122344 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt |
---|
144 | paste years.txt tmp.txt > ${dirout}${rep}CFC11eq_CMIP6_2015_2500.txt |
---|
145 | |
---|
146 | done |
---|
147 | #--fin boucle sur scenarios |
---|
148 | |
---|
149 | #--clean up |
---|
150 | rm -f tmp.txt years.txt |
---|
151 | |
---|