function [sonde_flag, time_rel_sonde, time, pres, zg, tdry, dp, rh, u_wind, v_wind, lat, lon, alt, release_time, count, sonde_index] = comb_sonde(arm,igra)
if ~isempty(arm)
    base1 = arm(:,1);
else
    base1 = [];
end
base2 = igra(:,1);
b1 = unique(base1);
b2 = unique(base2);
b = union(b1,b2);

sonde_arch = [];
src = [];
sonde_index = [];
for i = 1:length(b)
    if any(base1 == b(i))
        count(i) = sum(base1 == b(i));
        sonde_index(i) = size(sonde_arch,1) + 1;
        x = NaN(sum(base1 == b(i)),14);
        x(:,[1:3,5:14]) = arm(base1 == b(i),:);
        sonde_arch = [sonde_arch; x];
        src = [src; 1];
    end
    if any(base2 == b(i))
        count(i) = sum(base2 == b(i));
        sonde_index(i) = size(sonde_arch,1) + 1;
        x = NaN(sum(base2 == b(i)),14);
        x(:,1:9) = igra(base2 == b(i),[1:5,7,9,8,6]);
        x(:,10:11) = [-igra(base2 == b(i),9).*sind(igra(base2 == b(i),8)) -igra(base2 == b(i),9).*cosd(igra(base2 == b(i),8))];
        sonde_arch = [sonde_arch; x];
        src = [src; 2];
    end
end

sonde_flag(src==1,1) = "arm";
sonde_flag(src==2,1) = "igr";
sonde_flag = char(sonde_flag);
% interpret
time_rel_sonde = b; 
base_time = sonde_arch(:,1);
time = sonde_arch(:,2);
pres = sonde_arch(:,3);
zg = sonde_arch(:,4);
tdry = sonde_arch(:,5);
dp = sonde_arch(:,6);
wspd = sonde_arch(:,7);
deg = sonde_arch(:,8);
rh = sonde_arch(:,9);
u_wind = sonde_arch(:,10);
v_wind = sonde_arch(:,11);
lat = sonde_arch(:,12);
lon = sonde_arch(:,13);
alt = sonde_arch(:,14);

% convert
pres = pres*100;
tdry = tdry + 273.15;
dp = dp + 273.15;
release_time = datestr(b,'yyyymmdd HH:MM');
