%Entrées/sorties de sinobad.i
%restart : 400 pas de temps sans tourbillon
%xistate_init 1 ../data_in/file_rest/GYRE_00000400_restart.nc

%init/ebauche : ta 400 pas de temps forward standard
%loadstate ta_c 1 ijk 0 a 1 ../data_in/start_in_tb/ta_start400.dat D

%obs : tb 23 pour x=16,y=12,z=1, perturbé à 19°
%loadobs tb  1   ijk   23    A       1       ../data_out/tb_obs20_2.dat D   

clear all
close all
f=netcdf('/usr/home/mblod/neuro/nemo/nemo_opa/TRY_STYX/modipsl/config/GYRE/EXP00/mesh_mask.nc','nowrite');
lati=f{'nav_lat'}(2:21,2:31);
longi=f{'nav_lon'}(2:21,2:31);
%load ../test_ta.dat
%nbtp2=4;
load ../ta_c_yao.dat
load ../ta_c_true.dat
load ../../data_in/start_in_tb/ta_start400.dat %sortie au pas de temps 400 avant asselin
ta_init=ta_start400;
Tclim=[13.5 23];
%Tclim=[3 9];
nl=13;
icontour=1;
nx=32;
ny=22;

[tby I1]=xreshape_at_levelk(ta_c_yao,nx,ny,1);
tby=tby(2:21,2:31);

[tbt I1]=xreshape_at_levelk(ta_c_true,nx,ny,1);
tbt=tbt(2:21,2:31);

tbi=xreshape_at_levelk(ta_init,nx,ny,I1);
tbi=tbi(2:21,2:31);



%return

figure(1)
%set(gcf,'position',[10 600 700 300])
set(gcf,'position',[10 600 700 300])
%set(gcf,'position',[1600 600 420 500])

subplot(1,3,1)
set(gca,'Position',[0.09 0.23 0.26 0.76])
%set(gca,'Position',[0.09 0.6 0.32 0.38])

if icontour==1,
  contour(longi,lati,tbt,nl)   
else
    pcolor(longi,lati,tbt);colorbar
end

shading flat %interp 
xlabel('t_{bt}')
ylabel('lati')
set(gca,'clim',Tclim)

subplot(1,3,2)
set(gca,'Position',[0.36 0.23 0.26 0.76])
%set(gca,'Position',[0.575 0.6 0.32 0.38])
if icontour==1,
  contour(longi,lati,tby,nl)   
else
    pcolor(longi,lati,tby);colorbar
end

set(gca,'yticklabel',[])
shading flat %interp 
xlabel('t_{by}')
set(gca,'clim',Tclim)

subplot(1,3,3)
set(gca,'Position',[0.68 0.23 0.26 0.76])
%set(gca,'Position',[0.09 0.1 0.32 0.38])
if icontour==1,
  contour(longi,lati,tbi,nl)   
else
    pcolor(longi,lati,tbi);colorbar
end

set(gca,'yticklabel',[])
shading flat %interp 
xlabel('t_{bi} longi')
%ylabel('lati')
set(gca,'clim',Tclim)

return
