function merge_lmg_met1m(last_yd)
% merge_lmg_met1m(last_yd) adds new daily JGOFS 
% data in jg0yd.mat up through last_yd to the 
% existing combined lmg_met1m.mat file. used
% on LMG02-1A
% 2/8/02; 2/15/02; 2/20/02 to include fluor

% always start with yd 37
load jg037

% make arrays
soparm=sopar;
tm=t;wsm=ws;wdm=wd;rhm=rh;atm=at;sstm=sst;
xm=x;ym=y;swm=sw;lwm=lw;sogm=sog;gyrom=gyro;
bpm=bp;zm=z;sssm=sss;fluorm=fluor;

first_yd=38;

for ydn=first_yd:last_yd;
   if ydn<100
      filnam=['jg0',int2str(ydn),'a'];
      eval(['load ',filnam]);
   end
   if ydn>=100
      filnam=['jg',int2str(ydn),'a'];
      eval(['load ',filnam]);
   end
   tm=[tm;t];
   xm=[xm;x];
   ym=[ym;y];
   sogm=[sogm;sog];
   gyrom=[gyrom;gyro];
   zm=[zm;z];
   wsm=[wsm;ws];
   wdm=[wdm;wd];
   rhm=[rhm;rh];
   atm=[atm;at];
   sstm=[sstm;sst];
   bpm=[bpm;bp];
   swm=[swm;sw];
   lwm=[lwm;lw];
   soparm=[soparm;sopar];
   sssm=[sssm;sss];
   fluorm=[fluorm;fluor];
   disp(ydn)   
end

% rename
sopar=soparm;
t=tm;ws=wsm;wd=wdm;rh=rhm;at=atm;sst=sstm;
x=xm;y=ym;sw=swm;lw=lwm;sog=sogm;gyro=gyrom;
bp=bpm;z=zm;sss=sssm;fluor=fluorm;

% convert met to ocean wind convention and save
d2r=pi./180;
wdo=wd+180;
u=ws.*sin(d2r*wdo);
v=ws.*cos(d2r*wdo);
wdr=atan2(v,u)./d2r;

sst=clean_gould_sst(sst);

save lmg_met1m sopar t u v  fluor wdr ws wd rh at sst x y sw lw sog gyro bp z sss 

