1 | %% Script used to load data from Pierre-Marie Poulain and save it in the YAO format |
---|
2 | |
---|
3 | |
---|
4 | %% Parametrization of the script |
---|
5 | start_time = '20130827T130000'; |
---|
6 | end_time='20130915T190000'; |
---|
7 | |
---|
8 | %directory/files containing data |
---|
9 | indir='../altifloat/'; |
---|
10 | filename='*.mat'; |
---|
11 | |
---|
12 | %directory/file to save the obs file |
---|
13 | outdir='../obs_float'; |
---|
14 | fout=['obs_altifloat_all_' start_time '_' end_time '.dat']; |
---|
15 | |
---|
16 | %step time in day (6h=0?25). Discard all time that doesn not fit |
---|
17 | dt=0.25 |
---|
18 | |
---|
19 | %meshfile to interpolate |
---|
20 | meshfile = '../obs_float/meshgrid3.dat'; |
---|
21 | %% THE SCRIPT - NORMALLY NOT TO BE MODIFIED |
---|
22 | |
---|
23 | stime_num=datenum(start_time,'yyyymmddTHHMMSS'); |
---|
24 | etime_num=datenum(end_time,'yyyymmddTHHMMSS'); |
---|
25 | |
---|
26 | id=1; |
---|
27 | |
---|
28 | MM=[]; %output matrix to be saved |
---|
29 | |
---|
30 | Fdir=dir([indir filename]); |
---|
31 | |
---|
32 | for j=1:length(Fdir) |
---|
33 | |
---|
34 | load([indir Fdir(j).name]); |
---|
35 | |
---|
36 | %Prendre à Epsilon prÚs |
---|
37 | I=find(time>=stime_num & time<=etime_num); |
---|
38 | |
---|
39 | if (length(I)>2) %%at least two positions of the drifter |
---|
40 | fprintf(1,'Drifter #%d starting at %s: ',id,datestr(time(1))); |
---|
41 | [x,y,t,M] = obs2yao(lon,lat,time,stime_num,dt,meshfile,id); |
---|
42 | fprintf(1,'%d position selected\n',length(t)); |
---|
43 | if ~isempty(M) |
---|
44 | id=id+1; |
---|
45 | MM=[MM;M]; %Ã arrondir |
---|
46 | end |
---|
47 | end %length(I)>2 |
---|
48 | |
---|
49 | end %for j |
---|
50 | |
---|
51 | save([outdir fout],'-ascii','MM'); |
---|