if (b == 1)
    fid = fopen('calibrated_cband_geometry-3.txt');
    q=textscan(fid,'%s');
    fid = fopen('calibrated_cband_reflectivity-3.txt');
    z=textscan(fid,'%s');
elseif (b == 2)
    fid = fopen('calibrated_cband_geometry-0.txt');
    q=textscan(fid,'%s');
    fid = fopen('calibrated_cband_reflectivity-0.txt');
    z=textscan(fid,'%s');
end
        
for a=1:6
path = fullfile(q{1}{a});
ncid = netcdf.open(path,'NC_NOWRITE');
[ndims,nvars,natts,unlimdimID]= netcdf.inq(ncid);


%Variable indices...
%0 = time, 1 = incidence angle, 2 = a/c lon, 3 = a/c lat, 4 = lon @ range gate 100, 5 = lat @ range gate 100,
%6 = a/c altitude, 7 = azimuth w.r.t. true N, 8 = track (deg), 9 = yaw (deg), 10 = pitch (deg), 11 = roll (deg),
%12 = heading (deg)

%[dimname, dimlen] = netcdf.inqDim(ncid,0);
%[varname, vartype, dimids, natts] = netcdf.inqVar(ncid,0);

unixt = netcdf.getVar(ncid,0);		%Unix time stamp (seconds since Jan 1, 1970 00:00 UTC
    s1 = size(unixt,1);
    s2 = size(unixt,2);   
    unixt = reshape(unixt,s1*s2,1);
    yy = unixt*0+1970;
    mm = unixt*0+1;
    dd = mm;
    mn = unixt*0;
    ss = unixt*0;
    time2 = datenum([yy mm dd mn ss unixt]);
    time2 = double(reshape(time2,size(time2,1),1));
%    time2 = repmat(time2,1,nz);time2 = double(reshape(time2,size(time2,1)*size(time2,2),1));
%    dtg2 = datestr(time2);
%    dtg2 = reshape(dtg2,s1,s2,20);

    
%nominal incidence angles below (variable includes 1.5 degree pitch offset for antenna mount)

%KU band...4 beams
%*-0-.nc files, outer beam
%tau = 48.60	%degrees
%*-1-.nc files
%tau = 40.50	%degrees
%*-2-.nc files
%tau = 36.20	%degrees
%*-3-.nc files, inner beam
%tau = 32.30	%degrees

%C band...4 beams
%*-0-.nc files, outer beam
%tau = 50.00     %degrees
%*-1-.nc files
%tau = 44.10     %degrees
%*-2-.nc files
%tau = 39.10     %degrees
%*-3-.nc files, inner beam
%tau = 34.50     %degrees

d2r = pi/180;    

%Get reflectivity and Doppler data

%path = fullfile('/mercury/guimond/GSFC/IWRAP/20030912/volume_reflectivity/',z{1}{16})
path = fullfile(z{1}{a});
ncid = netcdf.open(path,'NC_NOWRITE');

%Variable indices...
%0 = reflectivity, 1 = reflectivity noise removed
refl = netcdf.getVar(ncid,1);           %units m^6/m^3
missing = refl == 0.0;                  %if inequality is true, missing is 1; false, missing is 0.
refl(missing) = NaN;                    %assign NaN to places in original array where missing is 1, otherwise use original data

dbz2 = 10.*log10(abs(refl)) + 180;       %units of dBZ

dbz2 = 10.^(dbz2/10);                     %units of Z (use linear units for interpolation)

dbz2 = shiftdim(dbz2,1);

dbz2 = dbz2(:,:,1:nz);

dbz2 = double(reshape(dbz2,size(dbz2,1)*size(dbz2,2),size(dbz2,3)));

if (a == 1)
    ctime = time2;
    cdbz = dbz2;
else
    ctime = cat(1,ctime,time2);
    cdbz = cat(1,cdbz,dbz2);
end
end