1 | close all |
---|
2 | clear all |
---|
3 | |
---|
4 | |
---|
5 | addpath('../matlab_toolbox'); |
---|
6 | osave = true; |
---|
7 | |
---|
8 | indir='../exp_nemed/'; |
---|
9 | outdir = '../doc/ocean_modelling/fig/'; |
---|
10 | load ../../data/coastlines-split-4326/east_med.mat |
---|
11 | |
---|
12 | |
---|
13 | robs=load([ indir 'obs.dat']); |
---|
14 | rsim=load([ indir 'rfloat_nodiv.dat']); |
---|
15 | uvb=load([ indir 'uv_back_aviso.dat']); |
---|
16 | |
---|
17 | uvr=load([indir 'uv_tot_nodiv.dat']); |
---|
18 | |
---|
19 | meshg=load([indir 'meshgrid_aviso.dat']); |
---|
20 | mask = load([indir 'mask_aviso.dat']); |
---|
21 | |
---|
22 | iech=1; |
---|
23 | jech=1; |
---|
24 | %LIM=[34.5 36 32.5 35]; |
---|
25 | LON = [33.5 35.6]; |
---|
26 | LAT = [32.5 35]; |
---|
27 | LIM= [LON LAT]; |
---|
28 | |
---|
29 | %nlon=87; |
---|
30 | %nlat=58; |
---|
31 | lon=unique(meshg(:,1)); |
---|
32 | lat=unique(meshg(:,2)); |
---|
33 | nlon=length(lon); |
---|
34 | nlat=length(lat); |
---|
35 | |
---|
36 | [Lon,Lat]=meshgrid(lon',lat); |
---|
37 | Mask = reshape(mask,[nlon,nlat]); |
---|
38 | Mask = Mask'; |
---|
39 | |
---|
40 | nfloat=length(unique(robs(:,2))); |
---|
41 | |
---|
42 | %% To change unit |
---|
43 | %change grid from unitless to m/s |
---|
44 | |
---|
45 | R_earth=6371229; %in meters |
---|
46 | delta_x=zeros(nlat,nlon); |
---|
47 | delta_y=zeros(nlat,nlon); |
---|
48 | |
---|
49 | for 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 | |
---|
56 | end |
---|
57 | end |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | delta_x(1:nlat,nlon)=delta_x(1:nlat,nlon); |
---|
62 | delta_y(1:nlat,nlon)=delta_y(1:nlat,nlon); |
---|
63 | |
---|
64 | |
---|
65 | delta_x(nlat,1:nlon)=delta_x(nlat-1,1:nlon); |
---|
66 | delta_y(nlat,1:nlon)=delta_y(nlat-1,1:nlon); |
---|
67 | |
---|
68 | |
---|
69 | %% Reshape wind data |
---|
70 | %it, ilon,ilat,u,v |
---|
71 | ntime=length(unique(uvb(:,1))); |
---|
72 | Ub=reshape(uvb(:,end-1),nlat,nlon,ntime); |
---|
73 | Vb=reshape(uvb(:,end),nlat,nlon,ntime); |
---|
74 | |
---|
75 | Ubms = Ub .* repmat(delta_x,1,1,ntime); |
---|
76 | Vbms = Vb .* repmat(delta_x,1,1,ntime); |
---|
77 | |
---|
78 | %it, ilon,ilat,u,v |
---|
79 | ntime=length(unique(uvr(:,1))); |
---|
80 | Ur=reshape(uvr(:,end-1),nlat,nlon,ntime); |
---|
81 | Vr=reshape(uvr(:,end),nlat,nlon,ntime); |
---|
82 | Ur(repmat(Mask,1,1,ntime)==0)=0; |
---|
83 | Vr(repmat(Mask,1,1,ntime)==0)=0; |
---|
84 | |
---|
85 | %Ur(Ub<1e-15)=0; |
---|
86 | %Vr(Vb<1e-15)=0; |
---|
87 | Urms = Ur .* repmat(delta_x,1,1,ntime); |
---|
88 | Vrms = 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)); |
---|
93 | Urms(ileg,jleg,:) = 1; |
---|
94 | %Ubms(ileg-1,jleg,:) = 1; |
---|
95 | |
---|
96 | %% Plots |
---|
97 | figure(1) |
---|
98 | clf |
---|
99 | Hr=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'); |
---|
101 | hold on |
---|
102 | Hb=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 | |
---|
107 | for 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 | |
---|
118 | end |
---|
119 | |
---|
120 | |
---|
121 | |
---|
122 | |
---|
123 | |
---|
124 | |
---|
125 | %Ajout des trajectoires réelles |
---|
126 | axis(LIM); |
---|
127 | mapshow(S,'Color',[0 0 0]); |
---|
128 | |
---|
129 | legend([Hb Hr Hobs],'Averaged over 9 days : background','Corrected','Drifter trajectory','Location','SouthWest'); |
---|
130 | text(35.33,32.75,'1 m/s') |
---|
131 | %print -dpng ../exp_forw_dan/simu_drifter_dan.png |
---|
132 | |
---|
133 | if osave |
---|
134 | print('-dpng','-r300',[outdir 'Eddy_velocity.png']); |
---|
135 | savefig([outdir 'Eddy_velocity.fig']); |
---|
136 | end |
---|
137 | |
---|
138 | |
---|
139 | %% eddy |
---|
140 | cax = [-10 10].*1e-10; |
---|
141 | cmap = scol_dif_lin(100,cax); |
---|
142 | |
---|
143 | figure(2); |
---|
144 | clf |
---|
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 | |
---|
156 | owb = okubo_weiss(Uxb,Uyb,Vxb,Vyb); |
---|
157 | |
---|
158 | imagesc(lon',lat,owb(1:iech:end,1:iech:end)); |
---|
159 | caxis(cax); |
---|
160 | axis xy |
---|
161 | shading interp |
---|
162 | hold on |
---|
163 | mapshow(S,'Color',[0 0 0]); |
---|
164 | colorbar |
---|
165 | axis(LIM); |
---|
166 | colormap(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 | |
---|
175 | owr = okubo_weiss(Uxr,Uyr,Vxr,Vyr); |
---|
176 | title('Okubo-Weiss parameter of the Background'); |
---|
177 | if osave |
---|
178 | print('-dpng','-r300',[outdir 'okubo_weiss_aviso.png']); |
---|
179 | savefig([outdir 'okubo_weiss_aviso.fig']); |
---|
180 | end |
---|
181 | |
---|
182 | figure(3) |
---|
183 | clf |
---|
184 | imagesc(lon',lat,owr(1:iech:end,1:iech:end)); |
---|
185 | caxis(cax); |
---|
186 | shading interp |
---|
187 | axis xy |
---|
188 | hold on |
---|
189 | mapshow(S,'Color',[0 0 0]) |
---|
190 | colorbar |
---|
191 | axis(LIM); |
---|
192 | colormap(cmap); |
---|
193 | title('Okubo-Weiss parameter of the corrected field'); |
---|
194 | |
---|
195 | if osave |
---|
196 | print('-dpng','-r300',[outdir 'okubo_weiss_analyse.png']); |
---|
197 | savefig([outdir 'okubo_weiss_analyse.fig']); |
---|
198 | end |
---|
199 | |
---|