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

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

20/02/2018 Th. Lurton
Updated paths to final location of input files on Ciclad: /prodigfs/project/input4MIPs/.

  • 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'
34file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
35rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
36dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
37cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
38paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt
39
40#--CH4 here we leave unit in ppb
41GHG='CH4'
42name='methane'
43file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
44dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
45rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
46cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
47paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt
48
49#--CO2 here we leave unit in ppm
50GHG='CO2'
51name='carbon-dioxide'
52file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
53dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
54rm -f tmp.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
55cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
56paste years.txt tmp.txt > ${dirout}/${GHG}_CMIP6_0000_2014.txt
57
58#--CFC11eq we leave in en pptv
59#--not used for CMIP6
60GHG='CFC11eq'
61name='cfc11eq'
62file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
63dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
64rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt
65cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
66paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
67
68#--CFC12eq we leave in en pptv
69GHG='CFC12eq'
70name='cfc12eq'
71file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
72dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
73rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
74cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
75paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
76#--we will use CFC12eq for CMIP6
77cp ${dirout}/${GHG}_0000_2014.txt ${dirout}/${GHG}_CMIP6_0000_2014.txt
78
79#--CFC11 we leave in en pptv
80#--not used for CMIP6
81GHG='CFC11'
82name='cfc11'
83file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
84dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
85rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt
86cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
87paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
88
89#--CFC12 we leave in en pptv
90#--not used for CMIP6
91GHG='CFC12'
92name='cfc12'
93file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
94dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
95rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt
96cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
97paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
98
99#--HFC134aeq we leave in en pptv
100GHG='HFC134aeq'
101name='hfc134aeq'
102file='mole-fraction-of-'${name}'-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc'
103dirin=${dirin1}'mole-fraction-of-'${name}'-in-air/'${dirin2}
104rm -f tmp.txt ${dirout}/${GHG}_0000_2014.txt ${dirout}/CFC11eq_CMIP6_0000_2014.txt
105cdo outputf,%12.4e,3 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
106paste years.txt tmp.txt > ${dirout}/${GHG}_0000_2014.txt
107#--HFC134a-eq converted to CFC11-eq for CMIP6
108#--by multiplying by (0.0100/62.7)/(0.062/238)=0.6122344
109cdo outputf,%12.4e,3 -mulc,0.6122344 -selvar,'mole_fraction_of_'${name}'_in_air' ${dirin}/${file} | awk '{print $1}' > tmp.txt
110paste years.txt tmp.txt > ${dirout}/CFC11eq_CMIP6_0000_2014.txt
111
112#--clean up
113rm -f tmp.txt years.txt
Note: See TracBrowser for help on using the repository browser.