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

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

Typos fixed.

  • 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 has been produced for the
4#   historical ("h" index hereafter) period.
5# ce0l interpolates them in space and create DJFMAMJJASONDJ files with two
6#   more records to ensure correct time interpolation during first half of
7#   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 jump 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#    plus 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.