pnm='~dmenemen/llc_4320/regions/global/';

vnm='SSS';
fnm=dir([pnm vnm '/' vnm '.*']);
for f=1:length(fnm)
    fld=readbin([pnm vnm '/' fnm(f).name],fnm(f).bytes/4);
    disp([fnm(f).name ' ' num2str([minmax(fld) std(fld(find(fld)))])])
end

vnm='SST';
fnm=dir([pnm vnm '/' vnm '.*']);
for f=1:length(fnm)
    fld=readbin([pnm vnm '/' fnm(f).name],fnm(f).bytes/4);
    disp([fnm(f).name ' ' num2str([minmax(fld) std(fld(find(fld)))])])
end

vnm='SSU';
fnm=dir([pnm vnm '/' vnm '.*']);
for f=1:length(fnm)
    fld=readbin([pnm vnm '/' fnm(f).name],fnm(f).bytes/4);
    disp([fnm(f).name ' ' num2str([minmax(fld) std(fld(find(fld)))])])
end

vnm='SSV';
fnm=dir([pnm vnm '/' vnm '.*']);
for f=1:length(fnm)
    fld=readbin([pnm vnm '/' fnm(f).name],fnm(f).bytes/4);
    disp([fnm(f).name ' ' num2str([minmax(fld) std(fld(find(fld)))])])
end


%%%%%%%%%%%%%%%%

% Check file statistics
more off
format bank
nx=4320;
FLD=quikread_llc('~dmenemen/llc_4320/grid/hFacC.data',nx);
IX=find(FLD);
NX=length(IX);
fnm='~dmenemen/llc_4320/compressed/0000228096/Salt.0000228096.data.shrunk';
fld=readbin(fnm,NX);
FLD(IX)=fld;
quikplot_llc(FLD)


pn='~dmenemen/llc_4320/regions/global/SSS/SSS.';
ts=228096:144:1082160;
nt=length(ts);
stats=zeros(4,length(ts));
for t=1:nt
    fnm=[pn myint2str(ts(t),10) '.shrunk'];
    fld=quikread_llc(fnm,nx);
    stats(1:3,t)=minmax(fld);
    stats(4,t)=std(fld(:));
    disp(stats(:,t)')
end

pn='~dmenemen/llc_4320/regions/global/SST/';
ts=228096:144:1082160;
nt=length(ts);
nx=4320;
stats=zeros(4,length(ts));
for t=1:nt
    fnm=[pn myint2str(ts(t),10) '_Theta.data'];
    fld=quikread_llc(fnm,nx);
    stats(1:3,t)=minmax(fld);
    stats(4,t)=std(fld(:));
    disp(stats(:,t)')
end

pn='~dmenemen/llc_4320/regions/global/SSU/';
ts=228096:144:1082160;
nt=length(ts);
nx=4320;
stats=zeros(4,length(ts));
for t=1:nt
    fnm=[pn myint2str(ts(t),10) '_U.data'];
    fld=quikread_llc(fnm,nx);
    stats(1:3,t)=minmax(fld);
    stats(4,t)=std(fld(:));
    disp(stats(:,t)')
end

pn='~dmenemen/llc_4320/regions/global/SSV/';
ts=228096:144:1082160;
nt=length(ts);
nx=4320;
stats=zeros(4,length(ts));
for t=1:nt
    fnm=[pn myint2str(ts(t),10) '_V.data'];
    fld=quikread_llc(fnm,nx);
    stats(1:3,t)=minmax(fld);
    stats(4,t)=std(fld(:));
    disp(stats(:,t)')
end
