1 | %small experiment along the Lebanese coast |
---|
2 | |
---|
3 | %floaters along east coast |
---|
4 | close all; |
---|
5 | clear all; |
---|
6 | write_ini=1; |
---|
7 | |
---|
8 | |
---|
9 | Nlat=58; %Phi |
---|
10 | Nlong=87; %Lambda |
---|
11 | load 'meshgrid2.dat'; |
---|
12 | |
---|
13 | GR_long=reshape(meshgrid2(:,1),Nlong,Nlat); %will give a Nlong by Nlat matrix |
---|
14 | %containing the long of the points |
---|
15 | GR_lat=reshape(meshgrid2(:,2),Nlong,Nlat); %will give a Nlong by Nlat matrix |
---|
16 | %containing the lat of the points |
---|
17 | |
---|
18 | del=GR_long(2)-GR_long(1); |
---|
19 | |
---|
20 | |
---|
21 | %for plotting |
---|
22 | load ../obs_float/uzero.dat; |
---|
23 | load ../obs_float/vzero.dat; |
---|
24 | uu=reshape(uzero(:,4),58,87); |
---|
25 | vv=reshape(vzero(:,4),58,87); |
---|
26 | |
---|
27 | |
---|
28 | %5 cities in lebanon: Tripoli, Beirut, Byblos, Tyre and Nacoura |
---|
29 | |
---|
30 | |
---|
31 | %translate from long and lat in degrees to mesh points |
---|
32 | [cc1 v1]=find(abs(GR_long-35.53)<del/2); |
---|
33 | [u2 cc2]=find(abs(GR_lat-34.41)<del/2); |
---|
34 | f1_1=cc1(1)+((35.53-GR_long(cc1(1)))./del); |
---|
35 | f1_2=cc2(1)+((34.41-GR_lat(1,cc2(1)))./del); |
---|
36 | |
---|
37 | |
---|
38 | [bb1 v1]=find(abs(GR_long-35.38)<del/2); |
---|
39 | [u2 bb2]=find(abs(GR_lat-34.12)<del/2); |
---|
40 | f2_1=bb1(1)+((35.38-GR_long(bb1(1)))./del); |
---|
41 | f2_2=bb2(1)+((34.12-GR_lat(1,bb2(1)))./del); |
---|
42 | |
---|
43 | |
---|
44 | [bb1 v1]=find(abs(GR_long-35.253)<del/2); |
---|
45 | [u2 bb2]=find(abs(GR_lat-33.88)<del/2); |
---|
46 | f3_1=bb1(1)+((35.253-GR_long(bb1(1)))./del); |
---|
47 | f3_2=bb2(1)+((33.88-GR_lat(1,bb2(1)))./del); |
---|
48 | |
---|
49 | |
---|
50 | [bb1 v1]=find(abs(GR_long-35.18)<del/2); |
---|
51 | [u2 bb2]=find(abs(GR_lat-33.6)<del/2); |
---|
52 | f4_1=bb1(1)+((35.18-GR_long(bb1(1)))./del); |
---|
53 | f4_2=bb2(1)+((33.6-GR_lat(1,bb2(1)))./del); |
---|
54 | |
---|
55 | [bb1 v1]=find(abs(GR_long-34.98)<del/2); |
---|
56 | [u2 bb2]=find(abs(GR_lat-33.27)<del/2); |
---|
57 | f5_1=bb1(1)+((34.98-GR_long(bb1(1)))./del); |
---|
58 | f5_2=bb2(1)+((33.27-GR_lat(1,bb2(1)))./del); |
---|
59 | |
---|
60 | |
---|
61 | %store in an array |
---|
62 | N_f=5;%number of drifters |
---|
63 | FF=zeros(N_f,2); |
---|
64 | FF(1,:)=[f1_1 f1_2];FF(2,:)=[f2_1 f2_2];FF(3,:)=[f3_1 f3_2];FF(4,:)=[f4_1 f4_2]; |
---|
65 | FF(5,:)=[f5_1 f5_2]; |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | if (write_ini==1) |
---|
70 | FF=FF-1; %yao to matlab conversion (i=0,1, in YAO) |
---|
71 | |
---|
72 | |
---|
73 | %Put in YAO format |
---|
74 | |
---|
75 | xy_vec=ones(N_f*2,1); xy_vec(2:2:end)=2; |
---|
76 | time_vec=ones(N_f*2,1); |
---|
77 | |
---|
78 | %floater id |
---|
79 | Nf_vec=[1; 1]; |
---|
80 | for j=1:N_f-1; |
---|
81 | Nf_vec=[Nf_vec; j+1 ;j+1]; |
---|
82 | end |
---|
83 | |
---|
84 | %the positions |
---|
85 | pos_vec=[FF(1,1); FF(1,2)]; |
---|
86 | for j=2:N_f; |
---|
87 | pos_vec=[pos_vec; FF(j,1); FF(j,2)]; |
---|
88 | end |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | Yao_F=[ floor(xy_vec) floor(time_vec) floor(Nf_vec) pos_vec]; |
---|
93 | |
---|
94 | |
---|
95 | dlmwrite('../obs_float/init5.dat',Yao_F,'\t'); |
---|
96 | |
---|
97 | end; |
---|
98 | |
---|
99 | |
---|
100 | figure; |
---|
101 | quiver(GR_long(45:end,1).',GR_lat(1,:),uu(:,45:end),vv(:,45:end)) |
---|
102 | hold on; |
---|
103 | |
---|
104 | for j=1:N_f |
---|
105 | |
---|
106 | F11=floor(FF(j,1));F22=floor(FF(j,2)); |
---|
107 | alphaLong=(FF(j,1)-F11); |
---|
108 | alphaLat=(FF(j,2)-F22); |
---|
109 | plot( GR_long(F11,F22)+alphaLong*del, GR_lat(F11,F22)+alphaLat*del,'-xr'); |
---|
110 | |
---|
111 | end |
---|
112 | |
---|
113 | xlabel('Longitudes en degrees'); ylabel('Latitudes en degrees'); |
---|