VMT_PlotPlanViewQuiversMAT

PURPOSE ^

No longer implemented in the current version

SYNOPSIS ^

function PVdata = VMT_PlotPlanViewQuiversMAT(zPathName,zFileName,zf,drng,ascale,QuiverSpacing,pvsmwin,pshore,plot_english)

DESCRIPTION ^

 No longer implemented in the current version

 Plots a plan view of the measurement region with a vector field of
 depth averaged velocity for each processed mean cross section.

 MAT adapts the code for use with the gui by changing the file input
 structure.  Also adds a separate window size for smoothing (pvsmwin).

 Added DOQQ plotting capabilities (PRJ, 6-23-10)
 Added the ability to change the plotting units to english
 Added the ability to output data with option in GUI

 User Notes:

 1. Leave drng blank (i.e. []) for full depth means or specify
   the a 2 component vector of depths in meters (drng = [ dupper dlower])
   of the depth range to average and plot

 (adapted from code by J. Czuba)
 
 P.R. Jackson, USGS, 12-10-08 
 Last modified: F.L. Engel, USGS, 2/20/2013

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function PVdata = VMT_PlotPlanViewQuiversMAT(zPathName,zFileName,zf,drng,ascale,QuiverSpacing,pvsmwin,pshore,plot_english)
0002 % No longer implemented in the current version
0003 %
0004 % Plots a plan view of the measurement region with a vector field of
0005 % depth averaged velocity for each processed mean cross section.
0006 %
0007 % MAT adapts the code for use with the gui by changing the file input
0008 % structure.  Also adds a separate window size for smoothing (pvsmwin).
0009 %
0010 % Added DOQQ plotting capabilities (PRJ, 6-23-10)
0011 % Added the ability to change the plotting units to english
0012 % Added the ability to output data with option in GUI
0013 %
0014 % User Notes:
0015 %
0016 % 1. Leave drng blank (i.e. []) for full depth means or specify
0017 %   the a 2 component vector of depths in meters (drng = [ dupper dlower])
0018 %   of the depth range to average and plot
0019 %
0020 % (adapted from code by J. Czuba)
0021 %
0022 % P.R. Jackson, USGS, 12-10-08
0023 % Last modified: F.L. Engel, USGS, 2/20/2013
0024 
0025 
0026 warning off
0027 disp('Plotting Plan View with Depth-Averaged Velocity Vectors...')
0028 
0029 
0030 
0031 %% User Input
0032 
0033 %QuiverSpacing   = 10;  %Plots a quiver every X emsembles
0034 %ascale          = 1.5; %Set to 1 for autoscaling and other values for increased or decreased arrow lengths
0035 savebathy = 0;  %Saves bathymatry data
0036 %savePVdata = 0;  %Saves plan view data to a file
0037 if exist('plot_english')==0
0038     plot_english  = 0;
0039     disp('No units specified, plotting in metric units by default')
0040 end
0041 
0042 %% Plot Quivers on Area Map
0043 
0044 % bathyx = [];
0045 % bathyy = [];
0046 % bathyz = [];
0047 
0048 if isnan(drng)
0049     drng = [];
0050 end
0051 
0052 windowSize = pvsmwin; %Size of window for running average in smoothing of mean vel vectors (set in GUI)
0053 
0054 plan_view_figure = figure(2); clf
0055 
0056 if zf > 1
0057     mapmult = 1;
0058 else
0059     mapmult = 0;
0060 end
0061 gradDAV = [];
0062 gradDAVx = [];
0063 gradDAVy = [];
0064 ve = [];
0065 vn = [];
0066 xa = [];
0067 ya = [];
0068 xp = [];
0069 yp = [];
0070 bs = [];
0071 vp = [];
0072 vv = [];
0073 vs = [];
0074 dp = [];
0075 
0076 % Check that zf is correct. In certain cases zf may correspond to the
0077 % number of A files, and NOT the number of inputs.
0078 if zf~=numel(zFileName)
0079     zf = numel(zFileName);
0080 end
0081 
0082 for n=1:zf
0083     try
0084         eval(['load ' zPathName '\' zFileName{n}]);
0085     catch
0086         errstrng = {'An unknown error occurred when reading the MAT file.'...
0087             'This error may have occurred if Matlab was unable to find selected files. '...
0088             'Ensure the filenames and path to the selected files are free of white spaces and special '...
0089             'characters (e.g. *?<>|) and try again.'};
0090         warndlg(errstrng, 'VMT Error')
0091     end
0092     %Get the grid node spacing  (assumes all trans processed with same grid
0093     %spacing)
0094     dx = V.mcsX(1,1) - V.mcsX(1,2);
0095     dy = V.mcsY(1,1) - V.mcsY(1,2);
0096     hgns = sqrt(dx.^2 + dy.^2);
0097     
0098     if ~isempty(drng)
0099         indx = find(V.mcsDepth(:,1) < drng(1) | V.mcsDepth(:,1) > drng(2));
0100         
0101         %Set all data outside depth range to nan
0102         V.mcsX(indx,:) = nan;
0103         V.mcsY(indx,:) = nan;
0104         V.mcsEast(indx,:) = nan;
0105         V.mcsNorth(indx,:) = nan;
0106         V.mcsDepth(indx,:) = nan;
0107         V.mcsBack(indx,:) = nan;
0108         V.w(indx,:) = nan;
0109         V.vp(indx,:) = nan;
0110         V.vs(indx,:) = nan;
0111        
0112         if n == 1
0113             if plot_english
0114                 disp(['Plotting Depth Range ' num2str(drng(1)*3.281) 'ft to ' num2str(drng(2)*3.281) 'ft'])
0115             else 
0116                 disp(['Plotting Depth Range ' num2str(drng(1)) 'm to ' num2str(drng(2)) 'm'])
0117             end
0118         end
0119         
0120         clear indx
0121     end
0122     
0123    %Compute mean positions
0124    V.mcsX1 = nanmean(V.mcsX,1);
0125    V.mcsY1 = nanmean(V.mcsY,1);
0126     
0127    if 0; %Compute the depth averaged velocity (straight arithmetic mean--old method)
0128         V.mcsEast1 = nanmean(V.mcsEast,1);
0129         V.mcsNorth1 = nanmean(V.mcsNorth,1);
0130     
0131    else %Compute the depth (or layer) averaged velocity (new method)
0132         V.mcsEast1  = VMT_LayerAveMean(V.mcsDepth,V.mcsEast);
0133         V.mcsNorth1 = VMT_LayerAveMean(V.mcsDepth,V.mcsNorth);
0134         V.mcsBack1  = VMT_LayerAveMean(V.mcsDepth,V.mcsBack);
0135         V.w1        = VMT_LayerAveMean(V.mcsDepth,V.w);
0136         V.vp1       = VMT_LayerAveMean(V.mcsDepth,V.vp);
0137         V.vs1       = VMT_LayerAveMean(V.mcsDepth,V.vs);
0138    end
0139     
0140 
0141     %Smooth using a running mean defined by WindowSize (averages
0142     %'2*windowsize+1' ensembles together (centered on node (boxcar filter))
0143     if windowSize == 0
0144         V.mcsX1sm     = V.mcsX1;
0145         V.mcsY1sm     = V.mcsY1;
0146         V.mcsEast1sm  = V.mcsEast1;
0147         V.mcsNorth1sm = V.mcsNorth1;
0148     else
0149         %V.mcsX1sm     = filter(ones(1,windowSize)/windowSize,1,V.mcsX1);
0150         %V.mcsY1sm     = filter(ones(1,windowSize)/windowSize,1,V.mcsY1);
0151         %V.mcsEast1sm  = filter(ones(1,windowSize)/windowSize,1,V.mcsEast1);
0152         %V.mcsNorth1sm = filter(ones(1,windowSize)/windowSize,1,V.mcsNorth1);
0153         
0154         V.mcsEast1sm  = nanmoving_average(V.mcsEast1,windowSize);  %added 1-7-10, prj
0155         V.mcsNorth1sm = nanmoving_average(V.mcsNorth1,windowSize);
0156         V.mcsX1sm     = V.mcsX1;
0157         V.mcsY1sm     = V.mcsY1;
0158        
0159     end
0160     
0161     
0162     for zi = 1:z
0163         Mag(:,:,zi) = A(zi).Comp.mcsMag(:,:);
0164     end
0165     numavg = nansum(~isnan(Mag),3);
0166     numavg(numavg==0) = NaN;
0167     enscnt = nanmean(numavg,1);
0168     [I,J] = ind2sub(size(enscnt),find(enscnt>=1));  %Changed to 1 from 2 (PRJ, 12-12-08)
0169 
0170     et = windowSize+J(1):QuiverSpacing:J(end);  %Does this cutoff boundary data???? PRJ 4-9-09
0171     
0172     % M(2*n-1,1)=V.mcsX(1,1);
0173     % M(2*n,1)=V.mcsX(1,end);
0174     % M(2*n-1,2)=V.mcsY(1,1);
0175     % M(2*n,2)=V.mcsY(1,end);
0176     %
0177     % idx=strfind(zFileName{n},'.');
0178     % namecut=zFileName{1,n}(2:idx(1)-1);
0179     %
0180     % pwr_kml(namecut,latlon);
0181     
0182     if n == 1
0183         %toquiv(1:493,1:4)=NaN;
0184         lenp = 0;
0185     end
0186     
0187     len = length(V.mcsX1sm(1,et));
0188 
0189     toquiv(lenp+1:len+lenp,1)=V.mcsX1sm(1,et);
0190     toquiv(lenp+1:len+lenp,2)=V.mcsY1sm(1,et);
0191     toquiv(lenp+1:len+lenp,3)=nanmean(V.mcsEast1sm(:,et),1);
0192     toquiv(lenp+1:len+lenp,4)=nanmean(V.mcsNorth1sm(:,et),1);
0193 
0194     lenp = length(V.mcsX1sm(1,et))+lenp;
0195 
0196     % quiverc2wcmap(V.mcsX1sm(1,et),V.mcsY1sm(1,et),nanmean(V.mcsEast1sm(:,et),1),nanmean(V.mcsNorth1sm(:,et),1),0);
0197     %quiverc(V.mcsX1sm(1,et),V.mcsY1sm(1,et),nanmean(V.mcsEast1sm(:,et),1),nanmean(V.mcsNorth1sm(:,et),1),0)
0198     %     quiver(V.mcsX1sm(1,et),V.mcsY1sm(1,et),nanmean(V.mcsEast1sm(:,et),1),nanmean(V.mcsNorth1sm(:,et),1),0)
0199     
0200     %output bathymetry data
0201 %     if savebathy
0202 %         bathyx = [bathyx V.mcsX1];
0203 %         bathyy = [bathyy V.mcsY1];
0204 %         bathyz = [bathyz V.mcsBed];
0205 %     end
0206     
0207     %Form vectors for contour mapping
0208     xa = [xa V.mcsX1(1,1:end)];  %All points, not subsampled
0209     ya = [ya V.mcsY1(1,1:end)];
0210     xp = [xp V.mcsX1(1,et)];    %Subsampled points
0211     yp = [yp V.mcsY1(1,et)];
0212     ve = [ve V.mcsEast1(:,et)];
0213     vn = [vn V.mcsNorth1(:,et)];
0214     vv = [vv V.w1(:,et)];
0215     if 0%sum(V.vp1(:,et),2) < 0  %Not working yet
0216         vp = [vp -V.vp1(:,et)];  %Flips sign if negative total Vp1
0217     else
0218         vp = [vp V.vp1(:,et)];
0219     end
0220     vs = [vs V.vs1(:,et)];
0221     bs = [bs V.mcsBack1(:,et)];
0222     dp = [dp V.mcsBed(1:end)];
0223     
0224     
0225     if mapmult
0226         clear A V z Mag numavg enscnt I J latlon idx namecut
0227     end
0228 end
0229 vr = sqrt(toquiv(:,3).^2+toquiv(:,4).^2);
0230 
0231 % Save only the good data %Added 3-28-12 PRJ
0232 gdindx = find(~isnan(vr));
0233 toquiv = toquiv(gdindx,:);
0234 
0235 figure(2); hold all
0236 % if pdoqq
0237 %     VMT_OverlayDOQQ
0238 % end
0239 if pshore
0240     if isstruct(Map) 
0241         VMT_PlotShoreline(Map)
0242     else
0243         disp('No Shoreline File Loaded')
0244     end   
0245 end
0246 
0247 %quiverc2wcmap(toquiv(:,1),toquiv(:,2),toquiv(:,3),toquiv(:,4),0,vr,1);
0248 if plot_english
0249     figure(2); hold on
0250     quiverc(toquiv(:,1),toquiv(:,2),toquiv(:,3)*0.03281,toquiv(:,4)*0.03281,ascale);  %*0.03281 to go from cm/s to ft/s
0251     colorbar_handle = colorbar;
0252     if sum(~isnan(vr)) == 0
0253         errordlg('No Data in Specified Depth Range','Plotting Error');
0254     end
0255     disp(['DAV range (ft/s) = ' num2str(nanmin(vr)*0.03281) ' to ' num2str(nanmax(vr)*0.03281)])
0256     caxis([nanmin(vr*0.03281) nanmax(vr*0.03281)])  %resets the color bar axis from 0 to 64 to span the velocity mag range
0257     if ~isempty(drng)
0258         title_handle = title({'Depth-Averaged Velocities (ft/s)'; ['Averaged over depths ' num2str(drng(1)*3.281) 'ft to ' num2str(drng(2)*3.281) 'ft']},'Color','w');
0259     else
0260         title_handle = title('Depth-Averaged Velocities (ft/s)','Color','w');
0261     end    
0262     
0263 else  %plot in metric units
0264     figure(2); hold on
0265     quiverc(toquiv(:,1),toquiv(:,2),toquiv(:,3),toquiv(:,4),ascale);
0266     colorbar_handle = colorbar('FontSize',16,'XColor','w','YColor','w');
0267     if sum(~isnan(vr)) == 0
0268         errordlg('No Data in Specified Depth Range','Plotting Error');
0269     end
0270     disp(['DAV range (cm/s) = ' num2str(nanmin(vr)) ' to ' num2str(nanmax(vr))])
0271     caxis([nanmin(vr) nanmax(vr)])  %resets the color bar axis from 0 to 64 to span the velocity mag range
0272     if ~isempty(drng)
0273         title_handle = title({'Depth-Averaged Velocities (cm/s)'; ['Averaged over depths ' num2str(drng(1)) 'm to ' num2str(drng(2)) 'm']},'Color','w');
0274     else
0275         title_handle = title('Depth-Averaged Velocities (cm/s)','Color','w');
0276     end
0277 end
0278 xlabel_handle = xlabel('UTM Easting (m)');
0279 ylabel_handle = ylabel('UTM Northing (m)');
0280 
0281 % Tag Figure Elements
0282 % set(plan_view_vector_handle,        'Tag','PlanViewVectors')
0283 set(colorbar_handle,                'Tag','ColorBar')
0284 set(title_handle,                   'Tag','PlanViewPlotTitle')
0285 set(ylabel_handle,                  'Tag','yLabelText')
0286 set(xlabel_handle,                  'Tag','xLabelText')
0287 
0288 
0289 % Adjust figure
0290 figure(2); box on
0291 set(gcf,'Color',[0 0 0]) %[0.2 0.2 0.2]
0292 set(gca,...
0293     'DataAspectRatio',[1 1 1],...
0294     'PlotBoxAspectRatio',[1 1 1],...
0295     'TickDir','out')
0296 set(get(gca,'Title'),   'FontSize',14,'Color','w') 
0297 set(get(gca,'xlabel'),  'FontSize',14,'Color','w') 
0298 set(get(gca,'ylabel'),  'FontSize',14,'Color','w')
0299 set(colorbar_handle,...
0300     'FontSize',14,...
0301     'XColor','w',...
0302     'YColor','w');
0303 if 0
0304     CC = cptcmap('printvelocity.cpt');
0305     colormap(CC)
0306 end
0307 
0308 
0309 % %if isstruct(Map)
0310 %     set(gca,'Color',[0.8,0.733,0.533]) %[0.3 0.3 0.3]
0311 % else
0312 %     set(gca,'Color',[0 0 0]) %[0.3 0.3 0.3]
0313 % end
0314 
0315 
0316 
0317 %plot([min(xa) min(xa) max(xa) max(xa) min(xa)], [min(ya) max(ya) max(ya) min(ya) min(ya)],'m-'); hold on
0318 
0319 %Compute the magnitude and direction for output (for GIS)
0320 %[xo,yo,mag,dir] = VMT_VelVectMagDir(toquiv(:,1),toquiv(:,2),toquiv(:,3),toquiv(:,4));
0321 %outmat = [xo yo mag dir];
0322 %dlmwrite([zPathName '\testoutmd.txt'],outmat,'precision',15)
0323 
0324 % %Save bathy
0325 % if savebathy
0326 %     outmat = [bathyx' bathyy' bathyz'];
0327 %     dlmwrite([zPathName '\bathyout.txt'],outmat,'precision',15);
0328 % end
0329 
0330 % Format the ticks for UTM and allow zooming and panning
0331 ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM
0332 hdlzm = zoom;
0333 set(hdlzm,'ActionPostCallback',@mypostcallback_zoom);
0334 set(hdlzm,'Enable','on');
0335 hdlpn = pan;
0336 set(hdlpn,'ActionPostCallback',@mypostcallback_pan);
0337 set(hdlpn,'Enable','on');
0338 
0339 %% Save the planview data as output and to an *.anv file with spacing and smoothing (for iRiC)
0340 outmat = zeros(size(toquiv,1),5);
0341 outmat(:,1:2) = toquiv(:,1:2);  % In metric units
0342 outmat(:,4:5) = toquiv(:,3:4)./100;  %Converts cm/s to m/s
0343 
0344 %Screen to ID missing data
0345 goodrows = [];
0346 for i = 1:length(outmat)
0347     rowsum = sum(isnan(outmat(i,:)));
0348     if rowsum == 0
0349         goodrows = [goodrows; i];
0350     end
0351 end
0352 
0353 PVdata.outmat = outmat(goodrows,:)';
0354 
0355 
0356 %% PlanView contour plotting
0357 if 0 %Plot a filled velocity magnitude contour plot with quivers and a velocity gradient contour plot
0358     
0359     var = 'backscatter';
0360     
0361     indx = ~isnan(ve) & ~isnan(vn) & ~isnan(vv);
0362     xg = xp(indx); %subsampled, good points
0363     yg = yp(indx);
0364     ve = ve(indx);
0365     vn = vn(indx);
0366     vm = sqrt(ve.^2 + vn.^2);
0367     vv = vv(indx);
0368     vp = vp(indx);
0369     vs = vs(indx);
0370     bs = bs(1:end);  %Take all values regardless of valid velocity
0371     dp = dp(1:end);  %Take all values regardless of valid velocity
0372         
0373     %clear ve vn xp yp
0374     
0375     figure(4); clf
0376     if isstruct(Map) %& (drng(1) == 0 | isempty(drng))  %Only add the shoreline if depth range starts at zero (to minimize interpolation at banks)
0377         VMT_PlotShoreline(Map)
0378         indxmap = find(Map.UTMe >= min(xa) & Map.UTMe <= max(xa)...
0379             & Map.UTMn >= min(ya) & Map.UTMn <= max(ya));
0380         xa = [xa Map.UTMe(indxmap)'];
0381         ya = [ya Map.UTMn(indxmap)'];
0382         xp = [xp Map.UTMe(indxmap)'];
0383         yp = [yp Map.UTMn(indxmap)'];
0384         yg = [yg Map.UTMn(indxmap)'];
0385         xg = [xg Map.UTMe(indxmap)'];
0386         vm = [vm zeros(size(Map.UTMe(indxmap)'))];  %Sets the flow magnitude to zero at the shoreline
0387         ve = [ve zeros(size(Map.UTMe(indxmap)'))];
0388         vn = [vn zeros(size(Map.UTMe(indxmap)'))];
0389         vv = [vv zeros(size(Map.UTMe(indxmap)'))];
0390         vp = [vp zeros(size(Map.UTMe(indxmap)'))];
0391         vs = [vs zeros(size(Map.UTMe(indxmap)'))];
0392         bs = [bs nan*ones(size(Map.UTMe(indxmap)'))];
0393         dp = [dp zeros(size(Map.UTMe(indxmap)'))];
0394       
0395         
0396     else
0397         disp('No Shoreline File Loaded')
0398     end
0399     clvls = 60;
0400     
0401     xgrdpts = 500;
0402     ygrdpts = xgrdpts;
0403     
0404     switch var
0405         case{'magnitude'}  %Plots the velocity magnitude (horizontal plane)
0406             gridvar = vm;
0407             [ZI,XI,YI] = gridfit(xg,yg,gridvar,xgrdpts,ygrdpts);
0408         case{'vertical'}  %Plots the vertical velocity
0409             gridvar = vv;
0410             [ZI,XI,YI] = gridfit(xg,yg,gridvar,xgrdpts,ygrdpts,'smoothness',2);
0411         case{'primary'}  %Plots the primary velocity n %%%**************************NEEDS TO BE CORRECTED FOR NEG PRIMARY
0412             gridvar = vp;
0413             [ZI,XI,YI] = gridfit(xg,yg,gridvar,xgrdpts,ygrdpts);
0414         case{'secondary'}  %Plots the secondary velocity (magnitude of secondary and vertical components)
0415             gridvar = vs;
0416             [ZI,XI,YI] = gridfit(xg,yg,gridvar,xgrdpts,ygrdpts);
0417         case{'backscatter'}  %Plots the backscatter
0418             gridvar = bs;
0419             [ZI,XI,YI] = gridfit(xp,yp,gridvar,xgrdpts,ygrdpts);
0420         case{'shear'}  %Plots the shear
0421             gridvar = vm;
0422             [ZI,XI,YI] = gridfit(xg,yg,gridvar,xgrdpts,ygrdpts);
0423             HX = [0 diff(XI)];
0424             HY = [0 diff(YI)];
0425         case{'secopri'}  %Plots the ratio of the secondary to primary velocity
0426             gridvar = abs(vs)./abs(vp);
0427             [ZI,XI,YI] = gridfit(xg,yg,gridvar,xgrdpts,ygrdpts,'smoothness',1);
0428         case{'depth'}  %Plots the average bed depth
0429             gridvar = dp;
0430             [ZI,XI,YI] = gridfit(xa,ya,gridvar,xgrdpts,ygrdpts,'smoothness',1);
0431 %             xnodes = linspace(min(xa),max(xa),xgrdpts)';
0432 %             xnodes(end) = max(xa); % make sure it hits the max
0433 %             ynodes = linspace(min(ya),max(ya),ygrdpts)';
0434 %             ynodes(end) = max(ya); % make sure it hits the max
0435 %             [XI,YI] = meshgrid(xnodes,ynodes);
0436 %             [ZI] = griddata(xa,ya,gridvar,XI,YI);
0437 
0438   
0439        
0440     end
0441     
0442     switch var
0443           case{'shear'} 
0444               [gradX,gradY] = gradient(ZI./100,HX,HY);  
0445               ZI = sqrt(gradX.^2 + gradY.^2);
0446               gridvar = ZI;
0447     end
0448     
0449     if isstruct(Map)
0450         OUT = ~inpolygon(XI,YI,Map.UTMe,Map.UTMn);
0451         ZI(OUT) = nan; %omit data outside of the river banks
0452     end
0453     
0454     zmin  = floor(nanmin(nanmin(ZI)));
0455     zmax  = ceil(nanmax(nanmax(ZI)));
0456     zinc  = (zmax - zmin) / clvls;
0457     zlevs = zmin:zinc:zmax;
0458     switch var
0459           case{'secopri'} 
0460               zmax = 1.0;
0461               zinc  = (zmax - 0) / clvls;
0462               zlevs = 0:zinc:zmax;
0463         case{'depth'}
0464             zmin  = 0;
0465             zmax  = ceil(nanmax(nanmax(gridvar)));
0466             zinc  = (zmax - zmin) / clvls;
0467             zlevs = zmin:zinc:zmax;
0468     end
0469 
0470 
0471     
0472     contour(XI,YI,ZI,zlevs,'Fill','on','Linestyle','none'); hold on
0473     colorbar('FontSize',16,'XColor','w','YColor','w');
0474 
0475     
0476     if 0 %Check plots by adding values for visual inspection
0477         for j = 1:length(gridvar)
0478             text(xg(j),yg(j),num2str(gridvar(j)),'FontSize',6); hold on
0479         end
0480     end
0481     
0482     %Blank if provided a shoreline
0483     if isstruct(Map)
0484         VMT_BlankShoreline(xa,ya,Map);
0485         %VMT_PlotShoreline(Map);
0486     end
0487     quiver(xg,yg,ve,vn,'k','Filled'); hold on
0488     %xlabel('UTM Easting (m)')
0489     %ylabel('UTM Northing (m)')
0490     
0491     if ~isempty(drng)
0492         switch var
0493             case{'magnitude'}  %Plots the velocity magnitude (horizontal plane)
0494                 title({'Depth-Averaged Horizontal Velocity Magnitude (cm/s)'; ['Averaged over depths ' num2str(drng(1)) 'm to ' num2str(drng(2)) 'm']},'Color','w')
0495             case{'vertical'}  %Plots the vertical velocity
0496                 title({'Depth-Averaged Vertical Velocity (cm/s)'; ['Averaged over depths ' num2str(drng(1)) 'm to ' num2str(drng(2)) 'm']},'Color','w')
0497             case{'primary'}  %Plots the primary velocity
0498                 title({'Depth-Averaged Primary Velocity (cm/s)'; ['Averaged over depths ' num2str(drng(1)) 'm to ' num2str(drng(2)) 'm']},'Color','w')
0499             case{'secondary'}  %Plots the secondary velocity
0500                 title({'Depth-Averaged Secondary Velocity (cm/s)'; ['Averaged over depths ' num2str(drng(1)) 'm to ' num2str(drng(2)) 'm']},'Color','w')
0501             case{'backscatter'}  %Plots the backscatter
0502                 title({'Depth-Averaged Backscatter (dB)'; ['Averaged over depths ' num2str(drng(1)) 'm to ' num2str(drng(2)) 'm']},'Color','w')
0503             case{'shear'}  %Plots the shear
0504                 title({'Depth-Averaged Shear (s^{-1})'; ['Averaged over depths ' num2str(drng(1)) 'm to ' num2str(drng(2)) 'm']},'Color','w')
0505             case{'secopri'}  %Plots the ratio of the secondary to primary velocity
0506                 title({'Depth-Averaged Ratio of Secondary to Primary Velocity'; ['Averaged over depths ' num2str(drng(1)) 'm to ' num2str(drng(2)) 'm']},'Color','w');
0507             case{'depth'}  %Plots the average bed depth (m)
0508                 title('Average Bed Depth (m)','Color','w');
0509         end
0510     else 
0511         switch var
0512             case{'magnitude'}  %Plots the velocity magnitude (horizontal plane)
0513                 title('Depth-Averaged Horizontal Velocity Magnitude (cm/s)','Color','w')
0514             case{'vertical'}  %Plots the vertical velocity
0515                 title('Depth-Averaged Vertical Velocity (cm/s)','Color','w')
0516             case{'primary'}  %Plots the primary velocity
0517                 title('Depth-Averaged Primary Velocity (cm/s)','Color','w')
0518             case{'secondary'}  %Plots the secondary velocity
0519                 title('Depth-Averaged Secondary Velocity (cm/s)','Color','w')
0520             case{'backscatter'}  %Plots the backscatter
0521                 title('Depth-Averaged Backscatter (dB)','Color','w')
0522             case{'shear'}  %Plots the shear
0523                 title('Depth-Averaged Shear (s^{-1})','Color','w')
0524             case{'secopri'}  %Plots the ratio of the secondary to primary velocity
0525                 title('Depth-Averaged Ratio of Secondary to Primary Velocity','Color','w');
0526             case{'depth'}  %Plots the average bed depth (m)
0527                 title('Average Bed Depth (m)','Color','w');
0528         end
0529     end
0530     figure(4); box on
0531     set(gcf,'Color',[0 0 0]) %[0.2 0.2 0.2]
0532     if isstruct(Map)
0533         set(gca,'Color',[0.8,0.733,0.533]) %[0.3 0.3 0.3]
0534     else
0535         set(gca,'Color',[0 0 0]) %[0.3 0.3 0.3]
0536     end
0537     set(gca,'DataAspectRatio',[1 1 1],'PlotBoxAspectRatio',[1 1 1])
0538     set(gca,'TickDir','out')
0539     set(gca,'XColor','w')
0540     set(gca,'YColor','w')
0541     
0542 end
0543 
0544 %% Embedded functions
0545 function mypostcallback_zoom(obj,evd)
0546 ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM (when zooming)
0547 
0548 function mypostcallback_pan(obj,evd)
0549 ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM (when panning)
0550

Generated on Thu 21-Aug-2014 10:40:31 by m2html © 2005