Driver program to process multiple transects at a single cross-section for velocity mapping. Among other things, it: Determines the best fit mean cross-section line from multiple transects Map ensembles to mean c-s line Determine uniform mean c-s grid for vector interpolating Determine location of mapped ensemble points for interpolating Interpolate individual transects onto uniform mean c-s grid Average mapped mean cross-sections from individual transects together Rotate velocities into u, v, and w components (adapted from code by J. Czuba) P.R. Jackson, USGS, 12-9-08 Last modified: F.L. Engel, USGS, 5/20/2013
0001 function [A,V,log_text] = VMT_ProcessTransects(z,A,setends,unitQcorrection) 0002 % Driver program to process multiple transects at a single cross-section 0003 % for velocity mapping. 0004 % 0005 % Among other things, it: 0006 % 0007 % Determines the best fit mean cross-section line from multiple transects 0008 % Map ensembles to mean c-s line 0009 % Determine uniform mean c-s grid for vector interpolating 0010 % Determine location of mapped ensemble points for interpolating 0011 % Interpolate individual transects onto uniform mean c-s grid 0012 % Average mapped mean cross-sections from individual transects together 0013 % Rotate velocities into u, v, and w components 0014 % 0015 % (adapted from code by J. Czuba) 0016 % 0017 % P.R. Jackson, USGS, 12-9-08 0018 % Last modified: F.L. Engel, USGS, 5/20/2013 0019 0020 0021 0022 log_text = {' Processing Data...Please Be Patient.'}; 0023 0024 try 0025 %disp('Processing Data...') 0026 warning off 0027 0028 %% Map ensembles to mean cross-section 0029 [A,V,map_xs_log_text] = VMT_MapEns2MeanXS(z,A,setends); 0030 %msgbox('Processing Data...Please Be Patient','VMT Status','help','replace'); 0031 log_text = vertcat(log_text, map_xs_log_text); 0032 0033 %% Set the probe type 0034 if A(1).Sup.wm == 3 % RiverRay 0035 V.probeType = 'RR'; 0036 else 0037 %V.probeType = A(1).probeType; 0038 V.probeType = 'RG'; 0039 end 0040 0041 %% Grid the measured data along the mean cross-section 0042 %[A,V] = VMT_GridData2MeanXS(z,A,V); 0043 [A,V] = VMT_GridData2MeanXS(z,A,V,unitQcorrection); 0044 if unitQcorrection 0045 log_text = vertcat(log_text,... 0046 {' Streamwise unit discharge continuity enforced'}); 0047 end 0048 %msgbox('Processing Data...Please Be Patient','VMT Status','help','replace'); 0049 %log_text = {log_text; grid_data_log_text}; 0050 0051 %% Computes the mean data for the mean cross-section 0052 %[A,V] = VMT_CompMeanXS(z,A,V); 0053 [A,V,comp_xs_log_text] = VMT_CompMeanXS(z,A,V); 0054 %msgbox('Processing Data...Please Be Patient','VMT Status','help','replace'); 0055 log_text = vertcat(log_text, comp_xs_log_text); 0056 0057 %% Decompose the velocities into u, v, and w components 0058 [A,V] = VMT_CompMeanXS_UVW(z,A,V); 0059 %msgbox('Processing Data...Please Be Patient','VMT Status','help','replace'); 0060 0061 %% Decompose the velocities into primary and secondary components 0062 [A,V,comp_prisec_log_text] = VMT_CompMeanXS_PriSec(z,A,V); 0063 %msgbox('Processing Data...Please Be Patient','VMT Status','help','replace'); 0064 log_text = vertcat(log_text, comp_prisec_log_text); 0065 0066 %% Perform the Rozovskii computations 0067 [V,roz_log_text] = VMT_Rozovskii(V,A); 0068 log_text = vertcat(log_text, roz_log_text); 0069 0070 %figure(4); clf 0071 %plot3(V.mcsX,V.mcsY,V.mcsDepth(1)) 0072 %disp('Processing Completed') 0073 log_text = vertcat(log_text, ' Processing Completed.'); 0074 catch err 0075 if isdeployed 0076 errLogFileName = fullfile(pwd,... 0077 ['errorLog' datestr(now,'yyyymmddHHMMSS') '.txt']); 0078 msgbox({['An unexpected error occurred. Error code: ' err.identifier];... 0079 ['Error details are being written to the following file: '];... 0080 errLogFileName},... 0081 'VMT Status: Unexpected Error',... 0082 'error'); 0083 fid = fopen(errLogFileName,'W'); 0084 fwrite(fid,err.getReport('extended','hyperlinks','off')); 0085 fclose(fid); 0086 rethrow(err) 0087 else 0088 msgbox(['An unexpected error occurred. Error code: ' err.identifier],... 0089 'VMT Status: Unexpected Error',... 0090 'error'); 0091 rethrow(err); 0092 end 0093 end 0094 0095 0096 %% Notes: 0097 0098 %1. I removed scripts at the end of the original code that computes 0099 %standard deviations (12-9-08)