function limonE100_20060729 % This is the prototype for processing Field-Mill data taken by li-mon % % by R. Sonnenfeld 7/11/2005 and 7/30/2006. % This script is quite similar to W. Winn's standard script % (for example kv2004aug13.m), but I defined a new filetype % to reduce confusion. % XXXX.flt files are the raw output of limon. % They do not have timestamps % at every data point. These are the inputs to this script. % The first thing this script does is reprocess the XXXX.flt files % such that every data point has a timestamp. % This processed file is saved with the name XXXX.E100.processed % % Thus if the input file was e20050709_2256.flt, then the output file % would be e20050709_2256.E100.processed % % Winn's comments: % Plot E(kiva) from sheep. % There are Ng groups starting with 555555 in this data file. % A full group has 10 rows with 555555, lat, lon, date, time, etc., % and 240 rows of data. A full group has 250 rows. % Sample time is 1 second. % Each group has 240 seconds of data (4 minutes) tmin=-inf; tmax=inf; Emin=-inf; Emax=inf; print_desired=1; %(1 for printout) data_dir='/home/sprite1_backup/DATA/20060726/fieldmill/'; %on feynman % data_dir='/home/sprite1_backup/DATA/20050817/SONDE6_CAL/'; %on feynman % data_dir='/DATA/20050725/'; %on slug filename='hangar_e20060726_1958'; % filename and data_dir are the only strings you need to update when % processing a new data file % Please note that kiva, hangar and annex have special meanings that are % used later in this script. fn=filename; A= load(strcat(data_dir,filename,'.flt')); % A has an incomplete group dt = 1.0; % time between samples: 1.0 sec for kiva, 1.0 for annex if filename(1:4)=='hang' dt = 0.1; ; % time between samples 0.1 for hangar end k = find(A==555555) ; Ng = length(k) ; % Number of groups. Lg = 250 ; % Length of a group. (Is independent of sample rate) Nd = Lg - 10 ; % Number of data values in group (240). % Extract data values: B = zeros(Ng*Lg,1) ; % B has Ng complete groups B(1:length(A)) = A ; % The last group of B has some 0's. C = zeros(Lg,Ng) ; C(:) = B ; % Each col. of C is just one group. D = C(11:Lg, :) ; % D has only E values, not date, etc. 240xNg E = D(:) ; % E is a col. vect. % Reconstruct a time for each sample: % Initial time for each group, sec from midnight, row vect: t0 = C(8,:)*3600 + C(9,:)*60 + C(10,:) ; % row vect % Nd x Ng matrix; each row has initial times for group: t0m = ones(Nd,1)*t0 ; % Nd x Ng, All rows are the same. tr = 0:dt:((Nd-1)*dt) ; % row tr = tr' ; % col. times after start of group. % Each col. in following matrix has times after start of group: trm = tr*ones(1,Ng) ; % Nd x Ng % Time, sec. after midnight, in a matrix: tm = t0m + trm ; % Nd x Ng % Time, sec. after midnight in a col vector: t = tm(:) ; % % Find out if there is a roll over (a new day): kroll = find( t < t(1) ) ; % Detect a roll over. t(kroll) = t(kroll) + 3600*24 ; % Add # of sec in 24 hours. % Make a flat file with E(t): M = [t,E] ; save (strcat(filename,'.E100.processed'),'M','-ASCII') % Overview figure(1); clf % t is seconds since midnight thours=t/3600.0; %thours is decimal hours since midnight plot(thours, E) axis([-inf, inf, Emin, Emax]) grid titl=['Balloon Hangar E-field data for ',filename,'.flt']; title(titl,'Interpreter','none') %Turn off tex processing ... also 'latex' is valid xlabel('Time (NTP), hours since, 00:00UTC') ylabel('E, kV/m') stampit if print_desired==1 temp=input(['type p to create file ',fn,'.eps\n'],'s'); %print -djpeg -r300 ES2004_0818_2020-21Ez-double if temp=='p' % print( '-djpeg', '-r300', fn ) print( '-depsc2', '-r300', fn ) end temp=input(['type x to xview file ',fn,'.jpg\n'],'s'); %print -djpeg -r300 ES2004_0818_2020-21Ez-double if temp=='x' % system(['xv ',fn,'.jpg &']) system(['gv ',fn,'.eps &']) end end