source: TOOLS/AMIP/prepare_amip_original.sh @ 6788

Last change on this file since 6788 was 6788, checked in by jgipsl, 3 months ago

Updated script to be used for new version PCMDI-AMIP-1-1-9

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