source: TOOLS/CMIP6_FORCING/GHG/extract_scenario_v.1.2.0.sh @ 3926

Last change on this file since 3926 was 3926, checked in by tlurton, 6 years ago

Added script to generate scenario GHG files, updated to handle v.1.2.0 of data.

  • Property svn:executable set to *
File size: 7.5 KB
Line 
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
20dirin1='/prodigfs/project/input4MIPs/CMIP6/ScenarioMIP/UoM/'
21dirin2='gr1-GMNHSH/v20180611/'
22
23dirout='./OUTPUT/'
24if [ ! -d ${dirout} ] ; then mkdir ${dirout} ; fi
25
26rm -f years.txt
27for i in `seq -w 2015 2500`
28do
29echo 'Annee_'$i'=' >> years.txt
30done
31
32for scenario in 'ssp119' 'ssp126' 'ssp245' 'ssp370' 'ssp434' 'ssp460' 'ssp534' 'ssp585'
33do
34
35if [ ${scenario} == 'ssp119' ] ; then prefixe='IMAGE' ; fi
36if [ ${scenario} == 'ssp126' ] ; then prefixe='IMAGE' ; fi
37if [ ${scenario} == 'ssp245' ] ; then prefixe='MESSAGE-GLOBIOM' ; fi
38if [ ${scenario} == 'ssp370' ] ; then prefixe='AIM' ; fi
39if [ ${scenario} == 'ssp434' ] ; then prefixe='GCAM4' ; fi
40if [ ${scenario} == 'ssp460' ] ; then prefixe='GCAM4' ; fi
41if [ ${scenario} == 'ssp534' ] ; then prefixe='REMIND-MAGPIE' ; fi
42if [ ${scenario} == 'ssp585' ] ; then prefixe='REMIND-MAGPIE' ; fi
43
44if [ ${scenario} == 'ssp119' ] ; then suffixe='' ; fi
45if [ ${scenario} == 'ssp126' ] ; then suffixe='' ; fi
46if [ ${scenario} == 'ssp245' ] ; then suffixe='' ; fi
47if [ ${scenario} == 'ssp370' ] ; then suffixe='' ; fi
48if [ ${scenario} == 'ssp434' ] ; then suffixe='' ; fi
49if [ ${scenario} == 'ssp460' ] ; then suffixe='' ; fi
50if [ ${scenario} == 'ssp534' ] ; then suffixe='over-' ; fi
51if [ ${scenario} == 'ssp585' ] ; then suffixe='' ; fi
52
53
54#--N2O we leave unit to ppb
55GHG='N2O'
56name='nitrous-oxide'
57namevar='nitrous_oxide'
58dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2}
59file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc'
60rm -f tmp.txt ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt
61cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt
62paste years.txt tmp.txt > ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt
63
64#--CH4 here we leave unit in ppb
65GHG='CH4'
66name='methane'
67namevar='methane'
68dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2}
69file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc'
70rm -f tmp.txt ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt
71cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt
72paste years.txt tmp.txt > ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt
73
74#--CO2 here we leave unit in ppm
75GHG='CO2'
76name='carbon-dioxide'
77namevar='carbon_dioxide'
78dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2}
79file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc'
80rm -f tmp.txt ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt
81cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt
82paste years.txt tmp.txt > ${dirout}${GHG}_CMIP6_${scenario}_2015_2500.txt
83
84#--CFC11eq we leave in pptv
85#--not used for CMIP6
86GHG='CFC11eq'
87name='cfc11eq'
88namevar=${name}
89dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2}
90file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc'
91rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt
92cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt
93paste years.txt tmp.txt > ${dirout}${GHG}_${scenario}_2015_2500.txt
94
95#--CFC12eq we leave in pptv
96GHG='CFC12eq'
97name='cfc12eq'
98namevar=${name}
99dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2}
100file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc'
101rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt
102cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt
103paste years.txt tmp.txt > ${dirout}${GHG}_${scenario}_2015_2500.txt
104#--we will use CFC12eq for CMIP6
105cp ${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
109GHG='CFC11'
110name='cfc11'
111namevar=${name}
112dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2}
113file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc'
114rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt
115cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt
116paste years.txt tmp.txt > ${dirout}${GHG}_${scenario}_2015_2500.txt
117
118#--CFC12 we leave in pptv
119#--not used for CMIP6
120GHG='CFC12'
121name='cfc12'
122namevar=${name}
123dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2}
124file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc'
125rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt
126cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt
127paste years.txt tmp.txt > ${dirout}${GHG}_${scenario}_2015_2500.txt
128
129#--HFC134aeq we leave in pptv
130GHG='HFC134aeq'
131name='hfc134aeq'
132namevar=${name}
133dirin=${dirin1}'UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0/atmos/yr/mole_fraction_of_'${namevar}'_in_air/'${dirin2}
134file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${prefixe}'-'${scenario}'-'${suffixe}'1-2-0_gr1-GMNHSH_2015-2500.nc'
135rm -f tmp.txt ${dirout}${GHG}_${scenario}_2015_2500.txt ${dirout}/CFC11eq_CMIP6_${scenario}_2015_2500.txt
136cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}${file} | awk '{print $1}' > tmp.txt
137paste 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
140cdo outputf,%12.4e,3 -mulc,0.6122344 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
141paste years.txt tmp.txt > ${dirout}CFC11eq_CMIP6_${scenario}_2015_2500.txt
142
143done
144#--fin boucle sur scenarios
145
146#--clean up
147rm -f tmp.txt years.txt
148
Note: See TracBrowser for help on using the repository browser.