source: altifloat/exp_nemed/plot_article.m @ 191

Last change on this file since 191 was 191, checked in by jbrlod, 9 years ago

modif in plot_article.m

File size: 4.6 KB
Line 
1close all
2clear all
3
4
5addpath('../matlab_toolbox');
6osave = true;
7
8indir='../exp_nemed/';
9outdir = '../doc/ocean_modelling/fig/';
10load ../../data/coastlines-split-4326/east_med.mat
11
12
13robs=load([ indir 'obs.dat']);
14rsim=load([ indir 'rfloat_nodiv.dat']);
15uvb=load([ indir 'uv_back_aviso.dat']);
16
17uvr=load([indir 'uv_tot_nodiv.dat']);
18
19meshg=load([indir 'meshgrid_aviso.dat']);
20mask = load([indir 'mask_aviso.dat']);
21
22iech=1;
23jech=1;
24%LIM=[34.5 36 32.5 35];
25LON = [33.5 35.6];
26LAT = [32.5 35];
27LIM= [LON LAT];
28
29%nlon=87;
30%nlat=58;
31lon=unique(meshg(:,1));
32lat=unique(meshg(:,2));
33nlon=length(lon);
34nlat=length(lat);
35
36[Lon,Lat]=meshgrid(lon',lat);
37Mask = reshape(mask,[nlon,nlat]);
38Mask = Mask';
39
40nfloat=length(unique(robs(:,2)));
41
42%% To change unit
43%change grid from unitless to m/s
44
45R_earth=6371229; %in meters
46delta_x=zeros(nlat,nlon);
47delta_y=zeros(nlat,nlon);
48
49for ilon=1:nlon-1;
50    for jlat=1:nlat-1;
51       
52    delta_x(jlat,ilon)=R_earth*(2*pi/360)*(Lon(jlat,ilon+1)-Lon(jlat,ilon))...
53        .*cos(2*pi*Lat(jlat,ilon)/360);
54    delta_y(jlat,ilon)=R_earth*(2*pi/360)*(Lat(jlat+1,ilon)-Lat(jlat,ilon)); 
55       
56end
57end
58
59
60
61delta_x(1:nlat,nlon)=delta_x(1:nlat,nlon);
62delta_y(1:nlat,nlon)=delta_y(1:nlat,nlon);
63
64
65delta_x(nlat,1:nlon)=delta_x(nlat-1,1:nlon);
66delta_y(nlat,1:nlon)=delta_y(nlat-1,1:nlon);
67
68
69%% Reshape wind data
70%it, ilon,ilat,u,v
71ntime=length(unique(uvb(:,1)));
72Ub=reshape(uvb(:,end-1),nlat,nlon,ntime);
73Vb=reshape(uvb(:,end),nlat,nlon,ntime);
74
75Ubms = Ub .* repmat(delta_x,1,1,ntime);
76Vbms = Vb .* repmat(delta_x,1,1,ntime);
77
78%it, ilon,ilat,u,v
79ntime=length(unique(uvr(:,1)));
80Ur=reshape(uvr(:,end-1),nlat,nlon,ntime);
81Vr=reshape(uvr(:,end),nlat,nlon,ntime);
82Ur(repmat(Mask,1,1,ntime)==0)=0;
83Vr(repmat(Mask,1,1,ntime)==0)=0;
84
85%Ur(Ub<1e-15)=0;
86%Vr(Vb<1e-15)=0;
87Urms = Ur .* repmat(delta_x,1,1,ntime);
88Vrms = Vr .* repmat(delta_x,1,1,ntime);
89
90%For the quiver legend
91[~,jleg] = min(abs(lon-35.3));
92[~,ileg] = min(abs(lat-32.8));
93Urms(ileg,jleg,:) = 1;
94%Ubms(ileg-1,jleg,:) = 1;
95
96%% Plots
97figure(1)
98clf
99Hr=quiver(Lon(1:jech:end,1:iech:end),Lat(1:jech:end,1:iech:end),mean(Urms(1:jech:end,1:iech:end,1:end-1),3), ...
100          mean(Vrms(1:jech:end,1:iech:end,1:end-1),3),'r');
101hold on
102Hb=quiver(Lon(1:jech:end,1:iech:end),Lat(1:jech:end,1:iech:end),mean(Ubms(1:jech:end,1:iech:end,1:end-1),3),mean(Vbms(1:jech:end,1:iech:end,1:end-1),3),'b');
103
104
105
106
107for j=1:nfloat     
108 
109  rfloat=rsim(rsim(:,2)==j-1&rsim(:,end)>0,[end-1 end]);
110  rfloat_lon=interp1(1:nlon,lon,rfloat(:,2)+1);
111  rfloat_lat=interp1(1:nlat,lat',rfloat(:,1)+1);
112  %Hsim=plot(rfloat_lon,rfloat_lat,'.-r');
113    rfloat=robs(robs(:,2)==j-1&robs(:,end)>0,[end-1 end]);
114  rfloat_lon=interp1(1:nlon,lon,rfloat(:,2)+1);
115  rfloat_lat=interp1(1:nlat,lat',rfloat(:,1)+1);
116  Hobs=plot(rfloat_lon,rfloat_lat,'m','Color',[0.3 0.3 0.3]);
117 
118end
119
120
121
122
123
124
125%Ajout des trajectoires réelles
126axis(LIM);
127    mapshow(S,'Color',[0 0 0]);
128
129legend([Hb Hr Hobs],'Averaged over 9 days : background','Corrected','Drifter trajectory','Location','SouthWest');
130text(35.33,32.75,'1 m/s')
131%print -dpng ../exp_forw_dan/simu_drifter_dan.png
132
133if osave
134    print('-dpng','-r300',[outdir 'Eddy_velocity.png']);
135    savefig([outdir 'Eddy_velocity.fig']);
136end
137
138
139%% eddy
140cax = [-10 10].*1e-10;
141cmap = scol_dif_lin(100,cax);
142
143figure(2);
144clf
145[sX,sY] = meshgrid(34.3, 33:34.5);
146%streamline(Lon,Lat,mean(Ut(:,:,end-1),3),mean(Vt(:,:,end-1),3),sX,sY)
147[Uxb,Uyb]=gradient(mean(Ub(:,:,1:end-1),3),1,1);
148[Vxb,Vyb]=gradient(mean(Vb(:,:,1:end-1),3),1,1);
149
150%Uxt = Uxt .* (pi/180) .* R .* cos(Lat * pi/180);
151%Vxt = Vxt .* (pi/180) .* R .* cos(Lat * pi/180);
152%Uyt = Uyt .* (pi/180) .* R ;
153%Vyt = Vyt .* (pi/180) .* R ;
154
155
156owb = okubo_weiss(Uxb,Uyb,Vxb,Vyb);
157
158imagesc(lon',lat,owb(1:iech:end,1:iech:end));
159caxis(cax);
160axis xy
161shading interp
162hold on
163    mapshow(S,'Color',[0 0 0]);
164    colorbar
165axis(LIM);
166colormap(cmap);
167[Uxr,Uyr]=gradient(mean(Ur(:,:,1:end-1),3),1,1);
168[Vxr,Vyr]=gradient(mean(Vr(:,:,1:end-1),3),1,1);
169
170%Uxr = Uxr .* (pi/180) .* R .* cos(Lat * pi/180);
171%Vxr = Vxr .* (pi/180) .* R .* cos(Lat * pi/180);
172%Uyr = Uyr .* (pi/180) .* R ;
173%Vyr = Vyr .* (pi/180) .* R ;
174
175owr = okubo_weiss(Uxr,Uyr,Vxr,Vyr);
176title('Okubo-Weiss parameter of the Background');
177if osave
178    print('-dpng','-r300',[outdir 'okubo_weiss_aviso.png']);
179    savefig([outdir 'okubo_weiss_aviso.fig']);
180end
181
182figure(3)
183clf
184imagesc(lon',lat,owr(1:iech:end,1:iech:end));
185caxis(cax);
186shading interp
187axis xy
188hold on
189    mapshow(S,'Color',[0 0 0])
190    colorbar
191axis(LIM);
192colormap(cmap);
193title('Okubo-Weiss parameter of the corrected field');
194
195if osave
196    print('-dpng','-r300',[outdir 'okubo_weiss_analyse.png']);
197    savefig([outdir 'okubo_weiss_analyse.fig']);
198end
199
Note: See TracBrowser for help on using the repository browser.