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