% overplot_Argos_8_panel
% plot argos over scs data on ron brown
load Argos.mat
stpt=find(sys1.cond > 4, 1,'first');

fprintf('argos plot:pminx pmaxx %.2f %.2f\n',pminx,pmaxx);

if exist('sys1','var'),
    fprintf('truncating sys1 %d pts %s to %s ',...
        length(sys1.mday), datestr(sys1.mday(1)), ...
        datestr(sys1.mday(end)));
    sys1=structtrunc(sys1, find(sys1.yday >= pminx));
    fprintf('to %d pts %s to %s\n',...
        length(sys1.mday), datestr(sys1.mday(1)), ...
        datestr(sys1.mday(end)));
else
    fprintf('no sys1 in Argos.mat!\n');
end
if exist('sys2','var'),
    fprintf('truncating sys2 %d pts %s to %s ',...
        length(sys2.mday), datestr(sys2.mday(1)), ...
        datestr(sys2.mday(end)));
    sys2=structtrunc(sys2, find(sys2.yday >= pminx));
    fprintf('to %d pts %s to %s\n',...
        length(sys2.mday), datestr(sys2.mday(1)), ...
        datestr(sys2.mday(end)));
    else
    fprintf('no sys2 in Argos.mat!\n');
end

if exist('sys3','var')
    if isstruct(sys3)
        sys3=structtrunc(sys3, find(sys3.yday > pminx)); 
    else
        clear sys3
    end
end
if exist('sys4','var')
     if isstruct(sys4)
         sys4=structtrunc(sys4, find(sys4.yday > pminx)); 
     else
        clear sys4
     end
end

%
subplot(4,2,1);  %wnds
% hold on
if exist('sys1','var'), plot(sys1.yday,sys1.wnds,...
        'Color','blue'); end
if exist('sys2','var'), plot(sys2.yday,sys2.wnds,...
        'Color','green'); end
ax=axis;
axis([pminx pmaxx ax(3:4)])
%axis([pminx pmaxx 2 12])
%
subplot(4,2,2);   %wndd
hold on
if exist('sys1','var'), line(sys1.yday,sys1.wndd,...
        'Color','blue');
    title2=[title2 ' sys1:b '];
end
if exist('sys2','var'), line(sys2.yday,sys2.wndd,...
        'Color','green');
    title2=[title2 'sys2:g '];
else
    fprintf('no sys 2\n');
end
title(title2);
ax=axis;
axis([pminx pmaxx ax(3:4)])

subplot(4,2,1); % atmp
hold on
if exist('sys1','var'), line(sys1.yday,sys1.atmp,...
        'Color','blue');
end
if exist('sys2','var'), line(sys2.yday,sys2.atmp,...
        'Color','green');
end
ax=axis;
ax(4) =max( [max(sys1.atmp),max(sys2.atmp),max(atmos.atmp)])+.2;
axis([ pminx pmaxx ax(3:4)])
%axis([ pminx pmaxx 12 21 ])

subplot(4,2,2); % sst
hold on
if exist('sys1','var'), line(sys1.yday,sys1.sst,...
        'Color','blue'); end
if exist('sys2','var'), line(sys2.yday,sys2.sst,...
        'Color','green'); end
ax=axis;
ax(4) =max( [max(sys1.sst),max(sys2.sst),max(tsg.stmp)])+.2;
axis([pminx pmaxx ax(3:4)])
%axis([ pminx pmaxx 15 27 ])


subplot(4,2,3); % bpr
hold on
if exist('sys1','var'), line(sys1.yday,sys1.bpr,...
        'Color','blue'); end
if exist('sys2','var'), line(sys2.yday,sys2.bpr,...
        'Color','green'); end
ax=axis;
axis([ pminx pmaxx ax(3:4)])
%axis([pminx pmaxx 1012 1020])

subplot(4,2,4);  %hrh
hold on
if exist('sys1','var'), line(sys1.yday,sys1.hrh,...
        'Color','blue'); end
if exist('sys2','var'), line(sys2.yday,sys2.hrh,...
        'Color','green'); end
if exist('sys3','var'), line(sys3.yday,sys3.hrh,...
        'Color','yellow'); end
if exist('sys4','var'), line(sys4.yday,sys4.hrh,...
        'Color','red'); end
ax=axis; 
axis([ pminx pmaxx ax(3:4)]);
%axis([ pminx pmaxx 62 98 ])

subplot(4,2,5); % swr
hold on
if exist('sys1','var'), swrl1=line(sys1.yday,sys1.swr,...
        'Color','blue'); end
if exist('sys2','var'), swrl2=line(sys2.yday,sys2.swr,...
        'Color','green');
end
if exist('sys3','var'), line(sys3.yday,sys3.swr,...
        'Color','yellow'); end
if exist('sys4','var'), line(sys4.yday,sys4.swr,...
        'Color','red'); end
%axis([pminx pmaxx -5 1100 ])
%mymxy = max(atmos.swr(find(atmos.swr < 1300))) + 10;
ax=axis;
%axis([ pminx pmaxx ax(3) mymxy ])
axis([ pminx pmaxx ax(3:4) ])

subplot(4,2,6)   ; % lwr
hold on
if exist('sys1','var'), line(sys1.yday,sys1.lwr,...
        'Color','blue'); end
if exist('sys2','var'), line(sys2.yday,sys2.lwr,...
        'Color','green'); end
if exist('sys3','var'), line(sys3.yday,sys3.lwr,...
        'Color','yellow'); end
if exist('sys4','var'), line(sys4.yday,sys4.lwr,...
        'Color','red'); end
ax=axis;
% ax(3)=min(atmos.swr) - 4;
% ax(4)=max(atmos.swr) + 10;
% axis([pminx pmaxx  340 450])
% axis([ax(1:2)  max([max(sys1.lwr) max(sys2.lwr)])]);
% ax=axis;
axis([ pminx pmaxx ax(3:4)])

subplot(4,2,7);   % rainr
hold on
if exist('sys1','var'), line(sys1.yday,sys1.rainr,...
        'Color','blue'); end
if exist('sys2','var'), line(sys2.yday,sys2.rainr,...
        'Color','green'); end
if exist('sys3','var'), line(sys3.yday,sys3.rainr,...
        'Color','yellow'); end
if exist('sys4','var'), line(sys4.yday,sys4.rainr,...
        'Color','red'); end
ax=axis;
%axis([pminx pmaxx -1.25 1.25 ]);
axis([pminx pmaxx ax(3) ax(4) ]);


subplot(4,2,8);  %sal
hold on
%  salinity
gv1=find(sys1.sal > 30.); gv2=find(sys2.sal > 30.);
if exist('sys1','var'), line(sys1.yday(gv1),real(sys1.sal(gv1)),...
        'Color','blue'); end
if exist('sys2','var'), line(sys2.yday(gv2),real(sys2.sal(gv2)),...
        'Color','green'); end
if exist('sys3','var'), line(sys3.yday,real(sys3.sal),...
        'Color','yellow'); end
if exist('sys4','var'), line(sys4.yday,real(sys4.sal),...
        'Color','red'); end
ax=axis;
ymx=max(max([sys1.sal;  tsg.sal]))+.1;
axis([pminx pmaxx ax(3) (ymx+.1)])
%axis([ pminx pmaxx ax(3:4) ])
%fprintf('pminx %.2f pmaxx %.2f  ',pminx,pmaxx);


