% READ_ADV - Script to read ASCII ADV files advlibpath = '/usr2/usgstools/advlib/'; if(exist('adv')==1), adv_path = adv.path; adv_file = adv.file; end if(exist('adv_path')~=1), adv_path = input('Path name for adv data directory including final \(single quotes): '); adv.path = adv_path; end if(exist('adv_file')~=1), adv_file = input('Enter base name for adv file (single quotes): '); adv.file = adv_file; end ctl_path = sprintf('%s%s.ctl',adv_path,adv_file) if(exist(ctl_path)~=2), etext = ['Cant find ',ctl_path]; error(etext); end eval(['!perl -w ',advlibpath,'read_ctladv.pl ',ctl_path]) read_ctladv; % now read everything else hdr_path = [adv_path,adv_file,'.hdr']; a = load(hdr_path); adv = read_hdradv( a, adv); clear a; ts_path = [adv_path,adv_file,'.ts']; a = load(ts_path); adv = read_ts( a, adv); clear a; b = adv; %if data were saved in xyz, rotate to EN (magnetic) if b.coord_sys == 'XYZ' [b.ve, b.vn] = rotadv(b.vx, b.vy, b.hdg); end %timestamp in julian day in 2001 jone = julian([2001 1 1 0 0 0]); b.jday = b.jt - jone +1; %timestamp in hours (no date) b.hr = (b.jday-floor(b.jday))*24; clear jone %time of individual profiles [hr, min, sec] = h2hms(b.hr(b.bnum)); sec = sec + b.num_in_bur/b.samp_rate; min = min + floor(sec/60); sec = sec - (floor(sec/60)*60); hr = hr + floor(min/60); min = min - (floor(min/60)*60); b.prhr = hms2h(hr, min, sec); %index of first profile in each burst b.bur_ind = [1:b.samp_per_burst:(b.num_bursts-1)*b.samp_per_burst+1]; adv = b; clear b;