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