function [z,s,t]=srvy1mir3d
nnv=20
yd=140.0
rms=1.
inst=1;
x=dir('oaci_1.1/survey.1/*.cdn');
n=length(x)
s=[];
t=[];
z=[];
xx=[];
yy=[];
for k=1:n
    disp(x(k).name);
    d=read_cdn(['oaci_1.1/survey.1/',x(k).name]);
    zi=min(d.z)+(max(d.z)-min(d.z))*(0:nnv)/nnv;
    si=interp1(d.z,d.s,zi);
    ti=interp1(d.z,d.t,zi);
    
%    z=[z;d.z(:)];
%    s=[s;d.s(:)];
%    t=[t;d.t(:)];
    [xxx,yyy]=ll2xy(d.lat,-d.lon);
    z=[z;zi(:)];
    s=[s;si(:)];
    t=[t;ti(:)];
    xx=[xx;xxx+0*ti(:)];
    yy=[yy;yyy+0*ti(:)];
end

fp=fopen('oaci_1.1/obs/survey1.T.mir3d','w');
fprintf(fp,'Merhab survey 1 temperature mir3d file\n')
fprintf(fp,'2004\n')
d=[yd+0*z,xx,yy,z,t,rms+0*t,inst+0*t];
fprintf(fp,['%f %f %f %f %f %f %i\n'],d')
fclose(fp);


fp=fopen('oaci_1.1/obs/survey1.S.mir3d','w');
fprintf(fp,'Merhab survey 1 salinity mir3d file\n')
fprintf(fp,'2004\n')
d=[yd+0*z,xx,yy,z,s,rms+0*t,inst+0*t];
fprintf(fp,['%f %f %f %f %f %f %i\n'],d')
fclose(fp); 
%fprintf(fp,'%f %f %f %f %f %f %i\n',[t, xx(j(l))+randn*100, yy(j(l))+randn*100, -1, s(j(l)),1.0,in]);
