function [Struct_ss, Struct_Salta_new, Struct_fit_NoSalta_new] = RemoveSeaSalt_powerfit(Struct_Salta, Struct_NoSalta) % [Struct_ss, Struct_Salta_new, Struct_fit_NoSalta_new] = ... % RemoveSeaSalt_powerfit(Struct_Salta, Struct_NoSalta, bin_N) % Input the mass flux with saltation occur and without saltation % remove the sea-salt depostion effect polluted the measured result % % Struct_ss has the same length for each bin when saltation occurs. Index_common = (1:1:size(Struct_Salta.Fd,1))'; for i = 1:7 % loop over 7 bins temp_index = find(Struct_Salta.Fd(:,i) > 0); Index_common = intersect(Index_common, temp_index); % find the index with all 7 bins have positve flux when saltation occuring end Fd = []; Fd_err = []; for i = 1:7 % loop over 7 bins Fd_ZeroQ = Struct_NoSalta.Fd(:,i); Fd_err_ZeroQ = Struct_NoSalta.Fd_err(:,i); ustar_ZeroQ = Struct_NoSalta.ustRe; index_Neg_Fd_Zero_Q = find(Fd_ZeroQ < 0); % deposition flux (<0) of sea salt when no saltation Fd_ZeroQ_NegFd = Fd_ZeroQ(index_Neg_Fd_Zero_Q); Fd_err_ZeroQ_NegFd = Fd_err_ZeroQ(index_Neg_Fd_Zero_Q); ustar_ZeroQ_NegFd = ustar_ZeroQ(index_Neg_Fd_Zero_Q); Fd_power_n = log10(abs(Fd_ZeroQ_NegFd)); % in preparation for powerfit, subscrib _n = 'no saltation' Fd_err_power_n = sqrt((Fd_err_ZeroQ_NegFd./abs(Fd_ZeroQ_NegFd)/log(10)).^2); % from error propogation ustar_power_n = log10(ustar_ZeroQ_NegFd); % in preparation for powerfit ustar_s = Struct_Salta.ustRe(Index_common); %subscrib _s = 'saltation occurance' ustar_power_s = log10(ustar_s); [a, b, sigma_a, sigma_b, cov_ab2] = Linearfit(ustar_power_n, Fd_power_n, Fd_err_power_n); % powerfit on the sea-salt deposition Fd_fit_power_s = a + b*ustar_power_s; %fitted flux Fd_err_fit_power_s = sqrt(sigma_a^2 + sigma_b^2*ustar_power_s.^2 +2*cov_ab2*ustar_power_s); Fd_fit_s = 10.^Fd_fit_power_s; Fd_err_fit_s = sqrt((10.^Fd_fit_power_s*log(10).*Fd_err_fit_power_s).^2); Fd_fit_power_n = a + b*ustar_power_n; Fd_err_fit_power_n = sqrt(sigma_a^2 + sigma_b^2*ustar_power_n.^2 +2*cov_ab2*ustar_power_n); Fd_fit_n = 10.^Fd_fit_power_n; Fd_err_fit_n = sqrt((10.^Fd_fit_power_n*log(10).*Fd_err_fit_power_n).^2); % store these data of each bin into Struct_Salta_new & % Struct_fit_NoSalta_new, in preparation for figure plotting Struct_Salta_new.(['bin',num2str(i)]).Fd_raw = Struct_Salta.Fd(Index_common,i); Struct_Salta_new.(['bin',num2str(i)]).Fd_err_raw = Struct_Salta.Fd_err(Index_common,i); Struct_Salta_new.(['bin',num2str(i)]).Fd_fit = Fd_fit_s; Struct_Salta_new.(['bin',num2str(i)]).Fd_err_fit = Fd_err_fit_s; Struct_Salta_new.(['bin',num2str(i)]).ustar = ustar_s; Struct_fit_NoSalta_new.(['bin',num2str(i)]).Fd_raw = Fd_ZeroQ_NegFd; Struct_fit_NoSalta_new.(['bin',num2str(i)]).Fd_err_raw = Fd_err_ZeroQ_NegFd; Struct_fit_NoSalta_new.(['bin',num2str(i)]).Fd_fit = Fd_fit_n; %fit the fitted absolute value of deposition flux Struct_fit_NoSalta_new.(['bin',num2str(i)]).Fd_err_fit = Fd_err_fit_n; Struct_fit_NoSalta_new.(['bin',num2str(i)]).ustar = ustar_ZeroQ_NegFd; % in preparation for storing corrected dust mass flux of 7 bins Fd_correct = Fd_fit_s + Struct_Salta.Fd(Index_common,i); Fd_err_correct = sqrt(Fd_err_fit_s.^2 + Struct_Salta.Fd_err(Index_common,i).^2); Fd = [Fd, Fd_correct]; % store the corrected (addressing sea-salt deposition) mass flux of 7 bins Fd_err = [Fd_err, Fd_err_correct]; end %--- save the construct of corrected dust mass flux, in preparation for %following data processing procedures Struct_ss.Fd = Fd; Struct_ss.Fd_err = Fd_err; Struct_ss.Fd_unit = 'kg/m^2/s'; Struct_ss.z = Struct_Salta.z(Index_common,:); Struct_ss.StartTimes = Struct_Salta.StartTimes(Index_common); Struct_ss.EndTimes = Struct_Salta.EndTimes(Index_common); Struct_ss.Q = Struct_Salta.Q(Index_common); Struct_ss.sigma_Q = Struct_Salta.sigma_Q(Index_common); Struct_ss.ustar = Struct_Salta.ustRe(Index_common); Struct_ss.sigma_ustar = Struct_Salta.sigma_ustRe(Index_common); Struct_ss.theta = Struct_Salta.theta(Index_common); display('%--- function RemoveSeaSalt_powerfit() complete ----%'); end