Changeset 145 for altifloat


Ignore:
Timestamp:
04/06/15 19:15:40 (9 years ago)
Author:
jbrlod
Message:

prepare model dan

Location:
altifloat/matlab_toolbox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • altifloat/matlab_toolbox/script_perso.m

    r144 r145  
    66%ut=load([ indir 'uzero.dat']); 
    77%vt=load([ indir 'vzero.dat']); 
    8 robs=load([ indir 'rfloat_total.dat']); 
    9 rsim=load([ indir 'rfloat_total_jum0.dat']); 
    10 uvb=load([ indir 'uv_bck_dan.dat']); 
    11 uv=load([indir 'uv_total_jum0.dat']); 
     8robs=load([ indir 'obs_jum.dat']); 
     9rsim=load([ indir 'rfloat_total_jum1.dat']); 
     10uvb=load([ indir 'uv_bck_dan_s.dat']); 
     11uvt=load([ indir 'uv_bck_dan.dat']); 
     12uvr=load([indir 'uv_total_jum1.dat']); 
    1213meshg=load([indir 'meshgrid_dan.dat']); 
    1314drifterdir='../altifloat/'; 
     
    1718iech=3; 
    1819jech=3; 
    19 LIM=[34.9 35.3 33.25 33.6]; 
     20LIM=[34.8 35.3 33.2 33.6]; 
    2021%Format : t/s, ilon, ilat, val 
    2122 
     
    4849 
    4950%it, ilon,ilat,u,v 
    50 ntime=length(unique(uv(:,1))); 
    51 Ur=reshape(uv(:,end-1),nlat,nlon,ntime); 
    52 Vr=reshape(uv(:,end),nlat,nlon,ntime); 
     51ntime=length(unique(uvr(:,1))); 
     52Ur=reshape(uvr(:,end-1),nlat,nlon,ntime); 
     53Vr=reshape(uvr(:,end),nlat,nlon,ntime); 
    5354 
    54 Hb=quiver(Lon(1:jech:end,1:iech:end),Lat(1:jech:end,1:iech:end),mean(Ub(1:jech:end,1:iech:end,1),3),mean(Vb(1:jech:end,1:iech:end,1),3),'b'); 
     55ntime=length(unique(uvt(:,1))); 
     56Ut=reshape(uvt(:,end-1),nlat,nlon,ntime); 
     57Vt=reshape(uvt(:,end),nlat,nlon,ntime); 
     58 
     59Hr=quiver(Lon(1:jech:end,1:iech:end),Lat(1:jech:end,1:iech:end),mean(Ur(1:jech:end,1:iech:end,1:end-1),3), ... 
     60          mean(Vr(1:jech:end,1:iech:end,1:end-1),3),'r'); 
     61hold on 
     62Hb=quiver(Lon(1:jech:end,1:iech:end),Lat(1:jech:end,1:iech:end),mean(Ub(1:jech:end,1:iech:end,1:end-1),3),mean(Vb(1:jech:end,1:iech:end,1:end-1),3),'b'); 
    5563 
    5664%Ht=quiver(Ut,Vt,'g'); 
    57 hold on 
     65 
    5866 
    5967for j=1:nfloat      
    6068  data= load([drifterdir fname{j}]); 
    6169   
    62   rfloat=robs(robs(:,2)==j-1&robs(:,end)>0,[end-1 end]); 
    63   rfloat_lon=interp1(1:nlon,lon,rfloat(:,2)+1); 
    64   rfloat_lat=interp1(1:nlat,lat',rfloat(:,1)+1); 
    65   Hobs=plot([data.lon(1);rfloat_lon],[data.lat(1);rfloat_lat],'.-b'); 
     70 
    6671   
    6772  rfloat=rsim(rsim(:,2)==j-1&rsim(:,end)>0,[end-1 end]); 
     
    6974  rfloat_lat=interp1(1:nlat,lat',rfloat(:,1)+1); 
    7075  Hsim=plot([data.lon(1);rfloat_lon],[data.lat(1);rfloat_lat],'.-r'); 
    71    
     76    rfloat=robs(robs(:,2)==j-1&robs(:,end)>0,[end-1 end]); 
     77  rfloat_lon=interp1(1:nlon,lon,rfloat(:,2)+1); 
     78  rfloat_lat=interp1(1:nlat,lat',rfloat(:,1)+1); 
     79  Hobs=plot([data.lon(1);rfloat_lon],[data.lat(1);rfloat_lat],'.-m'); 
    7280 
    7381  %   plot(rfloat(:,2)+1,rfloat(:,1)+1,'.-m'); 
    7482 
    75   Hreal=plot(data.lon(1:4),data.lat(1:4),'.-k') 
     83  % Hreal=plot(data.lon(1:4),data.lat(1:4),'.-k') 
    7684   
    7785end 
    7886 
    79 Hb=quiver(Lon(1:jech:end,1:iech:end),Lat(1:jech:end,1:iech:end),mean(Ur(1:jech:end,1:iech:end,1),3),mean(Vr(1:jech:end,1:iech:end,1),3),'b'); 
     87 
     88Ht=quiver(Lon(1:jech:end,1:iech:end),Lat(1:jech:end,1:iech:end),mean(Ut(1:jech:end,1:iech:end,1:end-1),3),mean(Vt(1:jech:end,1:iech:end,1:end-1),3),'m'); 
    8089axis(LIM); 
    8190 
     
    8695 
    8796%legend([Hb Hr],'background','retrieved','Location','SouthEast'); 
    88 legend([Hobs Hsim],'real traj.','simulated traj'); 
     97legend([Hb Hr Ht],'background.','retrieved','truth'); 
    8998 
    90 print -dpng ../exp_forw_dan/simu_drifter_dan.png 
     99%print -dpng ../exp_forw_dan/simu_drifter_dan.png 
    91100 
     101 
     102 
     103delta_b=sqrt(mean((Ut(:,:,1:end-1)-Ub(:,:,1:end-1)),3).^2+mean((Vt(:,:,1:end-1)-Vb(:,:,1:end-1)),3).^2); 
     104delta_r=sqrt(mean((Ut(:,:,1:end-1)-Ur(:,:,1:end-1)),3).^2+mean((Vt(:,:,1:end-1)-Vr(:,:,1:end-1)),3).^2); 
     105delta_inc=sqrt(mean((Ub(:,:,1:end-1)-Ur(:,:,1:end-1)),3).^2+mean((Vb(:,:,1:end-1)-Vr(:,:,1:end-1)),3).^2); 
     106 
     107cscale=[0 5e-4]; 
     108 
     109figure(2) 
     110subplot(2,2,1) 
     111imagesc(lon,lat,delta_b,cscale); 
     112axis xy;axis(LIM); 
     113hold on 
     114for j=1:3 
     115   data= load([drifterdir fname{j}]); 
     116  rfloat=robs(robs(:,2)==j-1&robs(:,end)>0,[end-1 end]); 
     117  rfloat_lon=interp1(1:nlon,lon,rfloat(:,2)+1); 
     118  rfloat_lat=interp1(1:nlat,lat',rfloat(:,1)+1); 
     119plot([data.lon(1);rfloat_lon],[data.lat(1);rfloat_lat],'o-m'); 
     120end 
     121title('Backround error'); 
     122 
     123 
     124subplot(2,2,2) 
     125imagesc(lon,lat,delta_r,cscale); 
     126axis xy;axis(LIM); 
     127hold on 
     128for j=1:3 
     129   data= load([drifterdir fname{j}]); 
     130  rfloat=robs(robs(:,2)==j-1&robs(:,end)>0,[end-1 end]); 
     131  rfloat_lon=interp1(1:nlon,lon,rfloat(:,2)+1); 
     132  rfloat_lat=interp1(1:nlat,lat',rfloat(:,1)+1); 
     133plot([data.lon(1);rfloat_lon],[data.lat(1);rfloat_lat],'o-m'); 
     134end 
     135 
     136title('Analysis error'); 
     137 
     138 
     139 
     140subplot(2,2,4) 
     141imagesc(lon,lat,delta_inc); 
     142axis xy;axis(LIM); 
     143colorbar 
     144hold on 
     145for j=1:3 
     146   data= load([drifterdir fname{j}]); 
     147  rfloat=robs(robs(:,2)==j-1&robs(:,end)>0,[end-1 end]); 
     148  rfloat_lon=interp1(1:nlon,lon,rfloat(:,2)+1); 
     149  rfloat_lat=interp1(1:nlat,lat',rfloat(:,1)+1); 
     150plot([data.lon(1);rfloat_lon],[data.lat(1);rfloat_lat],'o-m'); 
     151end 
     152title('Increment'); 
     153 
     154 
     155%print -f1 -dpng ../exp_forw_dan/twin_exp_uv_field.png 
     156%print -f2 -dpng ../exp_forw_dan/twin_exp_errors.png 
     157 
     158%% Erreur le long du trajet 
     159if(false) 
     160Id=0; 
     161for id=Id 
     162  figure(5+id) 
     163  I=find(robs(:,2)==id-1); 
     164  Xq=robs(I,end)+1; 
     165  Yq=robs(I,end-1)+1; 
     166  Tq=robs(I,1)+1; 
     167   
     168  err_b=interp3(1:nlon,1:nlat,1:ntime,delta_b,Xq,Yq,Tq); 
     169  err_r=interp3(1:nlon,1:nlat,1:ntime,delta_r,Xq,Yq,Tq); 
     170  incr=interp3(1:nlon,1:nlat,1:ntime,delta_inc,Xq,Yq,Tq); 
     171end %id 
     172end %if false 
  • altifloat/matlab_toolbox/script_prepare_exp_modele.m

    r144 r145  
    2121interp_bck(aviso_netcdf,it,dt,meshfile,outfile,outmask); 
    2222 
     23%% Lissage 
     24outfile_s='../exp_forw_dan/uv_bck_dan_s.dat'; 
     25 
     26 
     27uvb=load(outfile); 
     28meshg=load(meshfile); 
     29lon=unique(meshg(:,1)); 
     30lat=unique(meshg(:,2)); 
     31nlon=length(lon); 
     32nlat=length(lat); 
     33ntime=length(unique(uvb(:,1))); 
     34Ub=reshape(uvb(:,end-1),nlat,nlon,ntime); 
     35Vb=reshape(uvb(:,end),nlat,nlon,ntime); 
     36 
     37Ub_s=nan*ones(size(Ub)); 
     38Vb_s=nan*ones(size(Vb)); 
     39 
     40K=ones(95,95); 
     41K=K./sum(K(:)); 
     42 
     43for it=1:ntime 
     44Ub_s(:,:,it)=conv2(Ub(:,:,it),K,'same'); 
     45Vb_s(:,:,it)=conv2(Vb(:,:,it),K,'same'); 
     46end 
     47 
     48uvb_s=uvb; 
     49uvb_s(:,end-1) = Ub_s(:); 
     50uvb_s(:,end)   = Vb_s(:); 
     51dlmwrite(outfile_s,uvb_s,'\t'); 
     52 
    2353%% STEP THREE : Prepare init 
    2454drifterdir='../altifloat/'; 
     
    4070dlmwrite(['../exp_forw_dan/' initfile],MM,'\t'); 
    4171 
    42 %STEP OBS : modify obs file 
     72%% STEP OBS : modify obs file 
     73init=load(['../exp_forw_dan/' initfile]); 
     74obs=load(['../exp_forw_dan/rfloat_total.dat']); 
    4375 
     76ilon=find(init(:,1)==1); 
     77ilat=find(init(:,1)==2); 
     78 
     79init=[init(ilon,2)-1 init(ilon,3)-1 init(ilat,4) init(ilon,4)]; 
     80 
     81istep=5; 
     82I=find(obs(:,end)>1e-8); 
     83obs=obs(I,:); 
     84 
     85obs=[init;obs]; 
     86obs=sortrows(obs,[2 1]); 
     87 
     88t=unique(obs(:,1)); 
     89tech=t(1:istep:end); 
     90 
     91I=find(ismember(obs(:,1),tech)); 
     92obs=obs(I,:); 
     93dlmwrite(['../exp_forw_dan/obs_jum.dat'],obs,'\t'); 
     94 
     95%% Create bck 
     96aviso_netcdf={[dir_uvfiles 'uveta_cyco1_2013092812.nc']... 
     97              [dir_uvfiles 'uveta_cyco1_2013092912.nc'];}; 
     98 
     99it=1:24:1+24*(length(aviso_netcdf)-1); 
     100 
     101%meshmask='../exp_forw_dan/meshgrid_dan.dat'; 
     102outfile='../exp_forw_dan/uv_bck2_dan.dat'; 
     103outmask='../exp_forw_dan/mask_dan2.dat'; 
     104 
     105dt=1; 
     106 
     107interp_bck(aviso_netcdf,it,dt,meshfile,outfile,outmask); 
     108 
Note: See TracChangeset for help on using the changeset viewer.