Created
August 9, 2016 18:12
-
-
Save OneGneissGuy/428f00aea84f85d0903b30418ffc918a to your computer and use it in GitHub Desktop.
Script to process LISST binary data files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%code to batch process and invert binary lisst data | |
f_directory = 'C:\Users\saraceno\Documents\MATLAB\LISST\recachelisstdata'; | |
datafile_ext = '*.dat'; | |
zscfile = 'office_zsc_1145_110712.asc'; | |
fac_zscfile = 'factory_zsc_1145.asc'; | |
ringareafile = 'Ringarea_1145.asc'; | |
instrument_data = 'InstrumentData.txt'; | |
VCC = 4972; | |
type = 3; | |
random_shape = 1; | |
fac_zscat = load(fac_zscfile); | |
myFiles = dir(fullfile(f_directory, datafile_ext)); %gets all binary files in struct | |
for k = 1:length(myFiles) | |
baseFileName = myFiles(k).name; | |
fullFileName = fullfile(f_directory, baseFileName); | |
fprintf(1, 'Now reading %s\n', fullFileName); | |
[scat,tau,zsc,data,cscat] = getscat(fullFileName,zscfile,1,ringareafile); | |
% [vd dias]=invert(cscat,instrument_type,ST,RANDOM,SHARPEN,GREEN,WAITBARSHOW); | |
[vd, dias]=invert(cscat,type,0,0,0,0,0); | |
vd_corrected = vdcorr(vd,VCC,fac_zscat(36),data(:,36)); | |
if random_shape == 1; | |
diamters = compute_mean(vd_corrected, 31, tau); | |
else | |
diamters = compute_mean(vd_corrected, type, tau); | |
end | |
output(k,:).filename = baseFileName; | |
output(k,:).scat = scat; | |
output(k,:).tau = tau; | |
output(k,:).zsc = zsc; | |
output(k,:).data = data; | |
output(k,:).cscat = cscat; | |
output(k,:).dias = dias; | |
%output(k,:).vd = vd; | |
output(k,:).vd_corrected = vd_corrected; | |
output(k,:).vc = sum(vd_corrected'); | |
output(k,:).diamters = diamters; | |
end | |
%semilogx(dias,scat) | |
if random_shape == 1; | |
save('cache_lisst_random_v7.mat','output','-v7') | |
else | |
save('cache_lisst_v7.mat','output','-v7') | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment