source: altifloat/matlab_toolbox/lebanondata.m @ 199

Last change on this file since 199 was 129, checked in by jbrlod, 10 years ago

last version of Varanth

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1%small experiment along the Lebanese coast
2
3%floaters along east coast
4close all;
5clear all;
6write_ini=1;
7
8
9Nlat=58; %Phi
10Nlong=87; %Lambda
11load 'meshgrid2.dat';
12
13GR_long=reshape(meshgrid2(:,1),Nlong,Nlat); %will give a Nlong by Nlat matrix
14%containing the long of the points
15GR_lat=reshape(meshgrid2(:,2),Nlong,Nlat); %will give a Nlong by Nlat matrix
16%containing the lat of the points
17
18del=GR_long(2)-GR_long(1);
19
20
21%for plotting
22load ../obs_float/uzero.dat;
23load ../obs_float/vzero.dat;
24uu=reshape(uzero(:,4),58,87);
25vv=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);
34f1_1=cc1(1)+((35.53-GR_long(cc1(1)))./del);
35f1_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);
40f2_1=bb1(1)+((35.38-GR_long(bb1(1)))./del);
41f2_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);
46f3_1=bb1(1)+((35.253-GR_long(bb1(1)))./del);
47f3_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);
52f4_1=bb1(1)+((35.18-GR_long(bb1(1)))./del);
53f4_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);
57f5_1=bb1(1)+((34.98-GR_long(bb1(1)))./del);
58f5_2=bb2(1)+((33.27-GR_lat(1,bb2(1)))./del);
59
60
61%store in an array
62N_f=5;%number of drifters
63FF=zeros(N_f,2);
64FF(1,:)=[f1_1 f1_2];FF(2,:)=[f2_1 f2_2];FF(3,:)=[f3_1 f3_2];FF(4,:)=[f4_1 f4_2];
65FF(5,:)=[f5_1 f5_2];
66
67
68
69if (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   
97end;
98
99
100figure;
101quiver(GR_long(45:end,1).',GR_lat(1,:),uu(:,45:end),vv(:,45:end))
102hold on;
103
104for j=1:N_f
105
106F11=floor(FF(j,1));F22=floor(FF(j,2));
107alphaLong=(FF(j,1)-F11);
108alphaLat=(FF(j,2)-F22);
109plot(   GR_long(F11,F22)+alphaLong*del, GR_lat(F11,F22)+alphaLat*del,'-xr');
110
111end
112
113xlabel('Longitudes en degrees'); ylabel('Latitudes en degrees');
Note: See TracBrowser for help on using the repository browser.