1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
2 | % |
---|
3 | % Build a ROMS climatology file |
---|
4 | % |
---|
5 | % Extrapole and interpole temperature and salinity from a |
---|
6 | % Climatology to get boundary and initial conditions for |
---|
7 | % ROMS (climatology and initial netcdf files) . |
---|
8 | % Get the velocities and sea surface elevation via a |
---|
9 | % geostrophic computation. |
---|
10 | % |
---|
11 | % Data input format (netcdf): |
---|
12 | % temperature(T, Z, Y, X) |
---|
13 | % T : time [Months] |
---|
14 | % Z : Depth [m] |
---|
15 | % Y : Latitude [degree north] |
---|
16 | % X : Longitude [degree east] |
---|
17 | % |
---|
18 | % Data source : IRI/LDEO Climate Data Library (World Ocean Atlas 1998) |
---|
19 | % http://ingrid.ldgo.columbia.edu/ |
---|
20 | % http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA98/ |
---|
21 | % |
---|
22 | % Further Information: |
---|
23 | % http://www.brest.ird.fr/Roms_tools/ |
---|
24 | % |
---|
25 | % This file is part of ROMSTOOLS |
---|
26 | % |
---|
27 | % ROMSTOOLS is free software; you can redistribute it and/or modify |
---|
28 | % it under the terms of the GNU General Public License as published |
---|
29 | % by the Free Software Foundation; either version 2 of the License, |
---|
30 | % or (at your option) any later version. |
---|
31 | % |
---|
32 | % ROMSTOOLS is distributed in the hope that it will be useful, but |
---|
33 | % WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
34 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
35 | % GNU General Public License for more details. |
---|
36 | % |
---|
37 | % You should have received a copy of the GNU General Public License |
---|
38 | % along with this program; if not, write to the Free Software |
---|
39 | % Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
---|
40 | % MA 02111-1307 USA |
---|
41 | % |
---|
42 | % Copyright (c) 2002-2006 by Pierrick Penven |
---|
43 | % e-mail:Pierrick.Penven@ird.fr |
---|
44 | % |
---|
45 | % Contributions of P. Marchesiello (IRD) |
---|
46 | % |
---|
47 | % Updated 1-Sep-2006 by Pierrick Penven |
---|
48 | % |
---|
49 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
50 | clear all |
---|
51 | close all |
---|
52 | %%%%%%%%%%%%%%%%%%%%% USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%% |
---|
53 | % |
---|
54 | % Common parameters |
---|
55 | % |
---|
56 | romstools_param |
---|
57 | % |
---|
58 | % Data climatologies file names: |
---|
59 | % |
---|
60 | % temp_month_data : monthly temperature climatology |
---|
61 | % temp_ann_data : annual temperature climatology |
---|
62 | % salt_month_data : monthly salinity climatology |
---|
63 | % salt_ann_data : annual salinity climatology |
---|
64 | % |
---|
65 | temp_month_data=[woa_dir,'temp_month.cdf']; |
---|
66 | temp_ann_data=[woa_dir,'temp_ann.cdf']; |
---|
67 | salt_month_data=[woa_dir,'salt_month.cdf']; |
---|
68 | salt_ann_data=[woa_dir,'salt_ann.cdf']; |
---|
69 | % |
---|
70 | % |
---|
71 | %%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%% |
---|
72 | % |
---|
73 | % Title |
---|
74 | % |
---|
75 | disp(' ') |
---|
76 | disp([' Making the clim: ',clmname]) |
---|
77 | disp(' ') |
---|
78 | disp([' Title: ',ROMS_title]) |
---|
79 | % |
---|
80 | % Read in the grid |
---|
81 | % |
---|
82 | disp(' ') |
---|
83 | disp(' Read in the grid...') |
---|
84 | nc=netcdf(grdname); |
---|
85 | Lp=length(nc('xi_rho')); |
---|
86 | Mp=length(nc('eta_rho')); |
---|
87 | hmax=max(max(nc{'h'}(:))); |
---|
88 | result=close(nc); |
---|
89 | % |
---|
90 | % Create the climatology file |
---|
91 | % |
---|
92 | if (makeclim) |
---|
93 | disp(' ') |
---|
94 | disp(' Create the climatology file...') |
---|
95 | create_climfile(clmname,grdname,ROMS_title,... |
---|
96 | theta_s,theta_b,hc,N,... |
---|
97 | woa_time,woa_cycle,'clobber'); |
---|
98 | end |
---|
99 | % |
---|
100 | % Create the OA file |
---|
101 | % |
---|
102 | if (makeoa) |
---|
103 | disp(' ') |
---|
104 | disp(' Create the OA file...') |
---|
105 | nc=netcdf(temp_ann_data); |
---|
106 | Z=nc{'Z'}(:); |
---|
107 | kmax=max(find(Z<hmax))-1; |
---|
108 | Z=Z(1:kmax); |
---|
109 | close(nc) |
---|
110 | create_oafile(oaname,grdname,ROMS_title,Z,... |
---|
111 | woa_time,woa_cycle,'clobber'); |
---|
112 | % |
---|
113 | % Horizontal extrapolations |
---|
114 | % |
---|
115 | disp(' ') |
---|
116 | disp(' Horizontal extrapolations') |
---|
117 | disp(' ') |
---|
118 | disp(' Temperature...') |
---|
119 | ext_tracers(oaname,temp_month_data,temp_ann_data,... |
---|
120 | 'temperature','temp','tclm_time','Z',Roa); |
---|
121 | disp(' ') |
---|
122 | disp(' Salinity...') |
---|
123 | ext_tracers(oaname,salt_month_data,salt_ann_data,... |
---|
124 | 'salinity','salt','sclm_time','Z',Roa); |
---|
125 | end |
---|
126 | % |
---|
127 | % Vertical interpolations |
---|
128 | % |
---|
129 | if (makeclim) |
---|
130 | disp(' ') |
---|
131 | disp(' Vertical interpolations') |
---|
132 | disp(' ') |
---|
133 | disp(' Temperature...') |
---|
134 | vinterp_clm(clmname,grdname,oaname,'temp','tclm_time','Z',0,'r'); |
---|
135 | disp(' ') |
---|
136 | disp(' Salinity...') |
---|
137 | vinterp_clm(clmname,grdname,oaname,'salt','sclm_time','Z',0,'r'); |
---|
138 | if (insitu2pot) |
---|
139 | disp(' ') |
---|
140 | disp(' Compute potential temperature from in-situ...') |
---|
141 | getpot(clmname,grdname) |
---|
142 | end |
---|
143 | % |
---|
144 | % Geostrophy |
---|
145 | % |
---|
146 | disp(' ') |
---|
147 | disp(' Compute geostrophic currents') |
---|
148 | geost_currents(clmname,grdname,oaname,frcname,zref,obc,0) |
---|
149 | end |
---|
150 | |
---|
151 | if makepisces |
---|
152 | disp('====================================== ') |
---|
153 | disp('Compute Climatology for Pisces tracer') |
---|
154 | make_clim_pisces |
---|
155 | end |
---|
156 | |
---|
157 | |
---|
158 | |
---|
159 | % |
---|
160 | % Initial file |
---|
161 | % |
---|
162 | if makeini |
---|
163 | disp('======================== ') |
---|
164 | disp('Initial') |
---|
165 | create_inifile(ininame,grdname,ROMS_title,... |
---|
166 | theta_s,theta_b,hc,N,... |
---|
167 | tini,'clobber'); |
---|
168 | disp(' ') |
---|
169 | disp(' Temperature...') |
---|
170 | vinterp_clm(ininame,grdname,oaname,'temp','tclm_time','Z',tini,'r',1); |
---|
171 | disp(' ') |
---|
172 | disp(' Salinity...') |
---|
173 | vinterp_clm(ininame,grdname,oaname,'salt','sclm_time','Z',tini,'r',1); |
---|
174 | if (insitu2pot) |
---|
175 | disp(' ') |
---|
176 | disp(' Compute potential temperature from in-situ...') |
---|
177 | getpot(ininame,grdname) |
---|
178 | end |
---|
179 | |
---|
180 | if makepisces |
---|
181 | disp('========================') |
---|
182 | disp('Initial pisces variables') |
---|
183 | make_ini_pisces |
---|
184 | disp('------------------------') |
---|
185 | disp('Iron deposition file') |
---|
186 | make_dust |
---|
187 | end |
---|
188 | |
---|
189 | end |
---|
190 | |
---|
191 | % |
---|
192 | % Make a few plots |
---|
193 | % |
---|
194 | if makeplot==1 |
---|
195 | disp(' ') |
---|
196 | disp(' Make a few plots...') |
---|
197 | test_clim(clmname,grdname,'temp',1,coastfileplot) |
---|
198 | figure |
---|
199 | test_clim(clmname,grdname,'salt',1,coastfileplot) |
---|
200 | figure |
---|
201 | test_clim(clmname,grdname,'temp',6,coastfileplot) |
---|
202 | figure |
---|
203 | test_clim(clmname,grdname,'salt',6,coastfileplot) |
---|
204 | end |
---|
205 | % |
---|
206 | % End |
---|
207 | % |
---|
208 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|