source: TOOLS/AMIP/prepare_amip_original.sh @ 6755

Last change on this file since 6755 was 6059, checked in by jgipsl, 2 years ago

Updated script after use with version PCMDI-AMIP-1-1-7.
Now moved creation of climato files to the end.

File size: 3.1 KB
Line 
1#!/bin/bash
2set -vx
3
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
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# Done by J. Ghattas, 2020/03/03
11
12dirold=`pwd`/original/360x180.orig
13dirnew=`pwd`/original/360x180.new
14
15# 0) Copy original files from ciclad Input4MIPS and save in $dirold
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
18
19# 1) Split files to yearly files
20cd $dirold
21cdo splityear tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-7_gn_187001-202106.nc      amipbc_sst_360x180_
22cdo splityear siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-7_gn_187001-202106.nc   amipbc_sic_360x180_
23
24
25# 2) Rename variable name for sea-ice concentration into sicbcs
26#    and 4) The time axis is set fixed instead of unlimited
27mkdir -p $dirnew
28
29Date_Begin=1870
30Date_End=2021
31year=${Date_Begin}
32while [ ${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 "
38      ncrename -v siconcbcs,sicbcs $dirold/${filesic} $dirnew/tmpsic.nc
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
51done
52
53
54
55# 3) Produce climatologie files for different periods
56#
57#    Climatologie files for the years 1979-2008
58cd $dirnew
59
60ncea 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
61ncea 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
62
63
64#    Climatologie files for the years 1991-2020
65ncea 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
66ncea 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
70ncea amipbc_sic_360x180_18* amipbc_sst_360x180_1870_1899_clim.nc
71ncea amipbc_sic_360x180_18* amipbc_sic_360x180_1870_1899_clim.nc
Note: See TracBrowser for help on using the repository browser.