source: Roms_tools/Preprocessing_tools/make_clim_occam.m @ 1

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

import Roms_Agrif

File size: 4.6 KB
Line 
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%  Pierrick Penven, IRD, 2002.
23%
24%  Version of 10-Oct-2002
25%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26clear all
27close all
28%%%%%%%%%%%%%%%%%%%%% USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%
29%
30% Common parameters
31%
32romstools_param
33%
34%  Title
35%
36title='Climatology';
37%
38%  Switches for selecting what to process (1=ON)
39%
40makeclim=1; %1: process boundary data
41makeoa=1;   %1: process oa data
42makeini=1;  %1: process initial data
43%
44%  Grid file name - Climatology file name
45%  Initial file name - OA file name
46%
47grdname='roms_grd.nc';
48clmname='roms_clm.nc';
49ininame='roms_ini.nc';
50oaname ='roms_oa.nc';
51%
52%  Day of initialisation
53%
54tini=15; 
55%
56% Set times and cycles: monthly climatology for all data
57%
58time=[15:30:345];    % time
59cycle=360;           % cycle
60%
61%  Data climatology file name:
62%
63datafile='../../OCCAM_AGULHAS/Matlab/occam_agulhas_ext_clm.nc';
64%
65%
66%%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%
67%
68% Title
69%
70disp(' ')
71disp([' Making the clim: ',clmname])
72disp(' ')
73disp([' Title: ',title])
74%
75% Read in the grid
76%
77disp(' ')
78disp(' Read in the grid...')
79nc=netcdf(grdname);
80Lp=length(nc('xi_rho'));
81Mp=length(nc('eta_rho'));
82hmax=max(max(nc{'h'}(:)));
83result=close(nc);
84%
85% Create the climatology file
86%
87if (makeclim)
88  disp(' ')
89  disp(' Create the climatology file...')
90  create_climfile(clmname,grdname,title,...
91                  theta_s,theta_b,hc,N,...
92                  time,cycle,'clobber');
93end
94%
95% Create the OA file
96%
97if (makeoa)
98  disp(' ')
99  disp(' Create the OA file...')
100  nc=netcdf(datafile);
101  Z=nc{'Z'}(:);
102  close(nc)
103  create_oafile(oaname,grdname,title,Z,...
104                time,cycle,'clobber');
105%
106% Horizontal extrapolations
107%
108  disp(' ')
109  disp(' Horizontal interpolations')
110  disp(' ')
111  disp(' Temperature...')
112  int_data_occam(oaname,datafile,'temp','lon_rho','lat_rho','temp','lonT','latT',1);
113  disp(' ')
114  disp(' Salinity...')
115  int_data_occam(oaname,datafile,'salt','lon_rho','lat_rho','salt','lonT','latT',1);
116  disp(' ')
117  disp(' U...')
118  int_data_occam(oaname,datafile,'u','lon_u','lat_u','u','lonU','latU',1);
119  disp(' ')
120  disp(' V...')
121  int_data_occam(oaname,datafile,'v','lon_v','lat_v','v','lonU','latU',1);
122  disp(' ')
123  disp(' UBAR...')
124  int_data_occam(oaname,datafile,'ubar','lon_u','lat_u','ubar','lonU','latU',0);
125  disp(' ')
126  disp(' VBAR...')
127  int_data_occam(oaname,datafile,'vbar','lon_v','lat_v','vbar','lonU','latU',0);
128  disp(' ')
129  disp(' ZETA...')
130  int_data_occam(oaname,datafile,'zeta','lon_rho','lat_rho','zeta','lonT','latT',0);
131  int_data_occam(oaname,datafile,'ssh','lon_rho','lat_rho','zeta','lonT','latT',0);
132end
133%
134% Vertical interpolations
135%
136if (makeclim)
137  disp(' ')
138  disp(' Vertical interpolations')
139  disp(' ')
140  disp(' Temperature...')
141  vinterp_clm(clmname,grdname,oaname,'temp','tclm_time','Z',0,'r');
142  disp(' ')
143  disp(' Salinity...')
144  vinterp_clm(clmname,grdname,oaname,'salt','sclm_time','Z',0,'r');
145  disp(' ')
146  disp(' U...')
147  vinterp_clm(clmname,grdname,oaname,'u','uclm_time','Z',0,'u');
148  disp(' ')
149  disp(' V...')
150  vinterp_clm(clmname,grdname,oaname,'v','vclm_time','Z',0,'v');
151  disp(' ')
152  disp(' ZETA...')
153  rem_avg_zeta(clmname,grdname,oaname)
154  disp(' ')
155  disp(' UBAR & VBAR...')
156  barotropic_currents(clmname,grdname,obc)
157end
158%
159% Initial file
160%
161if (makeini)
162  disp(' ')
163  disp(' Initial')
164  create_inifile(ininame,grdname,title,...
165                 theta_s,theta_b,hc,N,...
166                 tini,'clobber');
167  disp(' ')
168  disp(' Temperature...')
169  vinterp_clm(ininame,grdname,oaname,'temp','tclm_time','Z',tini,'r',1);
170  disp(' ')
171  disp(' Salinity...')
172  vinterp_clm(ininame,grdname,oaname,'salt','sclm_time','Z',tini,'r',1);
173end             
174%
175% Make a few plots
176%
177disp(' ')
178disp(' Make a few plots...')
179test_clim(clmname,grdname,'temp',1)
180figure
181test_clim(clmname,grdname,'salt',1)
182figure
183test_clim(clmname,grdname,'temp',6)
184figure
185test_clim(clmname,grdname,'salt',6)
186%
187% End
188%
189%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the repository browser.