source: altifloat/matlab_toolbox/read_nemed.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: 7.1 KB
Line 
1close all
2clear all
3dirnem='nemed/';
4nemlist='liste_perso';
5format long
6fid=fopen([dirnem nemlist],'r');
7count=1;
8float_obs=[];
9index=[];
10while 1
11            tline = fgetl(fid);
12                 disp(tline)
13            if ~ischar(tline), break, end
14            lon=ncread([dirnem tline],'longitudes');
15            lat=ncread([dirnem tline],'latitudes');
16            pdt=ncread([dirnem tline],'time');
17           
18            M=zeros(size(lat,1),4);
19            M(:,1)=count;
20            M(:,2)=pdt/365.25;
21            M(:,3)=lon;
22            M(:,4)=lat;
23            [m1,n1]=size(M);
24            index=[index;m1]
25            float_obs=[float_obs;M];
26            count=count+1;
27end
28
29[m,n]=size(float_obs)
30fclose(fid);
31
32
33% figure (1)
34%     I=find(float_obs(:,1)==1);
35%     plot(float_obs(I,3),float_obs(I,4),'m');
36%     hold on;
37%   
38%     I2=find(float_obs(:,1)==2);
39%     I2
40%     size2=size(I2)
41%     plot(float_obs(I2,3),float_obs(I2,4),'r');
42%     hold on;
43%     
44%     I=find(float_obs(:,1)==3);
45%     plot(float_obs(I,3),float_obs(I,4),'b');
46%     hold on;
47%     
48%     I=find(float_obs(:,1)==4);
49%     plot(float_obs(I,3),float_obs(I,4),'g');
50%     hold on;
51%     
52%     I=find(float_obs(:,1)==5);
53%     plot(float_obs(I,3),float_obs(I,4),'g');
54%     hold on;
55%     
56%     I6=find(float_obs(:,1)==6);
57%     I6
58%     size6=size(I6)
59%     plot(float_obs(I6,3),float_obs(I6,4),'c');
60%     hold on;
61%     
62%     I=find(float_obs(:,1)==7);
63%     plot(float_obs(I,3),float_obs(I,4),'k');
64%     hold on;
65%     
66%     I=find(float_obs(:,1)==8);
67%     plot(float_obs(I,3),float_obs(I,4),'--b');
68%     hold on;
69%     
70   
71   
72%     figure(2)
73%     axis([0 37 2008 2012])
74% hold on
75% grid on
76% hold on
77%     
78%     I=find(float_obs(:,1)==1);
79%     plot(float_obs(I,1),float_obs(I,2),'m');
80%     hold on;
81%   
82%     I=find(float_obs(:,1)==2);
83%     plot(float_obs(I,1),float_obs(I,2),'r');
84%     hold on;
85%     
86%     I=find(float_obs(:,1)==3);
87%     plot(float_obs(I,1),float_obs(I,2),'b');
88%     hold on;
89%     
90%     I=find(float_obs(:,1)==4);
91%     plot(float_obs(I,1),float_obs(I,2),'m');
92%     hold on;
93%     
94%     I=find(float_obs(:,1)==5);
95%     plot(float_obs(I,1),float_obs(I,2),'g');
96%     hold on;
97%     
98%     I=find(float_obs(:,1)==6);
99%     plot(float_obs(I,1),float_obs(I,2),'c');
100%     hold on;
101%     
102%     I=find(float_obs(:,1)==7);
103%     plot(float_obs(I,1),float_obs(I,2),'k');
104%     hold on;
105%     
106%     
107%     I=find(float_obs(:,1)==8);
108%     plot(float_obs(I,1),float_obs(I,2),'--b');
109%     hold on;
110%     
111%      I=find(float_obs(:,1)==9);
112%     plot(float_obs(I,3),float_obs(I,4),'--b');
113%     hold on;
114%     
115%      I=find(float_obs(:,1)==10);
116%     plot(float_obs(I,3),float_obs(I,4),'--b');
117%     hold on;
118%     
119%      I=find(float_obs(:,1)==11);
120%     plot(float_obs(I,3),float_obs(I,4),'--b');
121%     hold on;
122%     
123%      I=find(float_obs(:,1)==12);
124%     plot(float_obs(I,3),float_obs(I,4),'--b');
125%     hold on;
126%     
127%      I=find(float_obs(:,1)==13);
128%     plot(float_obs(I,3),float_obs(I,4),'--r');
129%     hold on;
130%     
131%      I=find(float_obs(:,1)==14);
132%     plot(float_obs(I,3),float_obs(I,4),'--k');
133%     hold on;
134%     
135%      I=find(float_obs(:,1)==15);
136%     plot(float_obs(I,3),float_obs(I,4),'--b');
137%     hold on;
138%     
139%      I=find(float_obs(:,1)==16);
140%     plot(float_obs(I,3),float_obs(I,4),'--b');
141%     hold on;
142%     
143%      I=find(float_obs(:,1)==17);
144%     plot(float_obs(I,3),float_obs(I,4),'--b');
145%     hold on;
146%     
147%      I=find(float_obs(:,1)==18);
148%     plot(float_obs(I,3),float_obs(I,4),'--b');
149%     hold on;
150%     
151%      I=find(float_obs(:,1)==19);
152%     plot(float_obs(I,3),float_obs(I,4),'--b');
153%     hold on;
154%     
155%      I=find(float_obs(:,1)==20);
156%     plot(float_obs(I,3),float_obs(I,4),'--b');
157%     hold on;
158%     
159%      I=find(float_obs(:,1)==21);
160%     plot(float_obs(I,3),float_obs(I,4),'--b');
161%     hold on;
162%     
163%      I=find(float_obs(:,1)==22);
164%     plot(float_obs(I,3),float_obs(I,4),'--b');
165%     hold on;
166%     
167%      I=find(float_obs(:,1)==23);
168%     plot(float_obs(I,3),float_obs(I,4),'--b');
169%     hold on;
170%     
171%      I=find(float_obs(:,1)==24);
172%     plot(float_obs(I,3),float_obs(I,4),'--b');
173%     hold on;
174%     
175%      I=find(float_obs(:,1)==25);
176%     plot(float_obs(I,3),float_obs(I,4),'--b');
177%     hold on;
178%     
179%      I=find(float_obs(:,1)==26);
180%     plot(float_obs(I,3),float_obs(I,4),'--b');
181%     hold on;
182%     
183%      I=find(float_obs(:,1)==27);
184%     plot(float_obs(I,3),float_obs(I,4),'--b');
185%     hold on;
186%     
187%      I=find(float_obs(:,1)==28);
188%     plot(float_obs(I,3),float_obs(I,4),'--b');
189%     hold on;
190%     
191%      I=find(float_obs(:,1)==29);
192%     plot(float_obs(I,3),float_obs(I,4),'--b');
193%     hold on;
194%     
195%      I=find(float_obs(:,1)==30);
196%     plot(float_obs(I,3),float_obs(I,4),'--b');
197%     hold on;
198%     
199%      I=find(float_obs(:,1)==31);
200%     plot(float_obs(I,3),float_obs(I,4),'--b');
201%     hold on;
202%     
203%      I=find(float_obs(:,1)==32);
204%     plot(float_obs(I,3),float_obs(I,4),'--b');
205%     hold on;
206%     
207%      I=find(float_obs(:,1)==33);
208%     plot(float_obs(I,3),float_obs(I,4),'--b');
209%     hold on;
210%     
211%      I=find(float_obs(:,1)==34);
212%     plot(float_obs(I,3),float_obs(I,4),'--b');
213%     hold on;
214%     
215%      I=find(float_obs(:,1)==35);
216%     plot(float_obs(I,3),float_obs(I,4),'--b');
217%     hold on;
218%     
219%      I=find(float_obs(:,1)==36);
220%     plot(float_obs(I,3),float_obs(I,4),'--b');
221%     hold on;
222
223   
224   
225   firstcol=ones(m,1);
226   
227    float_obs(:,5)=float_obs(:,1);
228    float_obs(:,1)=ones(m,1);
229    float_obs(:,6)=float_obs(:,3);
230    float_obs(:,3)=float_obs(:,5);
231    float_obs(:,7)=float_obs(:,4);
232    float_obs(:,4)=float_obs(:,6);
233   
234   
235
236   
237   
238    outfile='obs_float/nemed_observations.dat';
239format long
240 files=fopen(outfile,'w');
241 fprintf(files,'%d %d %d %f\n',float_obs(:,1:4)');
242 
243     float_obs(:,1)=firstcol+1;
244
245 fprintf(files,'%d %d %d %f\n',float_obs(:,[1,2,3,7])');
246
247 fclose(files);
248 
249 
250load obs_float/meshgrid2.dat
251
252Nlat=58; %Phi
253Nlong=87; %Lambda
254GR_long=reshape(meshgrid2(:,1),Nlong,Nlat);
255GR_lat=reshape(meshgrid2(:,2),Nlong,Nlat);
256load obs_float/nemed_observations.dat
257I=find(nemed_observations(:,1)==1);
258hold on
259xi=interp1(GR_long(:,1),1:Nlong,nemed_observations(I,end));
260xi(1:10)
261I=find(nemed_observations(:,1)==2);
262yi=interp1(GR_lat(1,:),1:Nlat,nemed_observations(I,end));
263
264    float_obs(:,1)=firstcol;
265
266    float_obs(:,4)=xi;
267    float_obs(:,7)=yi;
268
269   
270 outfile='obs_float/nemed_observations_2.dat';
271format long
272 files=fopen(outfile,'w');
273 fprintf(files,'%d %d %d %f\n',float_obs(:,1:4)');
274 
275     float_obs(:,1)=firstcol+1;
276
277 fprintf(files,'%d %d %d %f\n',float_obs(:,[1,2,3,7])');
278
279 fclose(files);
280
281
282%  outfile='scripts/matlab_toolbox/nemed_observations_final.dat';
283% load scripts/matlab_toolbox/nemed_observations_2.dat;
284% [d,f]=size(nemed_observations_2)
285% floater1=zeros(d,f);
286% count1=1;
287% count2=1;
288% nboff=8;
289% for i=1:d/2
290%         floater(count1,:)=nemed_observations_2(i,:);
291%         floater(count1+1,:)=nemed_observations_2(i+d/2,:);
292%
293%         count1=count1+2;
294%   
295% end
296%
297% fid=fopen(outfile,'w');
298% fprintf(fid,'%d %d %d %f\n',floater');
299% fclose(fid);
300
301%
302
303
304
305
Note: See TracBrowser for help on using the repository browser.