[4993] | 1 | #!/bin/bash |
---|
| 2 | set -vx |
---|
| 3 | |
---|
[6059] | 4 | # Script that prepares the PCMDI-AMIP-1-1-7 files to be read by ce0l in LMDZ. |
---|
| 5 | # These new files are stored in IGCM/ATM/LIMIT/AMIP.v20220201/original |
---|
[4993] | 6 | # and can be used to produce limit.nc files on model grid. |
---|
[6059] | 7 | # The input files from input4MIPs should be copied before launching this script. See comments in section 0). |
---|
| 8 | # |
---|
| 9 | # Use previous revision 5011 of this script for preparing version PCMDI-AMIP-1-1-6 files. |
---|
[4993] | 10 | # Done by J. Ghattas, 2020/03/03 |
---|
| 11 | |
---|
[6059] | 12 | dirold=`pwd`/original/360x180.orig |
---|
| 13 | dirnew=`pwd`/original/360x180.new |
---|
[4993] | 14 | |
---|
| 15 | # 0) Copy original files from ciclad Input4MIPS and save in $dirold |
---|
[6059] | 16 | #/bdd/input4MIPs/CMIP6/CMIP/PCMDI/PCMDI-AMIP-1-1-7/ocean/mon/tosbcs/gn/v20220201/tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-7_gn_187001-202106.nc |
---|
| 17 | #/bdd/input4MIPs/CMIP6/CMIP/PCMDI/PCMDI-AMIP-1-1-7/seaIce/mon/siconcbcs/gn/v20220201/siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-7_gn_187001-202106.nc |
---|
[4993] | 18 | |
---|
| 19 | # 1) Split files to yearly files |
---|
| 20 | cd $dirold |
---|
[6059] | 21 | cdo splityear tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-7_gn_187001-202106.nc amipbc_sst_360x180_ |
---|
| 22 | cdo splityear siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-7_gn_187001-202106.nc amipbc_sic_360x180_ |
---|
[4993] | 23 | |
---|
| 24 | |
---|
[6059] | 25 | # 2) Rename variable name for sea-ice concentration into sicbcs |
---|
[4993] | 26 | # and 4) The time axis is set fixed instead of unlimited |
---|
| 27 | mkdir -p $dirnew |
---|
| 28 | |
---|
| 29 | Date_Begin=1870 |
---|
[6059] | 30 | Date_End=2021 |
---|
[4993] | 31 | year=${Date_Begin} |
---|
| 32 | while [ ${year} -le ${Date_End} ] ; do |
---|
| 33 | echo year = $year |
---|
| 34 | filesic=amipbc_sic_360x180_${year}.nc |
---|
| 35 | filesst=amipbc_sst_360x180_${year}.nc |
---|
| 36 | |
---|
| 37 | echo "Rename variable sicbcs in file $dirold/$filesic " |
---|
[5011] | 38 | ncrename -v siconcbcs,sicbcs $dirold/${filesic} $dirnew/tmpsic.nc |
---|
[4993] | 39 | echo "Copy sst file to new folder $dirold/$filesst " |
---|
| 40 | cp $dirold/${filesst} $dirnew/tmpsst.nc |
---|
| 41 | |
---|
| 42 | # The time axis is set fixed instead of unlimited and the files are transformend into netcdf-4 format. |
---|
| 43 | # This is done so that the files can be read by XIOS. |
---|
| 44 | echo "Change time axis" |
---|
| 45 | ncks -4 --no_rec_dmn time $dirnew/tmpsic.nc -o $dirnew/${filesic} |
---|
| 46 | ncks -4 --no_rec_dmn time $dirnew/tmpsst.nc -o $dirnew/${filesst} |
---|
| 47 | |
---|
| 48 | let year=${year}+1 |
---|
| 49 | echo "" |
---|
| 50 | rm -f $dirnew/tmpsic.nc $dirnew/tmpsst.nc |
---|
| 51 | done |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | |
---|
[6059] | 55 | # 3) Produce climatologie files for different periods |
---|
| 56 | # |
---|
| 57 | # Climatologie files for the years 1979-2008 |
---|
| 58 | cd $dirnew |
---|
[4993] | 59 | |
---|
[6059] | 60 | ncea amipbc_sst_360x180_1979.nc amipbc_sst_360x180_198* amipbc_sst_360x180_199* amipbc_sst_360x180_200[012345678]* amipbc_sst_360x180_1979_2008_clim.nc |
---|
| 61 | ncea amipbc_sic_360x180_1979.nc amipbc_sic_360x180_198* amipbc_sic_360x180_199* amipbc_sic_360x180_200[012345678]* amipbc_sic_360x180_1979_2008_clim.nc |
---|
[4993] | 62 | |
---|
| 63 | |
---|
[6059] | 64 | # Climatologie files for the years 1991-2020 |
---|
| 65 | ncea amipbc_sst_360x180_199[123456789]* amipbc_sst_360x180_200* amipbc_sst_360x180_201* amipbc_sst_360x180_2020.nc amipbc_sst_360x180_1991_2020_clim.nc |
---|
| 66 | ncea amipbc_sic_360x180_199[123456789]* amipbc_sic_360x180_200* amipbc_sic_360x180_201* amipbc_sic_360x180_2020.nc amipbc_sic_360x180_1991_2020_clim.nc |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | # Climatologie files for the years 1870-1899 |
---|
| 70 | ncea amipbc_sic_360x180_18* amipbc_sst_360x180_1870_1899_clim.nc |
---|
| 71 | ncea amipbc_sic_360x180_18* amipbc_sic_360x180_1870_1899_clim.nc |
---|