source: TOOLS/CMIP6_FORCING/SCENARIOS/RCP_to_ssp_SSTSIC.sh @ 5920

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

A few scripts to generate oxidant files and SST/SIC files for the scenarios.

  • Property svn:executable set to *
File size: 7.8 KB
Line 
1#--Weights on RCPs to yield ssp limit files.
2#--This script requires output from script SST_SIC_anomaly.sh.
3#--Th. Lurton, IPSL, 07/2018.
4
5# ssp1-19 = 19/26*RCP26
6# ssp1-26 = RCP26
7# ssp2-45 = RCP45
8# ssp3-70 = .4*RCP85 + .6*RCP60
9# ssp4-34 = 8/19*RCP45 + 11/19*RCP26
10# ssp4-60 = .6*RCP60 + .4*RCP45
11# ssp5-34-over = 8/19*RCP45 + 11/19*RCP26
12# ssp5-85 = RCP85
13
14if [ ! -d ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp119 ] ; then mkdir -p ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp119 ; fi
15if [ ! -d ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp126 ] ; then mkdir -p ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp126 ; fi
16if [ ! -d ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp245 ] ; then mkdir -p ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp245 ; fi
17if [ ! -d ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp370 ] ; then mkdir -p ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp370 ; fi
18if [ ! -d ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp434 ] ; then mkdir -p ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp434 ; fi
19if [ ! -d ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp460 ] ; then mkdir -p ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp460 ; fi
20if [ ! -d ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp534-over ] ; then mkdir -p ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp534-over ; fi
21if [ ! -d ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp585 ] ; then mkdir -p ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp585 ; fi
22
23#--We need specific data for the ssp119 ponderation, which will be refered to as RCP0
24fileSSTAMIP=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/AMIP/tos_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-4_gn_187001-201712.nc
25fileSICAMIP=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/AMIP/siconc_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-4_gn_187001-201712.nc
26gridfile=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/GRID/grid_MR_CMIP5
27#--For SST
28cdo ymonmean -seldate,2006-01-01,2017-12-31 ${fileSSTAMIP} ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc
29cdo addc,273.15 -selvar,tos ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp1.nc
30cdo remapcon,${gridfile} ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp1.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp2.nc
31ncrename -v tos,tsol_oce ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp2.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/SST_RCP0.nc
32rm -f ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp1.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp2.nc
33#--For SIC
34cdo ymonmean -seldate,2006-01-01,2017-12-31 ${fileSICAMIP} ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc
35cdo remapcon,${gridfile} ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp1.nc
36ncrename -v siconc,pourc_sic ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp1.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp2.nc
37cdo ymonmean -seldate,2006-01-01,2017-12-31 ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/rcp26/v5.rcp26MR1_20060101_21001231_1M_pourc_lic.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc
38ncrename -v pourc_lic,pourc_sic ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/lic_RCP0.nc
39cdo sub ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp2.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/lic_RCP0.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp3.nc
40ncap2 -s 'where(pourc_sic>100.) pourc_sic=100;' ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp3.nc -O ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc
41ncap2 -s 'where(pourc_sic<0.) pourc_sic=0;' ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/SIC_RCP0.nc
42rm -f ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp1.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp2.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/tmp3.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/lic_RCP0.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/SSTAMIP.nc ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/SICAMIP.nc
43
44for year in {2015..2100}
45do
46
47fileSSTRCP26=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/Scenarios/rcp26/OUT_anocorr/v5.rcp26MR1_tsol_oce_${year}_anocorr.nc
48fileSSTRCP45=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/Scenarios/rcp45/OUT_anocorr/v5.rcp45MR1_tsol_oce_${year}_anocorr.nc
49fileSSTRCP60=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/Scenarios/rcp60/OUT_anocorr/v5.rcp60MR1_tsol_oce_${year}_anocorr.nc
50fileSSTRCP85=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/Scenarios/rcp85/OUT_anocorr/v5.rcp85MR1_tsol_oce_${year}_anocorr.nc
51
52fileSICRCP26=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/Scenarios/rcp26/OUT_anocorr/v5.rcp26MR1_pourc_sic_${year}_anocorr.nc
53fileSICRCP45=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/Scenarios/rcp45/OUT_anocorr/v5.rcp45MR1_pourc_sic_${year}_anocorr.nc
54fileSICRCP60=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/Scenarios/rcp60/OUT_anocorr/v5.rcp60MR1_pourc_sic_${year}_anocorr.nc
55fileSICRCP85=/ccc/work/cont003/gencmip6/lurtont/CMIP6_LIMIT/Scenarios/rcp85/OUT_anocorr/v5.rcp85MR1_pourc_sic_${year}_anocorr.nc
56
57outSSTssp119=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp119/tsol_oce_ssp119_${year}.nc
58outSSTssp126=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp126/tsol_oce_ssp126_${year}.nc
59outSSTssp245=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp245/tsol_oce_ssp245_${year}.nc
60outSSTssp370=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp370/tsol_oce_ssp370_${year}.nc
61outSSTssp434=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp434/tsol_oce_ssp434_${year}.nc
62outSSTssp460=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp460/tsol_oce_ssp460_${year}.nc
63outSSTssp534=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp534-over/tsol_oce_ssp534-over_${year}.nc
64outSSTssp585=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp585/tsol_oce_ssp585_${year}.nc
65
66outSICssp119=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp119/pourc_sic_ssp119_${year}.nc
67outSICssp126=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp126/pourc_sic_ssp126_${year}.nc
68outSICssp245=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp245/pourc_sic_ssp245_${year}.nc
69outSICssp370=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp370/pourc_sic_ssp370_${year}.nc
70outSICssp434=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp434/pourc_sic_ssp434_${year}.nc
71outSICssp460=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp460/pourc_sic_ssp460_${year}.nc
72outSICssp534=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp534-over/pourc_sic_ssp534-over_${year}.nc
73outSICssp585=${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/Scenarios/ssp585/pourc_sic_ssp585_${year}.nc
74
75cdo -L add -mulc,19. -divc,26. -selname,tsol_oce ${fileSSTRCP26} -mulc,7. -divc,26. -selname,tsol_oce ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/SST_RCP0.nc ${outSSTssp119}
76cp ${fileSSTRCP26} ${outSSTssp126}
77cp ${fileSSTRCP45} ${outSSTssp245}
78cdo -L add -mulc,.4 -selname,tsol_oce ${fileSSTRCP85} -mulc,.6 -selname,tsol_oce ${fileSSTRCP60} ${outSSTssp370} 
79cdo -L add -mulc,8. -divc,19. -selname,tsol_oce ${fileSSTRCP45} -mulc,11. -divc,19. -selname,tsol_oce ${fileSSTRCP26} ${outSSTssp434} 
80cdo -L add -mulc,.6 -selname,tsol_oce ${fileSSTRCP60} -mulc,.4 -selname,tsol_oce ${fileSSTRCP45} ${outSSTssp460}
81cdo -L add -mulc,8. -divc,19. -selname,tsol_oce ${fileSSTRCP45} -mulc,11. -divc,19. -selname,tsol_oce ${fileSSTRCP26} ${outSSTssp534}
82cp ${fileSSTRCP85} ${outSSTssp585}
83
84cdo -L add -mulc,19. -divc,26. -selname,pourc_sic ${fileSICRCP26} -mulc,7. -divc,26. -selname,pourc_sic ${GENCMIP6_CCCWORKDIR}/CMIP6_LIMIT/SIC_RCP0.nc ${outSICssp119}
85cp ${fileSICRCP26} ${outSICssp126}
86cp ${fileSICRCP45} ${outSICssp245}
87cdo -L add -mulc,.4 -selname,pourc_sic ${fileSICRCP85} -mulc,.6 -selname,pourc_sic ${fileSICRCP60} ${outSICssp370}
88cdo -L add -mulc,8. -divc,19. -selname,pourc_sic ${fileSICRCP45} -mulc,11. -divc,19. -selname,pourc_sic ${fileSICRCP26} ${outSICssp434}
89cdo -L add -mulc,.6 -selname,pourc_sic ${fileSICRCP60} -mulc,.4 -selname,pourc_sic ${fileSICRCP45} ${outSICssp460}
90cdo -L add -mulc,8. -divc,19. -selname,pourc_sic ${fileSICRCP45} -mulc,11. -divc,19. -selname,pourc_sic ${fileSICRCP26} ${outSICssp534}
91cp ${fileSICRCP85} ${outSICssp585}
92
93#--end loop on years
94done
Note: See TracBrowser for help on using the repository browser.