source: altifloat/exp_nemed/plot_article.m @ 222

Last change on this file since 222 was 222, checked in by jbrlod, 8 years ago

add legend to figures

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