source: TOOLS/CMIP6_FORCING/GHG/extract.sh @ 3386

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

Uploading scripts to produce the GHG forcing files for CMIP6

  • Property svn:executable set to *
File size: 5.0 KB
Line 
1#--v3 of my script to extract global mean and put to IGCM format
2
3#--according to Malte Meinsheausen two options are possible
4#    CFC11=CFC11eq and CCFC12=CFC12
5# or CFC11=HFC134a-eq * (0.0100/62.7)/(0.062/238) [values from AR5] and CFC12=CFC12eq
6# in the second case the HFC134a-eq is converted into CFC11eq using RF efficiencies from AR5 in Wm-2pptv-1
7
8#--11/10/2016 New format for the data, now global, NH and SH means are in a sector dimension
9#--hence I parse the first value from the cdo outputf to get the global mean
10#--outputf is used with format %12.4e to make sure there is a space between values and 3 values per line
11
12#--dir for annual mean data
13dirin1='/prodigfs/project/input4MIPs/UoM/GHGConcentrations/CMIP/UoM-CMIP-1-2-0/yr/'
14dirin2='gr1-GMNHSH/v20160902'
15
16dirout='./OUTPUT'
17if [ ! -d ${dirout} ] ; then mkdir ${dirout} ; fi
18
19rm -f years.txt
20for i in `seq -w 0 2014`
21do
22echo 'Annee_'$i'=' >> years.txt
23done
24
25#--N2O we leave unit to ppb
26GHG='N2O'
27name='nitrous_oxide'
28file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
29rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
30dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2}
31cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
32paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt
33
34#--CH4 here we leave unit in ppb
35GHG='CH4'
36name='methane'
37file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
38dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2}
39rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
40cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
41paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt
42
43#--CO2 here we leave unit in ppm
44GHG='CO2'
45name='carbon_dioxide'
46file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
47dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2}
48rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
49cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
50paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt
51
52#--CFC11eq we leave in en pptv
53#--not used for CMIP6
54GHG='CFC11eq'
55name='cfc11eq'
56file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
57dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2}
58rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt
59cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
60paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
61
62#--CFC12eq we leave in en pptv
63GHG='CFC12eq'
64name='cfc12eq'
65file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
66dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2}
67rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
68cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
69paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
70#--we will use CFC12eq for CMIP6
71cp ${dirout}/${GHG}_0000_2014.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
72
73#--CFC11 we leave in en pptv
74#--not used for CMIP6
75GHG='CFC11'
76name='cfc11'
77file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
78dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2}
79rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt
80cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
81paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
82
83#--CFC12 we leave in en pptv
84#--not used for CMIP6
85GHG='CFC12'
86name='cfc12'
87file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
88dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2}
89rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt
90cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
91paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
92
93#--HFC134aeq we leave in en pptv
94GHG='HFC134aeq'
95name='hfc134aeq'
96file='mole_fraction_of_'${name}'_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
97dirin=${dirin1}'mole_fraction_of_'${name}'_in_air/'${dirin2}
98rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt ${dirout}/CFC11eq_CMIP6_0000_2014.txt
99cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
100paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
101#--HFC134a-eq converted to CFC11-eq for CMIP6
102#--by multiplying by (0.0100/62.7)/(0.062/238)=0.6122344
103cdo outputf,%12.4e,3 -mulc,0.6122344 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
104paste years.txt tmp.txt > ${dirout}/CFC11eq_CMIP6_0000_2014.txt
105
106#--clean up
107rm -f tmp.txt years.txt
Note: See TracBrowser for help on using the repository browser.