function [dstruct, meta] = get_met_vars(met, meta)
% sys looks like this (if it comes from process_imet)
%  1     2    3     4   5     6    7     8
% [yday; day; hour; bp; atmp; sst; Uwnd; Vwnd;...
% rh; sw; lw; prec;  cond];
%  9  10   11 12     13      

yday=met.yday;
mday=yday+datenum(met.year,1,0);

% add global date attributes according to deployment date
if ~ isfield(meta.global,'date_update')
   meta.global.date_update = datestr(now, 'yyyy-mm-ddTHH:MM:SSZ');
end
if ~ isfield(meta.global,'date_creation')
   if isfield(met,'procdate')
       meta.global.date_creation = datestr(met.procdate,'yyyy-mm-ddTHH:MM:SSZ'); 
   else
      meta.global.date_creation = datestr(now,'yyyy-mm-ddTHH:MM:SSZ'); 
   end
end
if ~ isfield(meta.global,'time_coverage_start')
   meta.global.time_coverage_start=datestr(mday(1),'yyyy-mm-ddTHH:MM:SSZ'); 
end
if ~ isfield(meta.global,'time_coverage_end')
   meta.global.time_coverage_end=datestr(mday(end),'yyyy-mm-ddTHH:MM:SSZ'); 
end

% need to be changed for older or subsurface dataset 
meta.global.history= 'Buoy data processed. K.Huang';
meta.global.comment ='Buoy minute IMET data';
meta.global.Instrument_type='ASIMet Logger';
meta.global.Instrument_reference='http://uop.whoi.edu/asimet';
meta.global.depth=0;

meta.variable.UWND.magnetic_correction=met.magvar;
meta.variable.VWND.magnetic_correction=met.magvar;

dstruct.time = mday - datenum(1950,1,1);
dstruct.depth=0;
dstruct.lat = met.lat;
dstruct.lon = met.lon;
dstruct.ATMS = met.bpr;   % air pressure at sea level
dstruct.AIRT = met.atmp;   % air temp
dstruct.TEMP = met.sst;   % sst! (ha)
dstruct.UWND = met.wnde;   % eastward wind
dstruct.VWND = met.wndn;   % northward wind
dstruct.RELH = met.hrh;   % hrh
dstruct.SW = met.swr;  % shortwave
dstruct.LW   = met.lwr;  % longwave
dstruct.RAIN = met.prate;  % rainrate
%dstruct.CNDC =  met.cond; % cond
dstruct.PSAL = met.sal;

