1 | #--Update Th.Lurton 05/02/2018 for paths to new version |
---|
2 | # ** species-directory take hyphens instead of underscores previously; |
---|
3 | # ** likewise for species names within filenames; |
---|
4 | # ** variable names stay with underscores. |
---|
5 | |
---|
6 | #--v3 of my script to extract global mean and put to IGCM format |
---|
7 | |
---|
8 | #--according to Malte Meinsheausen two options are possible |
---|
9 | # CFC11=CFC11eq and CCFC12=CFC12 |
---|
10 | # or CFC11=HFC134a-eq * (0.0100/62.7)/(0.062/238) [values from AR5] and CFC12=CFC12eq |
---|
11 | # in the second case the HFC134a-eq is converted into CFC11eq using RF efficiencies from AR5 in Wm-2pptv-1 |
---|
12 | |
---|
13 | #--11/10/2016 New format for the data, now global, NH and SH means are in a sector dimension |
---|
14 | #--hence I parse the first value from the cdo outputf to get the global mean |
---|
15 | #--outputf is used with format %12.4e to make sure there is a space between values and 3 values per line |
---|
16 | |
---|
17 | scenario='ssp126' |
---|
18 | |
---|
19 | #--dir for annual mean data |
---|
20 | dirin1='/prodigfs/project/input4MIPs/CMIP6/ScenarioMIP/UoM/UoM-'${scenario}'-1-1-0/atmos/yr/multiple/' |
---|
21 | dirin2='gr1/v20180503' |
---|
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 'ssp126' |
---|
33 | do |
---|
34 | |
---|
35 | #--N2O we leave unit to ppb |
---|
36 | GHG='N2O' |
---|
37 | name='nitrous-oxide' |
---|
38 | namevar='nitrous_oxide' |
---|
39 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc' |
---|
40 | rm -f tmp.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
41 | dirin=${dirin1}${dirin2} |
---|
42 | cdo outputf,%12.4e,3 -selvar,${namevar}'_GM' ${dirin}/${file} > tmp.txt |
---|
43 | paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
44 | |
---|
45 | #--CH4 here we leave unit in ppb |
---|
46 | GHG='CH4' |
---|
47 | name='methane' |
---|
48 | namevar='methane' |
---|
49 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc' |
---|
50 | dirin=${dirin1}${dirin2} |
---|
51 | rm -f tmp.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
52 | cdo outputf,%12.4e,3 -selvar,${namevar}'_GM' ${dirin}/${file} > tmp.txt |
---|
53 | paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
54 | |
---|
55 | #--CO2 here we leave unit in ppm |
---|
56 | GHG='CO2' |
---|
57 | name='carbon-dioxide' |
---|
58 | namevar='carbon_dioxide' |
---|
59 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc' |
---|
60 | dirin=${dirin1}${dirin2} |
---|
61 | rm -f tmp.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
62 | cdo outputf,%12.4e,3 -selvar,${namevar}'_GM' ${dirin}/${file} > tmp.txt |
---|
63 | paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
64 | |
---|
65 | #--CFC11eq we leave in en pptv |
---|
66 | #--not used for CMIP6 |
---|
67 | GHG='CFC11eq' |
---|
68 | name='cfc11eq' |
---|
69 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc' |
---|
70 | dirin=${dirin1}${dirin2} |
---|
71 | rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt |
---|
72 | cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt |
---|
73 | paste years.txt tmp.txt > ${dirout}/${GHG}_${scenario}_2015_2500.txt |
---|
74 | |
---|
75 | #--CFC12eq we leave in en pptv |
---|
76 | GHG='CFC12eq' |
---|
77 | name='cfc12eq' |
---|
78 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc' |
---|
79 | dirin=${dirin1}${dirin2} |
---|
80 | rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
81 | cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt |
---|
82 | paste years.txt tmp.txt > ${dirout}/${GHG}_${scenario}_2015_2500.txt |
---|
83 | #--we will use CFC12eq for CMIP6 |
---|
84 | cp ${dirout}/${GHG}_${scenario}_2015_2500.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt |
---|
85 | |
---|
86 | #--CFC11 we leave in en pptv |
---|
87 | #--not used for CMIP6 |
---|
88 | GHG='CFC11' |
---|
89 | name='cfc11' |
---|
90 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc' |
---|
91 | dirin=${dirin1}${dirin2} |
---|
92 | rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt |
---|
93 | cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt |
---|
94 | paste years.txt tmp.txt > ${dirout}/${GHG}_${scenario}_2015_2500.txt |
---|
95 | |
---|
96 | #--CFC12 we leave in en pptv |
---|
97 | #--not used for CMIP6 |
---|
98 | GHG='CFC12' |
---|
99 | name='cfc12' |
---|
100 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc' |
---|
101 | dirin=${dirin1}${dirin2} |
---|
102 | rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt |
---|
103 | cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt |
---|
104 | paste years.txt tmp.txt > ${dirout}/${GHG}_${scenario}_2015_2500.txt |
---|
105 | |
---|
106 | #--HFC134aeq we leave in en pptv |
---|
107 | GHG='HFC134aeq' |
---|
108 | name='hfc134aeq' |
---|
109 | file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc' |
---|
110 | dirin=${dirin1}${dirin2} |
---|
111 | rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt ${dirout}/CFC11eq_CMIP6_${scenario}_2015_2500.txt |
---|
112 | cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt |
---|
113 | paste years.txt tmp.txt > ${dirout}/${GHG}_${scenario}_2015_2500.txt |
---|
114 | #--HFC134a-eq converted to CFC11-eq for CMIP6 |
---|
115 | #--by multiplying by (0.0100/62.7)/(0.062/238)=0.6122344 |
---|
116 | cdo outputf,%12.4e,3 -mulc,0.6122344 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt |
---|
117 | paste years.txt tmp.txt > ${dirout}/CFC11eq_CMIP6_${scenario}_2015_2500.txt |
---|
118 | |
---|
119 | done |
---|
120 | #--fin boucle scenario |
---|
121 | |
---|
122 | #--clean up |
---|
123 | rm -f tmp.txt years.txt |
---|
124 | |
---|