source: CONFIG/LMDZORINCA/tags/LMDZORINCA_v1/CREATE/SCRIPT/create_sst_anomaly.ksh @ 1447

Last change on this file since 1447 was 1447, checked in by acosce, 13 years ago

Add Script directory for CREATE in LMDZORINCA

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1#!/bin/ksh
2set -vx
3#
4# create_sst_anomaly.ksh
5#
6# This script will correct the sea-surface temperature (SST) from a coupled model simulation
7# using the difference between an AMIP reference SST field and an historical coupled model
8# reference SST field. The two reference SST fields are both monthly mean over the period 1979-2005.
9#
10# The output is stored in the directory out_anomaly, set below, and is directly usable with
11# the program ce0l (create_etat0_limit) in LMDZ5 revision 1508 or later. For each year there
12# are two output files : one at model original grid and one at a higer resolution grid(with
13# suffix _HR.nc). If the SST are to be used at a higer resolution grid or with a zoom it is
14# better to use the high resolution SST (_HR.nc).
15#
16# 1 - Create reference file
17# 2 - Add reference file to the scenario simulation
18# 3 - Interpolate to higer regular resolution
19#
20#
21# Author and contact Josefine Ghattas, IPSL, 2011
22#
23########## User definitions
24# Three time series are needed : amip_TS, hist_TS and simul_TS. They should all contain
25# the same variable tsol_oce at the same model grid resolution with monthly values.
26
27# amip_TS : AMIP SST containg at least the reference period 1979-2005
28amip_TS=/dmnfs/cont003/p86musat/IGCM_OUT/LMDZOR/PROD/amip/v3.amip1/ATM/Analyse/TS_MO/v3.amip1_19790101_20091231_1M_tsol_oce.nc
29
30# hist_TS : model output SST from reference simulation containg at least the reference period 1979-2005
31hist_TS=/dmnfs/cont003/p86denv/IGCM_OUT/IPSLCM5A/PROD/historical/v3.historical1/ATM/Analyse/TS_MO/v3.historical1_18500101_20051231_1M_tsol_oce.nc
32
33# simul_TS : model output SST from the simulation to be corrected containing at least the years [year_begin,year_end] to be set below
34simul_TS=/dmnfs/cont003/p86denv/IGCM_OUT/IPSLCM5A/PROD/rcp45/v3.rcp45.1/ATM/Analyse/TS_MO/v3.rcp45.1_20060101_21651231_1M_tsol_oce.nc
35
36# year_begin and year_end : interval for simul_TS
37year_begin=2006
38year_end=2095
39
40# outname : basename for output files
41outname=v3.rcp45.1_tsol_oce_
42
43# out_simul : directory where the original simulation will be stored splitted in years
44out_simul=$SCRATCHDIR/OUTTEST/simul
45
46# out_anomaly : directory where the final simulation with anomaly will be created and stored
47out_anomaly=$SCRATCHDIR/OUTTEST/anomaly
48
49# rundir : directory where temporary files will be created and stored
50rundir=$SCRATCHDIR/OUTTEST/rundir
51
52########## End User definitions
53
54########## 0 Create output and run directories
55mkdir -p $out_simul
56mkdir -p $out_anomaly
57
58mkdir -p $rundir 
59cd $rundir
60
61
62########## 1 Create reference file
63# extract reference period from AMIP SST and create reference file
64cdo seldate,1979-01-01,2005-12-31 $amip_TS amip_ts_ref.nc
65cdo ymonmean amip_ts_ref.nc amip_ref.nc
66
67# extract reference period from histroical simulation SST and create reference file
68cdo seldate,1979-01-01,2005-12-31 $hist_TS hist_ts_ref.nc
69cdo ymonmean hist_ts_ref.nc hist_ref.nc
70
71# create difference file AMIP - HIST
72cdo sub amip_ref.nc hist_ref.nc refdiff.nc
73
74
75########## 2 Add reference file to the scenario simulation
76# split time serie into yearly files
77cdo splityear $simul_TS $out_simul/${outname}
78
79# add refdiff anomalies to each year of RCP4.5
80year=$year_begin
81while [[ ${year} -le ${year_end} ]] ; do
82   cdo add $out_simul/${outname}$year.nc2 refdiff.nc $out_anomaly/${outname}anomaly_amip_${year}.nc
83
84   # next year
85   year=`expr $year + 1`
86done
87
88########## 3 Interpolate to higer regular resolution
89year=$year_begin
90while [[ ${year} -le ${year_end} ]] ; do
91   cdo remapbic,r720x360 $out_anomaly/${outname}anomaly_amip_$year.nc $out_anomaly/${outname}anomaly_amip_${year}_HR.nc
92
93   # next year
94   year=`expr $year + 1`
95done
96
97
98exit
99
100
Note: See TracBrowser for help on using the repository browser.