source: Roms_tools/Preprocessing_tools/make_clim_orca05.m @ 1

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

import Roms_Agrif

File size: 5.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 data from ORCA 05 climatology
9%
10%  Data input format (netcdf):
11%     temperature(T, Z, Y, X)
12%     T : time [Months]
13%     Z : Depth [m]
14%     Y : Latitude [degree north]
15%     X : Longitude [degree east]
16%
17%  Data source : ORCA 05 Lionel Gourdeau 2005
18%
19%  Lefevre Jerome, IRD, 2005.
20%
21%  Version of 10-AUG-2005
22%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23clear all
24close all
25%%%%%%%%%%%%%%%%%%%%% USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%
26%
27%  Title
28%
29title='Climatology';
30%
31%  Switches for selecting what to process (1=ON)
32%
33makeclim=1; %1: process boundary data
34makeoa=1;   %1: process oa data
35makeini=1;  %1: process initial data
36%
37%  Grid file name - Climatology file name
38%  Initial file name - OA file name
39%
40%grdname='roms_fd_plat_3000m_grd.nc';
41grdname='roms_grd.nc';
42clmname='roms_clm_r05.nc';
43ininame='roms_ini_r05.nc';
44oaname ='roms_oa_r05.nc';
45
46%
47%  Vertical grid parameters
48%  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
49%  !!! WARNING WARNING WARNING WARNING WARNING  !!!
50%  !!!   THESE MUST IDENTICAL IN THE .IN FILE   !!!
51%  !!! WARNING WARNING WARNING WARNING WARNING  !!!
52%  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
53%
54theta_s=6.;
55theta_b=0.;
56hc=5;
57N=30; % number of vertical levels (rho)
58%
59%  Open boundaries switches
60%  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
61%  !!! WARNING WARNING WARNING WARNING WARNING  !!!
62%  !!!   MUST BE CONFORM TO THE CPP SWITCHES    !!!
63%  !!! WARNING WARNING WARNING WARNING WARNING  !!!
64%  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
65%
66obc=[1 0 1 1]; % open boundaries (1=open , [S E N W])
67%
68%  Day of initialisationbarotropic_currents
69%
70tini=15; 
71%
72% Set times and cycles: monthly climatology for all data
73%
74time=[15:30:345];    % time
75cycle=365;           % cycle
76%
77%  Data climatology file name:
78%
79Dir_Data='/export/serveraid_vol0/ROMS_HOME/Roms_tools/DATA_PACIFIC/ORCA05_clim/'
80datafile=[Dir_Data,'ORCA05_monthly_clim.cdf'];
81%
82%
83%
84%%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%
85%
86% Title
87%
88disp(' ')
89disp([' Making the clim: ',clmname])
90disp(' ')
91disp([' Title: ',title])
92%
93% Read in the grid
94%
95disp(' ')
96disp(' Read in the grid...')
97nc=netcdf(grdname);
98Lp=length(nc('xi_rho'));
99Mp=length(nc('eta_rho'));
100hmax=max(max(nc{'h'}(:)));
101result=close(nc);
102%
103% Create the climatology file
104%
105if (makeclim)
106  disp(' ')
107  disp(' Create the climatology file.barotropic_currents..')
108  create_climfile(clmname,grdname,title,...
109                  theta_s,theta_b,hc,N,...
110                  time,cycle,'clobber');
111end
112%
113% Create the OA file
114%
115if (makeoa)
116  disp(' ')
117  disp(' Create the OA file...')
118  nc=netcdf(datafile);
119  Z=nc{'Z'}(:);
120  close(nc)
121  create_oafile(oaname,grdname,title,Z,...
122                time,cycle,'clobber');
123%
124% Horizontal extrapolations
125%
126  disp(' ')
127  disp(' Horizontal interpolations')
128  disp(' ')
129  disp(' Temperature...')
130  int_data_orca(oaname,datafile,'temp','lon_rho','lat_rho','TEMP','lonT','latT',1);
131  disp(' ')
132  disp(' Salinity...')
133  int_data_orca(oaname,datafile,'salt','lon_rho','lat_rho','SALT','lonT','latT',1);
134  disp(' ')
135  disp(' U...')
136  int_data_orca(oaname,datafile,'u','lon_u','lat_u','U','lonU','latT',1);
137  disp(' ')
138  disp(' V...')
139  int_data_orca(oaname,datafile,'v','lon_v','lat_v','V','lonT','latV',1);
140  disp(' ')
141  disp(' ZETA...')
142  int_data_orca(oaname,datafile,'zeta','lon_rho','lat_rho','SSH','lonT','latT',0);
143 
144  ncoa=netcdf(oaname,'write');
145  ncoa{'ssh'}(:,:,:)=ncoa{'zeta'}(:,:,:);
146  close(ncoa)
147end
148%
149% Vertical interpolations
150%
151if (makeclim)
152  disp(' ')
153  disp(' Vertical interpolations')
154  disp(' ')
155  disp(' Temperature...')
156  vinterp_clm(clmname,grdname,oaname,'temp','tclm_time','Z',0,'r');
157  disp(' ')
158  disp(' Salinity...')
159  vinterp_clm(clmname,grdname,oaname,'salt','sclm_time','Z',0,'r');
160  disp(' ')
161  disp(' U...')
162  vinterp_clm(clmname,grdname,oaname,'u','uclm_time','Z',0,'u');
163  disp(' ')
164  disp(' V...')
165  vinterp_clm(clmname,grdname,oaname,'v','vclm_time','Z',0,'v');
166  disp(' ')
167  disp(' ZETA...')
168  rem_avg_zeta(clmname,grdname,oaname)
169  disp(' ')
170  disp(' UBAR & VBAR...')
171  barotropic_currents(clmname,grdname,obc)
172end
173%
174% Initial file
175%
176if (makeini)
177  disp(' ')
178  disp(' Initial')
179  create_inifile(ininame,grdname,title,...
180                 theta_s,theta_b,hc,N,...
181                 tini,'clobber');
182  ncini=netcdf(ininame,'write');
183  ncclm=netcdf(clmname);                 
184                 
185  tindex=find(time==tini)
186  if isempty(tindex),
187    disp('Error : Indice for tini is not found, chek')           ;
188  end 
189  disp(' ')
190  disp(' Temperature...')
191  ncini{'temp'}(1,:,:,:)=ncclm{'temp'}(tindex,:,:,:);
192  disp(' ')
193  disp(' Salinity ...')
194  ncini{'salt'}(1,:,:,:)=ncclm{'salt'}(tindex,:,:,:);
195  disp(' ')
196  disp(' U ...')
197  ncini{'u'}(1,:,:,:)=ncclm{'u'}(tindex,:,:,:);
198  disp(' ')
199  disp(' V ...')
200  ncini{'v'}(1,:,:,:)=ncclm{'v'}(tindex,:,:,:); 
201  disp(' ')
202  disp(' UBAR & VBAR...') 
203  ncini{'ubar'}(1,:,:)=ncclm{'ubar'}(tindex,:,:);   
204  ncini{'vbar'}(1,:,:)=ncclm{'vbar'}(tindex,:,:);
205   ncini{'vbar'}(1,5,5) 
206  disp(' ')
207  disp(' ZETA...')     
208  ncini{'zeta'}(1,:,:)=ncclm{'zeta'}(tindex,:,:); 
209   ncini{'zeta'}(1,5,5)
210  close(ncini);
211  close(ncclm);
212end             
213%
214% Make a few plots
215%
216disp(' ')
217disp(' Make a few plots...')
218test_clim(clmname,grdname,'temp',1)
219figure
220test_clim(clmname,grdname,'salt',1)
221figure
222test_clim(clmname,grdname,'temp',6)
223figure
224test_clim(clmname,grdname,'salt',6)
225%
226% End
227%
228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the repository browser.