source: Roms_tools/Preprocessing_tools/toto.m @ 1

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

import Roms_Agrif

File size: 1.4 KB
Line 
1close all
2clear all
3clim_file='roms_clm.nc';
4ini_file='roms_ini.nc';
5grid_file='roms_grd.nc';
6tracer='temp'
7l=1;
8%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9%
10% Test the climatology and initial files.
11% pierrick 1/2000
12%
13%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14nc=netcdf(clim_file);
15var=squeeze(nc{tracer}(l,:,:,:));
16[N M L]=size(var);
17theta_s=nc{'theta_s'}(:);
18if isempty(theta_s)
19  theta_s=nc.theta_s(:);
20  theta_b=nc.theta_b(:);
21  hc=nc.hc(:);
22else
23  theta_b=nc{'theta_b'}(:);
24  hc=nc{'hc'}(:);
25end
26close(nc)
27nc=netcdf(grid_file);
28lat=nc{'lat_rho'}(:);
29lon=nc{'lon_rho'}(:);
30pm=nc{'pm'}(:);
31h=nc{'h'}(:);
32angle=nc{'angle'}(:);
33mask=nc{'mask_rho'}(:);
34close(nc)
35mask(mask==0)=NaN;
36nc=netcdf(ini_file);
37var=var-squeeze(nc{tracer}(l,:,:,:));
38close(nc)
39
40jstep=round((M/3)-1);
41image=0;
42z = zlevs(h,0*h,theta_s,theta_b,hc,N,'r');
43for j=1:jstep:M
44  index=j;
45  image=image+1;
46  subplot(2,2,image)
47  field=squeeze(var(:,j,:));
48  topo=squeeze(h(j,:));
49  mask_vert=squeeze(mask(j,:));
50  dx=1./squeeze(pm(j,:));
51  xrad(1)=0;
52  for i=2:L
53    xrad(i)=xrad(i-1)+0.5*(dx(i)+dx(i-1));
54  end
55  x=zeros(N,L);
56  masksection=zeros(N,L);
57  for i=1:L
58    for k=1:N
59      x(k,i)=xrad(i);
60      masksection(k,i)=mask_vert(i);
61    end
62  end
63  xrad=xrad/1000;
64  x=x/1000;
65  field=masksection.*field;
66  pcolor(x,squeeze(z(:,j,:)),field)
67  colorbar
68  shading interp
69  hold on
70  plot(xrad,-topo,'k')
71  hold off
72  title(num2str(j))
73end
Note: See TracBrowser for help on using the repository browser.