1 | # Script preparant les aerosols pour Scenarios |
---|
2 | # a partir des sorties de AER-ssp*** |
---|
3 | # en raccordant avec les redos -PATCH |
---|
4 | # sur les annees 2080 a 2100 |
---|
5 | # Th. Lurton IPSL oct. 2018 |
---|
6 | |
---|
7 | #!/bin/sh |
---|
8 | |
---|
9 | for ssp in ssp119 ssp126 ssp245 ssp370 ssp434 ssp460 ssp534-over ssp585 |
---|
10 | do |
---|
11 | |
---|
12 | newchemin=/ccc/store/cont003/gencmip6/lurtont/IGCM_OUT/LMDZORINCA/PROD/scenarioAER/AER-${ssp}-PATCH/CHM/Output/MO/ |
---|
13 | oldchemin=/ccc/store/cont003/gencmip6/lurtont/IGCM_OUT/LMDZORINCA/PROD/scenarioAER/AER-${ssp}/CHM/Output/MO/ |
---|
14 | # --- Target path above, to be customised as wanted |
---|
15 | workchemin=/ccc/work/cont003/gencmip6/lurtont/aerosols_from_inca/AER_for_Scenarios/${ssp}/ |
---|
16 | |
---|
17 | if [ ! -d ${workchemin} ] ; then mkdir -p ${workchemin} ; fi |
---|
18 | |
---|
19 | histchemin=/ccc/store/cont003/gencmip6/lurtont/IGCM_OUT/LMDZORINCA/PROD/historicalAER/LOI6012-histAER-partE/CHM/Output/MO/ |
---|
20 | |
---|
21 | for year in {2015..2100} |
---|
22 | do |
---|
23 | |
---|
24 | echo "******* Scenario "${ssp}" : je traite l'annee ${year} **********" |
---|
25 | |
---|
26 | # On effectue une moyenne glissante sur trois ans, centree en l'annee d'interet, et de poids [0.25 ; 0.5 ; 0.25]. |
---|
27 | # Pour 2015, on ira chercher le 2014 chez les AER-historicals. |
---|
28 | |
---|
29 | prec=$((${year}-1)) |
---|
30 | suiv=$((${year}+1)) |
---|
31 | |
---|
32 | # Adresses generiques des fichiers-sources |
---|
33 | if [ ${year} -lt 2079 ] |
---|
34 | then |
---|
35 | fileprec=${oldchemin}AER-${ssp}_${prec}0101_${prec}1230_1M_aerosols_from_inca.nc |
---|
36 | fileyear=${oldchemin}AER-${ssp}_${year}0101_${year}1230_1M_aerosols_from_inca.nc |
---|
37 | filesuiv=${oldchemin}AER-${ssp}_${suiv}0101_${suiv}1230_1M_aerosols_from_inca.nc |
---|
38 | fi |
---|
39 | if [ ${year} -gt 2080 ] |
---|
40 | then |
---|
41 | fileprec=${newchemin}AER-${ssp}-PATCH_${prec}0101_${prec}1230_1M_aerosols_from_inca.nc |
---|
42 | fileyear=${newchemin}AER-${ssp}-PATCH_${year}0101_${year}1230_1M_aerosols_from_inca.nc |
---|
43 | filesuiv=${newchemin}AER-${ssp}-PATCH_${suiv}0101_${suiv}1230_1M_aerosols_from_inca.nc |
---|
44 | fi |
---|
45 | |
---|
46 | # Override pour le cas 2015, vers le chemin de la simulation historical. |
---|
47 | if [ ${year} = 2015 ] |
---|
48 | then |
---|
49 | echo "On est en 2015, je vais chercher 2014 chez les historiques..." |
---|
50 | fileprec=${histchemin}LOI6012-histAER-partE_20140101_20141230_1M_aerosols_from_inca.nc |
---|
51 | fi |
---|
52 | |
---|
53 | # Overrides pour 2079 et 2080 : charniere entre runs ssp et runs ssp-PATCH. |
---|
54 | if [ ${year} = 2079 ] |
---|
55 | then |
---|
56 | echo "On est en 2079, je fais la charniere entre 2078 et 2079 du run "${ssp}" et 2080 du run "${ssp}"-PATCH." |
---|
57 | fileprec=${oldchemin}AER-${ssp}_${prec}0101_${prec}1230_1M_aerosols_from_inca.nc |
---|
58 | fileyear=${oldchemin}AER-${ssp}_${year}0101_${year}1230_1M_aerosols_from_inca.nc |
---|
59 | filesuiv=${newchemin}AER-${ssp}-PATCH_${suiv}0101_${suiv}1230_1M_aerosols_from_inca.nc |
---|
60 | fi |
---|
61 | if [ ${year} = 2080 ] |
---|
62 | then |
---|
63 | echo "On est en 2080, je fais la charniere entre 2079 du run "${ssp}" et 2080 et 2081 du run "${ssp}"-PATCH." |
---|
64 | fileprec=${oldchemin}AER-${ssp}_${prec}0101_${prec}1230_1M_aerosols_from_inca.nc |
---|
65 | fileyear=${newchemin}AER-${ssp}-PATCH_${year}0101_${year}1230_1M_aerosols_from_inca.nc |
---|
66 | filesuiv=${newchemin}AER-${ssp}-PATCH_${suiv}0101_${suiv}1230_1M_aerosols_from_inca.nc |
---|
67 | fi |
---|
68 | |
---|
69 | # Override pour le cas 2100 : duplicata de 2100 pour 2101. |
---|
70 | if [ ${year} = 2100 ] |
---|
71 | then |
---|
72 | echo "On est en 2100, je prends donc 2100 aussi pour 2101." |
---|
73 | filesuiv=${newchemin}AER-${ssp}-PATCH_${year}0101_${year}1230_1M_aerosols_from_inca.nc |
---|
74 | fi |
---|
75 | |
---|
76 | # Fichiers temporaires avec ponderation (cas generique). |
---|
77 | pondprec=${workchemin}AER-${ssp}_${prec}0101_${prec}1230_pond.nc |
---|
78 | pondyear=${workchemin}AER-${ssp}_${year}0101_${year}1230_pond.nc |
---|
79 | pondsuiv=${workchemin}AER-${ssp}_${suiv}0101_${suiv}1230_pond.nc |
---|
80 | |
---|
81 | # Pondération des trois années successives par 1/4 ; 1/2 ; 1/4 ] |
---|
82 | # et multiplication par un facteur 3 qui disparaitra lors de la moyenne. |
---|
83 | cdo mulc,.75 ${fileprec} ${pondprec} |
---|
84 | cdo mulc,1.5 ${fileyear} ${pondyear} |
---|
85 | cdo mulc,.75 ${filesuiv} ${pondsuiv} |
---|
86 | |
---|
87 | # Fichier recevant trois ans consecutifs |
---|
88 | pondtroisans=${workchemin}aerosols_${prec}0101_${suiv}1230_pond.nc |
---|
89 | |
---|
90 | cdo mergetime ${pondprec} ${pondyear} ${pondsuiv} ${pondtroisans} |
---|
91 | rm -f ${pondprec} ${pondyear} ${pondsuiv} |
---|
92 | |
---|
93 | fileout=${workchemin}aerosols${year}_from_inca.nc |
---|
94 | |
---|
95 | # Moyenne sur les trois ans, par mois |
---|
96 | cdo ymonmean ${pondtroisans} ${fileout} |
---|
97 | rm -f ${pondtroisans} |
---|
98 | |
---|
99 | # Fix du vecteur-temps |
---|
100 | ncks -A -v time_counter,time_centered,time_counter_bounds,time_centered_bounds ${fileyear} ${fileout} |
---|
101 | |
---|
102 | # Fin de boucle sur les annees |
---|
103 | done |
---|
104 | |
---|
105 | # Fin de boucle sur ssp's |
---|
106 | done |
---|