%This code will load an hour of data from station TBAG, allow the user to %%pick the onset of an event and write that pick to a ascii text file. % move channel 1 data from TBAG (A881) to data directory. clear all close all addpath '/Users/geop572/Desktop/GEOP572_MATLAB' %-------------------------------------------------------------------------- cd '/Users/geop572/Desktop/SEGY' j=input ('What Julian Day would you like to pick?') h=1; l=1; n=10; for i =1:24 for m=1:6 start_time(l,:) = [j i-1 (m-1)*n 0]; % [jday hour min sec] of start window = 3600*1/6; % 1 hour of data das = 'A881'; % name of seismic station to read in [seisV,hdr] = segycut(start_time(l,:),window,das,'1'); ts = (1:length(seisV))/hdr.sps; % create time series vector seis_sens = 800; % sensitivity is 800 V/m/s atod = hdr.atod; % digitization V/count sens_gain = hdr.gain; % programmed gain setting seis_calib = atod/seis_sens/sens_gain*1e6; % total conversion of counts to um/s seisV=detrend(seisV); % now do highpass sps=100; npoles = 4; % specify order of filter high = 1; % corner frequency at 1 Hz [B2,A2] = butter(npoles,[high]/(sps/2),'high'); seisf=filter(B2,A2,seisV); %------------------------------------------------------------------------- % Plot the calibrated data trace for 1 Hour figure(1); clf plot(ts,seisf*seis_calib,'k') % plot decimated data trace for 1 hour ylabel('velocity (\mum/s)') xlabel('time (seconds)') title(['das: ' das ' start time: ' num2str(start_time(l,:))]) %-------------------------------------------------------------------------- % Pick the onset of the event(s) num_events=input('How many events are evident in this Hour Trace?') % Pick the event using ginput. Don't forget to use the zoom. for k=1:num_events [x(h),y(h)]=ginput(1) % Save your picks in a file called Tpicks.mat if num_events == 0 x(h) = NaN; end pause h=h+1; l=l+1; if num_events > 1 start_time(l,:)=start_time(l-1,:); end end end end start_timef=start_time(1:length(x),:); save Tpicks.mat start_timef x