source: Roms_tools/Preprocessing_tools/make_clim_high.m @ 2

Last change on this file since 2 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%  Pierrick Menkes, IRD, 2006.
24%
25
26%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27clear all
28close all
29%%%%%%%%%%%%%%%%%%%%% USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%
30%
31% Common parameters
32%
33romstools_param
34%
35%  Title
36%
37title='Climatology';
38%
39%  Switches for selecting what to process (1=ON)
40%
41makeclim=1; %1: process boundary data
42makeoa=1;   %1: process oa data
43makeini=0;  %1: process initial data
44%
45%  Grid file name - Climatology file name
46%  Initial file name - OA file name
47%
48grdname='roms_grd.nc';
49frcname='roms_frc_ERS_smooth.nc'
50%roms_frc.nc';
51clmname='roms_clm_high.nc';
52ininame='roms_ini.nc';
53oaname ='roms_oa_high.nc';
54%
55%  Day of initialisation
56%
57tini=0; 
58%
59% Set times and cycles: monthly climatology for all data
60%
61time=[15:30:345];    % time
62cycle=365;           % cycle
63%
64%  Data climatologies file names:
65%
66%    temp_month_data : monthly temperature climatology
67%    temp_ann_data   : annual temperature climatology
68%    salt_month_data : monthly salinity climatology
69%    salt_ann_data   : annual salinity climatology
70%
71temp_month_data='../WOA2001/temp_month_corrected.cdf';
72temp_ann_data='../WOA2001/temp_ann_corrected.cdf';
73insitu2pot=1;   %1: transform in-situ temperature to potential temperature
74salt_month_data='../WOA2001/salt_month_corrected.cdf';
75salt_ann_data='../WOA2001/salt_ann_corrected.cdf';
76%
77%
78%%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%
79%
80% Title
81%
82disp(' ')
83disp([' Making the clim: ',clmname])
84disp(' ')
85disp([' Title: ',title])
86%
87% Read in the grid
88%
89disp(' ')
90disp(' Read in the grid...')
91nc=netcdf(grdname);
92Lp=length(nc('xi_rho'));
93Mp=length(nc('eta_rho'));
94hmax=max(max(nc{'h'}(:)));
95result=close(nc);
96%
97% Create the climatology file
98%
99if (makeclim)
100  disp(' ')
101  disp(' Create the climatology file...')
102  create_climfile(clmname,grdname,title,...
103                  theta_s,theta_b,hc,N,...
104                  time,cycle,'clobber');
105end
106%
107% Create the OA file
108%
109if (makeoa)
110  disp(' ')
111  disp(' Create the OA file...')
112  nc=netcdf(temp_ann_data);
113  Z=nc{'Z'}(:);
114  kmax=max(find(Z<hmax))-1;
115  Z=Z(1:kmax);
116  close(nc)
117  create_oafile(oaname,grdname,title,Z,...
118                time,cycle,'clobber');
119%
120% Horizontal extrapolations
121%
122  disp(' ')
123  disp(' Horizontal extrapolations')
124  disp(' ')
125  disp(' Temperature...')
126  ext_tracers(oaname,temp_month_data,temp_ann_data,...
127              'temperature','temp','tclm_time','Z');
128  disp(' ')
129  disp(' Salinity...')
130  ext_tracers(oaname,salt_month_data,salt_ann_data,...
131              'salinity','salt','sclm_time','Z');
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  if (insitu2pot)
146    disp(' ')
147    disp(' Compute potential temperature from in-situ...')
148    getpot(clmname,grdname)
149  end
150%
151% Geostrophy
152%
153  disp(' ')
154  disp(' WARNING NO geostrophic currents IN THIS CLIM')
155%  geost_currents(clmname,grdname,oaname,frcname,zref,obc,0)
156end
157%
158% Initial file
159%
160if (makeini)
161  disp(' ')
162  disp(' Initial')
163  create_inifile(ininame,grdname,title,...
164                 theta_s,theta_b,hc,N,...
165                 tini,'clobber');
166  disp(' ')
167  disp(' Temperature...')
168  vinterp_clm(ininame,grdname,oaname,'temp','tclm_time','Z',tini,'r',1);
169  disp(' ')
170  disp(' Salinity...')
171  vinterp_clm(ininame,grdname,oaname,'salt','sclm_time','Z',tini,'r',1);
172  if (insitu2pot)
173    disp(' ')
174    disp(' Compute potential temperature from in-situ...')
175    getpot(ininame,grdname)
176  end
177end             
178%
179% Make a few plots
180%
181disp(' ')
182disp(' Make a few plots...')
183test_clim(clmname,grdname,'temp',1)
184figure
185test_clim(clmname,grdname,'salt',1)
186figure
187test_clim(clmname,grdname,'temp',6)
188figure
189test_clim(clmname,grdname,'salt',6)
190%
191% End
192%
193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the repository browser.