source: TOOLS/CMIP6_FORCING/OZONE/make_tro32014.bash @ 4264

Last change on this file since 4264 was 4264, checked in by cugnet, 3 years ago

Add the script make_O32014.bash, which creates a 2014 file to be provided to
ce0l as previous year file ("climoz_m.nc") when creating a 2015 file
("climoz_LMDZ.nc") for a scenario.
The 2014 file created by this script is identical to the historical one, except
the last record (december) which has been modified to vanish the jump on Jan.
1st that would appear without modifications, caused by the fact that the
historical Jan. 2015 field was not available, so january 2014 was used instead.

  • Property svn:executable set to *
File size: 2.9 KB
Line 
1#!/bin/bash
2#=== PURPOSE:
3# One ozone files per year with 12 monthly records have been produced for the
4#   historical ("h" index hereafter) period.
5# ce0l converts interpolates them in space and create DJFMAMJJASONDJ files
6#   with two more records to ensure correct time interpolation during first
7#   half of January and second half of December:
8#     * record 1: december of previous year
9#     * record 14: january of next year
10# No file was available for 2015, so Jan 2014 was used.
11# When starting over with a SSP scenario (index "s" hereafter), using the
12#   historical 2014 december field would create a gap at Jan. 1st. To avoid
13#   this, the 2014 file provided to ce0l contains a modified december field.
14#   "i" denotes "interpolated", "m" modified.
15# The interpolated field @2015-01-01 in the historical run is:
16#     * Fi(2015-01-01_00) = [Fh(2014-12-15_12)+Fh(2014-01-15_12)]/2
17# In the SSP run:
18#     * Fi(2015-01-01_00) = [Fm +O3s(2015-01-15_12)]/2
19# The gap vanishes if:
20#     Fm = Fh(2014-12-15_12)+[Fh(2014-01-15_12)-Fs(2015-01-15_12)]
21# This shows that we use the normally required field Fh(2014-12-15_12h)
22#    modified with the december anomaly historical 2014 - SSP 2015.
23# This script generated the required 2014 modified file.
24#
25# INPUTS: tro3_2014.nc (historical)  tro3_2015_ssp**.nc (scenarii)
26# OUTPUT: tro3_2014_ssp**.nc
27#
28# NB: Hard coded for input files at the 144x96x66 resolution.
29
30
31#=== PARAMETERS
32nlo=144
33nla=96
34nle=66
35scenar="ssp119 ssp534-over"
36data="/data/dcugnet/prodigfs/ipslfs/igcmg/IGCM/ATM/OZONE/UReading/CCMI-"
37
38#=== NOT LIKELY TO BE CHANGED
39res="${nlo}x${nla}x${nle}"
40f='make_tro32014'
41
42for s in $scenar; do
43
44  fh=tro3_2014.nc
45  fs=tro3_2015_${s}.nc
46  fo=tro3_2014_${s}.nc
47
48  #--- CREATE A MATLAB SCRIPT
49  cat > $f.m << _fin
50  Siz=[$nlo $nla $nle 1];                        %=== O3 FIELDS SIZES
51  Jan=[0 0 0 0 ]; Dec=[0 0 0 11];                %=== NETCDF INDICES
52
53  fid=netcdf.open('$fh','NOWRITE');              %=== HISTORICAL FILE
54  vid=netcdf.inqVarID(fid,'tro3');
55  Jh=netcdf.getVar(fid,vid,Jan,Siz);             %=== Hist. Jan 2014
56  Dh=netcdf.getVar(fid,vid,Dec,Siz);             %=== Hist. Dec 2014
57  netcdf.close(fid);
58
59  fid=netcdf.open('$fs','NOWRITE');              %=== SCENARIO FILE
60  vid=netcdf.inqVarID(fid,'tro3');
61  Js=netcdf.getVar(fid,vid,Jan,Siz);             %=== SCENARIO Jan. 2015
62  netcdf.close(fid);
63
64  fid=netcdf.open('$fo','WRITE');                %=== OUTPUT FILE
65  vid=netcdf.inqVarID(fid,'tro3');
66  Dmod=Dh+Jh-Js; Dmod(Dmod<3E-9)=3E-9;           %=== MODIFIED Dec. 2014
67  netcdf.putVar(fid,vid,Dec,Siz,Dmod);           %=== SAVE FIELD
68  netcdf.close(fid);
69_fin
70
71  #--- LAUNCH THE MATLAB SCRIPT
72  dh=$(ls -d ${data}historical.v20??????/original/$res/)
73  do=$(ls -d ${data}${s}.v20??????/original/$res/)
74
75  cp     $dh/$fh          $fo
76  ln -sf $dh/$fh          $fh
77  ln -sf $do/tro3_2015.nc $fs
78  matlab -nojvm -nodisplay -nodesktop -r "$f; exit" > /dev/null 2>&1
79  mv $fo $do/tro3_2014_hybrid.nc
80  rm -f $fh $fs $f.m
81
82done
83
Note: See TracBrowser for help on using the repository browser.