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

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

Change of two variable names (_ instead of -)

  • Property svn:executable set to *
File size: 5.3 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
17#--dir for annual mean data
18dirin1='/prodigfs/project/input4MIPs/CMIP6/CMIP/UoM/UoM-CMIP-1-2-0/atmos/yr/'
19dirin2='gr1-GMNHSH/v20160830'
20#--dirin2 versioning date is different from previously
21
22dirout='./OUTPUT'
23if [ ! -d ${dirout} ] ; then mkdir ${dirout} ; fi
24
25rm -f years.txt
26for i in `seq -w 0 2014`
27do
28echo 'Annee_'$i'=' >> years.txt
29done
30
31#--N2O we leave unit to ppb
32GHG='N2O'
33name='nitrous-oxide'
34namevar='nitrous_oxide'
35file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
36rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
37dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
38cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
39paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt
40
41#--CH4 here we leave unit in ppb
42GHG='CH4'
43name='methane'
44namevar='methane'
45file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
46dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
47rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
48cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
49paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt
50
51#--CO2 here we leave unit in ppm
52GHG='CO2'
53name='carbon-dioxide'
54namevar='carbon_dioxide'
55file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
56dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
57rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
58cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${namevar}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
59paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt
60
61#--CFC11eq we leave in en pptv
62#--not used for CMIP6
63GHG='CFC11eq'
64name='cfc11eq'
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
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
71#--CFC12eq we leave in en pptv
72GHG='CFC12eq'
73name='cfc12eq'
74file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
75dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
76rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
77cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
78paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
79#--we will use CFC12eq for CMIP6
80cp ${dirout}/${GHG}_0000_2014.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
81
82#--CFC11 we leave in en pptv
83#--not used for CMIP6
84GHG='CFC11'
85name='cfc11'
86file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
87dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
88rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt
89cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
90paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
91
92#--CFC12 we leave in en pptv
93#--not used for CMIP6
94GHG='CFC12'
95name='cfc12'
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
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
102#--HFC134aeq we leave in en pptv
103GHG='HFC134aeq'
104name='hfc134aeq'
105file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
106dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
107rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt ${dirout}/CFC11eq_CMIP6_0000_2014.txt
108cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
109paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
110#--HFC134a-eq converted to CFC11-eq for CMIP6
111#--by multiplying by (0.0100/62.7)/(0.062/238)=0.6122344
112cdo outputf,%12.4e,3 -mulc,0.6122344 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
113paste years.txt tmp.txt > ${dirout}/CFC11eq_CMIP6_0000_2014.txt
114
115#--clean up
116rm -f tmp.txt years.txt
Note: See TracBrowser for help on using the repository browser.