source: Roms_tools/Preprocessing_tools/make_bry.m @ 1

Last change on this file since 1 was 1, checked in by cholod, 13 years ago

import Roms_Agrif

File size: 5.7 KB
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3%  Build a ROMS boundary file
4%
5%  Extrapole and interpole temperature and salinity from a
6%  climatology to get boundary conditions for
7%  ROMS (boundary netcdf file) .
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) 2005-2006 by Pierrick Penven
43%  e-mail:Pierrick.Penven@ird.fr 
44%
45%  Updated    1-Sep-2006 by Pierrick Penven
46%
47%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48clear all
49close all
50%%%%%%%%%%%%%%%%%%%%% USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%
51%
52% Common parameters
53%
54romstools_param
55%
56%  Data climatologies file names:
57%
58%    temp_month_data : monthly temperature climatology
59%    temp_ann_data   : annual temperature climatology
60%    salt_month_data : monthly salinity climatology
61%    salt_ann_data   : annual salinity climatology
62%
63temp_month_data=[woa_dir,'temp_month.cdf'];
64temp_ann_data=[woa_dir,'temp_ann.cdf'];
65salt_month_data=[woa_dir,'salt_month.cdf'];
66salt_ann_data=[woa_dir,'salt_ann.cdf'];
67%
68%
69%%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%
70%
71% Title
72%
73disp(' ')
74disp([' Making the file: ',bryname])
75disp(' ')
76disp([' Title: ',ROMS_title])
77%
78% Read in the grid
79%
80disp(' ')
81disp(' Read in the grid...')
82nc=netcdf(grdname);
83lon=nc{'lon_rho'}(:);
84lat=nc{'lat_rho'}(:);
85Lp=length(nc('xi_rho'));
86Mp=length(nc('eta_rho'));
87hmax=max(max(nc{'h'}(:)));
88result=close(nc);
89%
90% Create the boundary file
91%
92if (makebry)
93  disp(' ')
94  disp(' Create the boundary file...')
95  create_bryfile(bryname,grdname,ROMS_title,obc,...
96                 theta_s,theta_b,hc,N,...
97                 woa_time,woa_cycle,'clobber');
98end
99%
100% Create the boundary file in Z-coordinates
101%
102if (makeZbry)
103  disp(' ')
104  disp(' Create the boundary Z-file...')
105%
106% get Z
107%
108  nc=netcdf(temp_ann_data);
109  Z=nc{'Z'}(:);
110  kmax=max(find(Z<hmax))-1;
111  Z=Z(1:kmax);
112  close(nc)
113  create_bry_Z(Zbryname,grdname,ROMS_title,obc,...
114                Z,woa_time,woa_cycle,'clobber');
115  disp(' ')
116  disp(' Horizontal extrapolations')
117%
118% Loop on the lateral boundaries
119%
120  for obcndx=1:4
121    if obc(obcndx)==1
122      if obcndx==1
123        disp(' Processing southern boundary...')
124        suffix='_south';
125      elseif obcndx==2
126        disp(' Processing eastern boundary...')
127        suffix='_east';
128      elseif obcndx==3
129        disp(' Processing northern boundary...')
130        suffix='_north';
131      elseif obcndx==4
132        disp(' Processing western boundary...')
133        suffix='_west';
134      end
135      disp('  Temperature...')
136      bry_interp(Zbryname,lon,lat,temp_month_data,temp_ann_data,...
137               'temperature',['temp',suffix],obcndx,Roa);
138      disp('  Salinity...')
139      bry_interp(Zbryname,lon,lat,salt_month_data,salt_ann_data,...
140               'salinity',['salt',suffix],obcndx,Roa);       
141    end
142  end
143end
144%
145% Vertical interpolations
146%
147if (makebry)
148  disp(' ')
149  disp(' Vertical interpolations')
150%
151% Loop on the lateral boundaries
152%
153  for obcndx=1:4
154    if obc(obcndx)==1
155      if obcndx==1
156        disp(' Processing southern boundary...')
157        suffix='_south';
158      elseif obcndx==2
159        disp(' Processing eastern boundary...')
160        suffix='_east';
161      elseif obcndx==3
162        disp(' Processing northern boundary...')
163        suffix='_north';
164      elseif obcndx==4
165        disp(' Processing western boundary...')
166        suffix='_west';
167      end
168      disp(' ')
169      disp('  Temperature...')
170      vinterp_bry(bryname,grdname,Zbryname,['temp',suffix],obcndx);
171      disp(' ')
172      disp('  Salinity...')
173      vinterp_bry(bryname,grdname,Zbryname,['salt',suffix],obcndx);
174      if (insitu2pot)
175        disp(' ')
176        disp('  Compute potential temperature from in-situ...')
177        getpot_bry(bryname,grdname,obcndx)
178      end
179%
180% Geostrophy
181%
182      disp(' ')
183      disp('  Compute geostrophic currents')
184      geost_currents_bry(bryname,grdname,Zbryname,frcname,zref,obcndx)
185    end
186  end
187%
188% Remove avg SSH
189%
190  rmavgssh(bryname,grdname,obc)
191
192%
193%% Compute bry for pisces variables
194%
195 if makepisces
196   disp('====================================== ')
197   disp('Compute boundary for Pisces tracer')
198   make_bry_pisces
199 end
200end
201%
202% Make a few plots
203%
204if makeplot==1
205  disp(' ')
206  disp(' Make a few plots...')
207  test_bry(bryname,grdname,'temp',1,obc)
208  figure
209  test_bry(bryname,grdname,'salt',1,obc)
210  figure
211  test_bry(bryname,grdname,'u',1,obc)
212  figure
213  test_bry(bryname,grdname,'v',1,obc)
214  figure
215  test_bry(bryname,grdname,'temp',6,obc)
216  figure
217  test_bry(bryname,grdname,'salt',6,obc)
218  figure
219  test_bry(bryname,grdname,'u',6,obc)
220  figure
221  test_bry(bryname,grdname,'v',6,obc)
222end
223%
224% End
225%
226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the repository browser.