Home > utilities > do_vector_plot.m

do_vector_plot

PURPOSE ^

Plot vectors of parameters of interest.

SYNOPSIS ^

function [Plots]=do_vector_plot(plotOPTS,FVCOM)

DESCRIPTION ^

 Plot vectors of parameters of interest.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Plots]=do_vector_plot(plotOPTS,FVCOM)
0002 % Plot vectors of parameters of interest.
0003 m_mappath;
0004 
0005 figure(plotOPTS.figure); clf
0006 m_proj('UTM','lon',[plotOPTS.range_lon],'lat',[plotOPTS.range_lat],'zon',30,'ell','grs80')
0007 m_grid('box','fancy')
0008 m_usercoast(plotOPTS.coastline_file,'Color','k','LineWidth',3);
0009 [x,y]=m_ll2ll(FVCOM.xc,FVCOM.yc); x=x+6;
0010 
0011 igood = find (x < plotOPTS.range_lon(2) & x > plotOPTS.range_lon(1) &...
0012     y < plotOPTS.range_lat(2) & y > plotOPTS.range_lat(1));
0013 igood=igood(1:plotOPTS.data_dec:end);
0014 
0015 if isfield(plotOPTS,'nz_plot_vec')
0016     nLayers=size(plotOPTS.nz_plot_vec,2);
0017     nLayersRange=plotOPTS.nz_plot_vec;
0018 else
0019     nLayers=size(plotOPTS.nz_plot,2);
0020     nLayersRange=plotOPTS.nz_plot;
0021 end
0022 
0023 if nLayers==1
0024     colourSpec=[0 0 0];
0025 else
0026     colourSpec=colormap(hsv(nLayers));
0027 end
0028 
0029 % Preallocate outputs
0030 u=nan(size(igood,1),nLayers,length(plotOPTS.Time_record));
0031 v=nan(size(igood,1),nLayers,length(plotOPTS.Time_record));
0032 
0033 % Check if we're running
0034 for aa=1:length(plotOPTS.Time_record)
0035     fprintf('Time step %i of %i\n',aa,length(plotOPTS.Time_record))
0036     
0037 
0038     % Mesh goes underneath vectors.
0039     if plotOPTS.do_mesh
0040         % plot vertices
0041         [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,'clip','on');
0042         Plots(plotOPTS.figure).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,...
0043             'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on
0044     end
0045 
0046     for ii=1:nLayers
0047         u(:,ii)=squeeze(FVCOM.u(igood,nLayersRange(ii),(aa)));
0048         v(:,ii)=squeeze(FVCOM.v(igood,nLayersRange(ii),(aa)));
0049     end
0050     for jj=1:nLayers
0051         [Plots(plotOPTS.figure).handles(jj),~]=m_vec(plotOPTS.vel_sca,x(igood),y(igood),...
0052             u(:,jj),v(:,jj),colourSpec(jj,:),...
0053             'shaftwidth',1,'headwidth',2);
0054         hold on
0055     end
0056     pause(plotOPTS.pause)
0057     if aa~=length(plotOPTS.Time_record)
0058         delete(Plots(plotOPTS.figure).handles(:))
0059     end
0060 end

Generated on Tue 18-Dec-2012 12:37:31 by m2html © 2005