1 | %% STEP ONE : produce the meshfile |
---|
2 | |
---|
3 | %meshgrid de Dan |
---|
4 | |
---|
5 | meshfile='../exp_forw_dan/meshgrid_dan.dat'; |
---|
6 | make_meshgrid(meshfile,33,31,36.92572,36.22729,489,438); |
---|
7 | |
---|
8 | %% STEP TWO : transform and interpolate aviso file to YAO file |
---|
9 | dir_uvfiles='../../data/MODEL_CYCO/'; |
---|
10 | aviso_netcdf={[dir_uvfiles 'uveta_cyco1_2013090112.nc']... |
---|
11 | [dir_uvfiles 'uveta_cyco1_2013090212.nc'];}; |
---|
12 | |
---|
13 | it=1:24:1+24*(length(aviso_netcdf)-1); |
---|
14 | |
---|
15 | %meshmask='../exp_forw_dan/meshgrid_dan.dat'; |
---|
16 | outfile='../exp_forw_dan/uv_bck_dan.dat'; |
---|
17 | outmask='../exp_forw_dan/mask_dan.dat'; |
---|
18 | |
---|
19 | dt=1; |
---|
20 | |
---|
21 | interp_bck(aviso_netcdf,it,dt,meshfile,outfile,outmask); |
---|
22 | |
---|
23 | %% Lissage |
---|
24 | outfile_s='../exp_forw_dan/uv_bck_dan_s.dat'; |
---|
25 | |
---|
26 | |
---|
27 | uvb=load(outfile); |
---|
28 | meshg=load(meshfile); |
---|
29 | lon=unique(meshg(:,1)); |
---|
30 | lat=unique(meshg(:,2)); |
---|
31 | nlon=length(lon); |
---|
32 | nlat=length(lat); |
---|
33 | ntime=length(unique(uvb(:,1))); |
---|
34 | Ub=reshape(uvb(:,end-1),nlat,nlon,ntime); |
---|
35 | Vb=reshape(uvb(:,end),nlat,nlon,ntime); |
---|
36 | |
---|
37 | Ub_s=nan*ones(size(Ub)); |
---|
38 | Vb_s=nan*ones(size(Vb)); |
---|
39 | |
---|
40 | K=ones(95,95); |
---|
41 | K=K./sum(K(:)); |
---|
42 | |
---|
43 | for it=1:ntime |
---|
44 | Ub_s(:,:,it)=conv2(Ub(:,:,it),K,'same'); |
---|
45 | Vb_s(:,:,it)=conv2(Vb(:,:,it),K,'same'); |
---|
46 | end |
---|
47 | |
---|
48 | uvb_s=uvb; |
---|
49 | uvb_s(:,end-1) = Ub_s(:); |
---|
50 | uvb_s(:,end) = Vb_s(:); |
---|
51 | dlmwrite(outfile_s,uvb_s,'\t'); |
---|
52 | |
---|
53 | %% STEP THREE : Prepare init |
---|
54 | drifterdir='../altifloat/'; |
---|
55 | initfile='init.dat'; |
---|
56 | fname={'a300234011043340.mat','a300234011120770.mat','a300234011249440.mat'}; |
---|
57 | lon_drift=nan*ones(1,length(fname)); |
---|
58 | lat_drift=lon_drift; |
---|
59 | MM=[]; |
---|
60 | stime_num=datenum('20130901T120000','yyyymmddTHHMMSS'); |
---|
61 | dt=1/24; %one hour |
---|
62 | |
---|
63 | |
---|
64 | for j=1:length(fname) |
---|
65 | load([drifterdir fname{j}]); |
---|
66 | [x,y,t,M]=obs2yao(lon,lat,stime_num,stime_num,dt,meshfile,j); |
---|
67 | MM=[MM;M]; |
---|
68 | |
---|
69 | end % for j |
---|
70 | dlmwrite(['../exp_forw_dan/' initfile],MM,'\t'); |
---|
71 | |
---|
72 | %% STEP OBS : modify obs file |
---|
73 | init=load(['../exp_forw_dan/' initfile]); |
---|
74 | obs=load(['../exp_forw_dan/rfloat_total.dat']); |
---|
75 | |
---|
76 | ilon=find(init(:,1)==1); |
---|
77 | ilat=find(init(:,1)==2); |
---|
78 | |
---|
79 | init=[init(ilon,2)-1 init(ilon,3)-1 init(ilat,4) init(ilon,4)]; |
---|
80 | |
---|
81 | istep=5; |
---|
82 | I=find(obs(:,end)>1e-8); |
---|
83 | obs=obs(I,:); |
---|
84 | |
---|
85 | obs=[init;obs]; |
---|
86 | obs=sortrows(obs,[2 1]); |
---|
87 | |
---|
88 | t=unique(obs(:,1)); |
---|
89 | tech=t(1:istep:end); |
---|
90 | |
---|
91 | I=find(ismember(obs(:,1),tech)); |
---|
92 | obs=obs(I,:); |
---|
93 | dlmwrite(['../exp_forw_dan/obs_jum.dat'],obs,'\t'); |
---|
94 | |
---|
95 | %% Create bck |
---|
96 | aviso_netcdf={[dir_uvfiles 'uveta_cyco1_2013092812.nc']... |
---|
97 | [dir_uvfiles 'uveta_cyco1_2013092912.nc'];}; |
---|
98 | |
---|
99 | it=1:24:1+24*(length(aviso_netcdf)-1); |
---|
100 | |
---|
101 | %meshmask='../exp_forw_dan/meshgrid_dan.dat'; |
---|
102 | outfile='../exp_forw_dan/uv_bck2_dan.dat'; |
---|
103 | outmask='../exp_forw_dan/mask_dan2.dat'; |
---|
104 | |
---|
105 | dt=1; |
---|
106 | |
---|
107 | interp_bck(aviso_netcdf,it,dt,meshfile,outfile,outmask); |
---|
108 | |
---|