function [sys] = AO_to_variables(imet,minx,maxx)
% sys id yearday    bp    at   sst   wnde   wndn   rh   swr   lw   prc    cnd  wnds wndd
% call this like this to turn the arrays into structs; 
% then you can use overplot which wants structs.

% sys1=AO_to_variables(imet_1);
% sys2=AO_to_variables(imet_2);

addpath([matlabroot '/toolbox/local/seawater']);
if exist('imet','var'),
    [nc, np]=size(imet);
     hhr = .5/24;
    if np > 1,
       sys.yday=imet(1,:) +hhr;
       indx=find(sys.yday >= minx & sys.yday <= maxx);
       sys.yday=sys.yday(indx);
       fprintf('%d pts %.1f to %.1f in  %d %.1f to %.1f out\n', ...
           np, imet(1,1), imet(1,end), ...
           length(indx), sys.yday(1),sys.yday(end));
       sys.bpr=imet(2,indx);
       sys.atmp=imet(3,indx);
       sys.sst=imet(4,indx);
       sys.wnde=imet(5,indx);
       sys.wndn=imet(6,indx);
       [sys.wnds, sys.wndd] = vect2md(sys.wnde,sys.wndn);
       sys.hrh=imet(7,indx);
       sys.swr=imet(8,indx);
       sys.lwr=imet(9,indx);
       sys.prc=imet(10,indx);
       try
          sys.rainr = [0; diff(sys.prc)];
       catch
          sys.rainr = [0 diff(sys.prc)];
       end
    %   disp([ 'size rainr,prc ' num2str(length(rainr)) ' ' num2str(length(prc))])
 
       sys.cond=imet(12,indx);
       sys.sal=sw_salt(10*sys.cond/sw_c3515, sys.sst, 0.25);
    else
        sys=[];
    end
end
