close all
clear all
clc

load FMT.mat
load MIT_TOMO_LATLON.mat
nxc = length(XC);
nyc = length(YC);
nzc = length(ZC);
nt = 395;

%% old packing
time = rdslice(['TIME_TOMO_2010_2011.bin'],[nt 1],1, fmt, Ieee);

for it = [1 nt]
    t =  rdslice(['T_MIT_TOMO_2010_2011.bin'],[nxc nyc nzc],it, fmt, Ieee);
    s =  rdslice(['S_MIT_TOMO_2010_2011.bin'],[nxc nyc nzc],it, fmt, Ieee);
    u =  rdslice(['U_MIT_TOMO_2010_2011.bin'],[nxc nyc nzc],it, fmt, Ieee);
    v =  rdslice(['V_MIT_TOMO_2010_2011.bin'],[nxc nyc nzc],it, fmt, Ieee);
    eta = rdslice(['Eta_MIT_TOMO_2010_2011.bin'],[nxc nyc],it, fmt, Ieee);
    
    figure
    subplot(2,3,1);imagesc(XC,YC,t(:,:,1)');title(['T : ' datestr(time(it))]);colorbar;axis('xy')
    subplot(2,3,2);imagesc(XC,YC,s(:,:,1)');title(['S : ' datestr(time(it))]);colorbar
    subplot(2,3,3);imagesc(XC,YC,u(:,:,1)');title(['U : ' datestr(time(it))]);colorbar
    subplot(2,3,4);imagesc(XC,YC,v(:,:,1)');title(['V : ' datestr(time(it))]);colorbar
    subplot(2,3,5);imagesc(XC,YC,eta');title(['Eta : ' datestr(time(it))]);colorbar
    
end

