0001 function [z,A,V,log_text] = VMT_PlotXSContQuiver(z,A,V,var,sf,exag,qspchorz,qspcvert,secvecvar,vvelcomp,plot_english,varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 if exist('plot_english') == 0
0016 plot_english = 0;
0017 disp('No units specified, plotting in metric units by default')
0018 end
0019
0020 AS = 1;
0021 if AS == 0
0022 MANrefvel = 25;
0023 end
0024
0025
0026
0027 if any(size(varargin)>0)
0028 reference_velocity = varargin{1};
0029 distance = varargin{2};
0030 depth = varargin{3};
0031 else
0032 reference_velocity = [];
0033 distance = [];
0034 depth = [];
0035 end
0036
0037
0038 if isempty(z) & isempty(A) & isempty(V)
0039 [z,A,V,zmin,zmax,cont_log_text,fig_contour_handle] = VMT_PlotXSCont([],[],[],var,exag,plot_english);
0040 else
0041 [z,A,V,zmin,zmax,cont_log_text,fig_contour_handle] = VMT_PlotXSCont(z,A,V,var,exag,plot_english);
0042 end
0043 log_text = cont_log_text;
0044
0045
0046
0047
0048
0049
0050
0051
0052 if plot_english
0053 sf = sf/0.01;
0054 end
0055
0056
0057
0058 clvls = 60;
0059
0060
0061
0062
0063
0064 if 0
0065 [I,J] = ind2sub(size(V.vp(2,:)),find(~isnan(V.vp(2,:))==1));
0066 et = J(1):qspchorz:J(end);
0067 [r c]=size(V.vp);
0068 bi = 1:2:r;
0069 else
0070
0071
0072
0073 i = 1;
0074 while any(isnan(V.vp(i,:)))
0075 i=i+1;
0076 if i > size(V.vp,1)
0077 break
0078 end
0079 end
0080 i=5;
0081
0082
0083 try
0084 [I,J] = ind2sub(size(V.vp(i,:)),find(~isnan(V.vp(i,:))==1));
0085 catch err
0086 [I,J] = ind2sub(size(V.vp(1,:)),find(~isnan(V.vp(1,:))==1));
0087 end
0088
0089 et = J(1):qspchorz:J(end);
0090 [r c]=size(V.vp);
0091 bi = 1:qspcvert:r;
0092 end
0093
0094
0095
0096
0097
0098
0099
0100 if vvelcomp
0101 vertcomp = V.wSmooth;
0102 else
0103 vertcomp = zeros(size(V.wSmooth));
0104 end
0105
0106 figure(fig_contour_handle); hold all
0107
0108 switch secvecvar
0109 case{'transverse'}
0110 vr = sqrt(abs((-sf.*V.vSmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));
0111 case{'secondary_zsd'}
0112 vr = sqrt(abs((-sf.*V.vsSmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));
0113 case{'secondary_roz'}
0114 vr = sqrt(abs((-sf.*V.Roz.usSmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));
0115 case{'secondary_roz_y'}
0116 vr = sqrt(abs((-sf.*V.Roz.usySmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));
0117 case{'primary_roz_y'}
0118 vr = sqrt(abs((-sf.*V.Roz.upySmooth(bi,et)).^2 + (-sf./exag.*vertcomp(bi,et)).^2));
0119 end
0120
0121
0122 [rw cl] = size(V.mcsDist(bi,et));
0123 toquiv(:,1) = reshape(V.mcsDist(bi,et),rw*cl,1);
0124 toquiv(:,2) = reshape(V.mcsDepth(bi,et),rw*cl,1);
0125 switch secvecvar
0126 case{'transverse'}
0127 toquiv(:,3) = reshape(-sf.*V.vSmooth(bi,et),rw*cl,1);
0128 refvel = ceil(max(max(abs(V.vSmooth(bi,et)))));
0129
0130 case{'secondary_zsd'}
0131 toquiv(:,3) = reshape(-sf.*V.vsSmooth(bi,et),rw*cl,1);
0132 refvel = ceil(max(max(abs(V.vsSmooth(bi,et)))));
0133
0134 case{'secondary_roz'}
0135 toquiv(:,3) = reshape(-sf.*V.Roz.usSmooth(bi,et),rw*cl,1);
0136 refvel = ceil(max(max(abs(V.Roz.usSmooth(bi,et)))));
0137
0138 case{'secondary_roz_y'}
0139 toquiv(:,3) = reshape(-sf.*V.Roz.usySmooth(bi,et),rw*cl,1);
0140 refvel = ceil(max(max(abs(V.Roz.usySmooth(bi,et)))));
0141
0142 case{'primary_roz_y'}
0143 toquiv(:,3) = reshape(-sf.*V.Roz.upySmooth(bi,et),rw*cl,1);
0144 refvel = ceil(max(max(abs(V.Roz.upySmooth(bi,et)))));
0145
0146 end
0147 toquiv(:,4) = reshape(-sf./exag.*vertcomp(bi,et),rw*cl,1);
0148 toquiv(:,5) = reshape(vr,rw*cl,1);
0149
0150
0151 if isempty(distance)
0152 x1 = 0.06*max(max(V.mcsDist));
0153 x2 = 0.95*max(max(V.mcsBed));
0154 if AS == 0
0155 refvel = MANrefvel;
0156 end
0157 else
0158 x1 = distance;
0159 x2 = depth;
0160 refvel = reference_velocity;
0161 end
0162 x3=sf.*refvel;
0163 x4=0;
0164 x5=x3;
0165 toquiv(end+1,1) = x1;
0166 toquiv(end,2) = x2;
0167 toquiv(end,3) = x3;
0168 toquiv(end,4) = x4;
0169 toquiv(end,5) = x5;
0170
0171
0172 if plot_english
0173 unitlabel = '(ft/s)';
0174 else
0175 unitlabel = '(cm/s)';
0176 end
0177
0178 if plot_english
0179 convfact = 0.03281;
0180 switch var
0181 case{'backscatter'}
0182 convfact = 1.0;
0183 case{'flowangle'}
0184 convfact = 1.0;
0185 end
0186
0187 hh = quiverc2wcmap(toquiv(:,1)*3.281,toquiv(:,2)*3.281,toquiv(:,3)*0.03281,toquiv(:,4)*0.03281,0,toquiv(:,5)*0.03281,exag);
0188
0189 ylim([0 max(V.mcsBed*3.281)])
0190 caxis([zmin*convfact zmax*convfact])
0191 switch var
0192 case{'streamwise'}
0193 title_handle = title({['Streamwise Velocity ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0194 case{'transverse'}
0195 title_handle = title({['Transverse Velocity ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0196 case{'vertical'}
0197 title_handle = title({['Vertical Velocity ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0198 case{'mag'}
0199 title_handle = title({['Velocity Magnitude (Streamwise and Transverse) ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0200 case{'east'}
0201 title_handle = title({['East Velocity ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0202 case{'error'}
0203 title_handle = title({['Error Velocity ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0204 case{'north'}
0205 title_handle = title({['North Velocity ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0206 case{'primary_zsd'}
0207 title_handle = title({['Primary Velocity (Zero Secondary Discharge Definition) ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0208 case{'secondary_zsd'}
0209 title_handle = title({['Secondary Velocity (Zero Secondary Discharge Definition) ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0210 case{'primary_roz'}
0211 title_handle = title({['Primary Velocity (Rozovskii Definition) ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0212 case{'secondary_roz'}
0213 title_handle = title({['Secondary Velocity (Rozovskii Definition) ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0214 case{'primary_roz_x'}
0215 title_handle = title({['Primary Velocity (Rozovskii Definition; Downstream Component) ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0216 case{'primary_roz_y'}
0217 title_handle = title({['Primary Velocity (Rozovskii Definition; Cross-Stream Component) ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0218 case{'secondary_roz_x'}
0219 title_handle = title({['Secondary Velocity (Rozovskii Definition; Downstream Component) ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0220 case{'secondary_roz_y'}
0221 title_handle = title({['Secondary Velocity (Rozovskii Definition; Cross-Stream Component) ' unitlabel];['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0222 case{'backscatter'}
0223 title_handle = title({'Backscatter Intensity (dB)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0224 case{'flowangle'}
0225 title_handle = title({'Flow Direction (deg)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0226 end
0227
0228 ylabel_handle = ylabel('Depth (ft)');
0229 xlabel_handle = xlabel('Distance (ft)');
0230 rf_label_pos = [0.06*max(max(V.mcsDist)) 0.9*max(max(V.mcsBed))].*3.28084;
0231 ref_vector_text_handle = text(rf_label_pos(1), rf_label_pos(2),[num2str(refvel*0.03281,3) ' ft/s'],'FontSize',12,'Color','w');
0232 else
0233 hh = quiverc2wcmap(toquiv(:,1),toquiv(:,2),toquiv(:,3),toquiv(:,4),0,toquiv(:,5),exag);
0234
0235 ylim([0 max(V.mcsBed)])
0236
0237 if strcmp(var,'vorticity_vw')||strcmp(var,'vorticity_zsd')||strcmp(var,'vorticity_roz')
0238 rng = zmax - zmin;
0239 caxis([-rng/2 rng/2])
0240 else
0241 caxis([zmin zmax])
0242 end
0243 switch var
0244 case{'streamwise'}
0245 title_handle = title({'Streamwise Velocity (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0246 case{'transverse'}
0247 title_handle = title({'Transverse Velocity (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0248 case{'vertical'}
0249 title_handle = title({'Vertical Velocity (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0250 case{'mag'}
0251 title_handle = title({'Velocity Magnitude (Streamwise and Transverse) (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0252 case{'east'}
0253 title_handle = title({'East Velocity (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0254 case{'error'}
0255 title_handle = title({'Error Velocity (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0256 case{'north'}
0257 title_handle = title({'North Velocity (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0258 case{'primary_zsd'}
0259 title_handle = title({'Primary Velocity (Zero Secondary Discharge Definition) (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0260 case{'secondary_zsd'}
0261 title_handle = title({'Secondary Velocity (Zero Secondary Discharge Definition) (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0262 case{'primary_roz'}
0263 title_handle = title({'Primary Velocity (Rozovskii Definition) (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0264 case{'secondary_roz'}
0265 title_handle = title({'Secondary Velocity (Rozovskii Definition) (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0266 case{'primary_roz_x'}
0267 title_handle = title({'Primary Velocity (Rozovskii Definition; Downstream Component) (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0268 case{'primary_roz_y'}
0269 title_handle = title({'Primary Velocity (Rozovskii Definition; Cross-Stream Component) (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0270 case{'secondary_roz_x'}
0271 title_handle = title({'Secondary Velocity (Rozovskii Definition; Downstream Component) (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0272 case{'secondary_roz_y'}
0273 title_handle = title({'Secondary Velocity (Rozovskii Definition; Cross-Stream Component) (cm/s)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0274 case{'backscatter'}
0275 title_handle = title({'Backscatter Intensity (dB)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0276 case{'flowangle'}
0277 title_handle = title({'Flow Direction (deg)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0278 case{'vorticity_vw'}
0279 title_handle = title({'Streamwise Vorticity';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0280 case{'vorticity_zsd'}
0281 title_handle = title({'Streamwise Vorticity (Zero Secondary Discharge Definition)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0282 case{'vorticity_roz'}
0283 title_handle = title({'Streamwise Vorticity (Rozovskii Definition)';['with secondary flow vectors (' secvecvar ')']},'Interpreter','none');
0284 end
0285
0286 ylabel_handle = ylabel('Depth (m)');
0287 xlabel_handle = xlabel('Distance (m)');
0288 rf_label_pos = [0.06*max(max(V.mcsDist)) 0.9*max(max(V.mcsBed))];
0289 ref_vector_text_handle = text(rf_label_pos(1), rf_label_pos(2),[num2str(refvel) ' cm/s'],'FontSize',12,'Color','w');
0290 end
0291
0292
0293 secondary_vector_handles = findobj(gcf,'Type','line','-not','tag','PlotBedElevation');
0294 set(secondary_vector_handles, 'Tag','SecondaryVectors')
0295 set(ref_vector_text_handle, 'Tag','ReferenceVectorText')
0296 set(title_handle, 'Tag','ContourPlotTitle')
0297 set(ylabel_handle, 'Tag','yLabelText')
0298 set(xlabel_handle, 'Tag','xLabelText')
0299
0300
0301 set(gca,...
0302 'DataAspectRatio', [exag 1 1],...
0303 'PlotBoxAspectRatio',[exag 1 1]...
0304 ...
0305 )
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317 if 1
0318 VectorLineWidth = 1.0;
0319 set(secondary_vector_handles ,'LineWidth',VectorLineWidth)
0320 end
0321
0322
0323
0324
0325
0326
0327
0328 spratio_zsd = nanmedian(nanmedian(abs(V.vs)))./nanmedian(nanmedian(abs(V.vp)));
0329 spratio_roz = nanmedian(nanmedian(abs(V.Roz.usy)))./nanmedian(nanmedian(abs(V.Roz.up)));
0330
0331
0332 log_text = vertcat(log_text,...
0333 {[' Ratio of median Secondary to median Primary Velocity (zsd) = ' num2str(spratio_zsd)];...
0334 [' Ratio of median Secondary to median Primary Velocity (roz) = ' num2str(spratio_roz)]}...
0335 );
0336
0337 return
0338
0339
0340
0341
0342
0343