source: TOOLS/CMIP6_FORCING/GHG/extract_scenario.sh @ 4226

Last change on this file since 4226 was 3834, checked in by oboucher, 6 years ago

script for SSP scenarios

  • Property svn:executable set to *
File size: 5.1 KB
Line 
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
17scenario='ssp126'
18
19#--dir for annual mean data
20dirin1='/prodigfs/project/input4MIPs/CMIP6/ScenarioMIP/UoM/UoM-'${scenario}'-1-1-0/atmos/yr/multiple/'
21dirin2='gr1/v20180503'
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 'ssp126'
33do
34
35#--N2O we leave unit to ppb
36GHG='N2O'
37name='nitrous-oxide'
38namevar='nitrous_oxide'
39file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc'
40rm -f tmp.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt
41dirin=${dirin1}${dirin2}
42cdo outputf,%12.4e,3 -selvar,${namevar}'_GM' ${dirin}/${file} > tmp.txt
43paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt
44
45#--CH4 here we leave unit in ppb
46GHG='CH4'
47name='methane'
48namevar='methane'
49file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc'
50dirin=${dirin1}${dirin2}
51rm -f tmp.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt
52cdo outputf,%12.4e,3 -selvar,${namevar}'_GM' ${dirin}/${file} > tmp.txt
53paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt
54
55#--CO2 here we leave unit in ppm
56GHG='CO2'
57name='carbon-dioxide'
58namevar='carbon_dioxide'
59file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc'
60dirin=${dirin1}${dirin2}
61rm -f tmp.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt
62cdo outputf,%12.4e,3 -selvar,${namevar}'_GM' ${dirin}/${file} > tmp.txt
63paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt
64
65#--CFC11eq we leave in en pptv
66#--not used for CMIP6
67GHG='CFC11eq'
68name='cfc11eq'
69file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc'
70dirin=${dirin1}${dirin2}
71rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt
72cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt
73paste years.txt tmp.txt > ${dirout}/${GHG}_${scenario}_2015_2500.txt
74
75#--CFC12eq we leave in en pptv
76GHG='CFC12eq'
77name='cfc12eq'
78file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc'
79dirin=${dirin1}${dirin2}
80rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt ${dirout}/${GHG}_CMIP6_${scenario}_2015_2500.txt
81cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt
82paste years.txt tmp.txt > ${dirout}/${GHG}_${scenario}_2015_2500.txt
83#--we will use CFC12eq for CMIP6
84cp ${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
88GHG='CFC11'
89name='cfc11'
90file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc'
91dirin=${dirin1}${dirin2}
92rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt
93cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt
94paste years.txt tmp.txt > ${dirout}/${GHG}_${scenario}_2015_2500.txt
95
96#--CFC12 we leave in en pptv
97#--not used for CMIP6
98GHG='CFC12'
99name='cfc12'
100file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc'
101dirin=${dirin1}${dirin2}
102rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt
103cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt
104paste years.txt tmp.txt > ${dirout}/${GHG}_${scenario}_2015_2500.txt
105
106#--HFC134aeq we leave in en pptv
107GHG='HFC134aeq'
108name='hfc134aeq'
109file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-'${scenario}'-1-1-0_gr1-GMNHSH_2015-2500.nc'
110dirin=${dirin1}${dirin2}
111rm -f tmp.txt ${dirout}/${GHG}_${scenario}_2015_2500.txt ${dirout}/CFC11eq_CMIP6_${scenario}_2015_2500.txt
112cdo outputf,%12.4e,3 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt
113paste 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
116cdo outputf,%12.4e,3 -mulc,0.6122344 -selvar,${name}'_GM' ${dirin}/${file} > tmp.txt
117paste years.txt tmp.txt > ${dirout}/CFC11eq_CMIP6_${scenario}_2015_2500.txt
118
119done
120#--fin boucle scenario
121
122#--clean up
123rm -f tmp.txt years.txt
124
Note: See TracBrowser for help on using the repository browser.