Home > utilities > do_surface_plotVelMatlabMap.m

do_surface_plotVelMatlabMap

PURPOSE ^

reads image and plots tracks or stations

SYNOPSIS ^

function [Plots]=do_surface_plotVelMatlabMap(plotOPTS,FVCOM)

DESCRIPTION ^

 reads image and plots tracks or stations

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Plots]=do_surface_plotVelMatlabMap(plotOPTS,FVCOM)
0002 % reads image and plots tracks or stations
0003 
0004 figure(plotOPTS.figure)
0005 % set(gcf,'units','normalized','outerposition',[0 0 0.5 0.5])
0006 clf
0007 axesm('mercator','MapLatLimit',plotOPTS.range_lat,'MapLonLimit',[plotOPTS.range_lon],'MeridianLabel','on',...
0008     'ParallelLabel','on','MLineLocation',[0.1],'PLineLocation',[0.1],'LabelUnits','dm')
0009 
0010 % add coastline if present
0011 if (isfield(plotOPTS,'coastline_file') && ~isempty(plotOPTS.coastline_file) )
0012     coast=load(plotOPTS.coastline_file);
0013     geoshow([coast.ncst(:,2)],[coast.ncst(:,1)],'Color','black')
0014 
0015 end
0016 
0017     mstruct = gcm;
0018 
0019 
0020 [X, Y] = mfwdtran(mstruct,plotOPTS.mesh.lat, plotOPTS.mesh.lon);
0021 
0022 
0023 if isfield(plotOPTS,'Time_record') & isfield(FVCOM,'mattime')
0024     if length(plotOPTS.Time_record)==1
0025         [dump,igoodT] = min(abs(plotOPTS.Time_record(1)-FVCOM.mattime));
0026     else
0027         
0028         igoodT = find( plotOPTS.Time_record(1) <= FVCOM.mattime &   FVCOM.mattime <=  plotOPTS.Time_record(end) );
0029     end
0030 else
0031     igoodT=(1:length(FVCOM.(plotOPTS.var_plot)));
0032 end
0033 
0034 
0035 for aa=igoodT
0036     % plot map with plotOPTS.var_plot
0037     hold on
0038     try
0039         % 3D data (i.e. DYE, pH etc.)
0040         Plots(1).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,...
0041             'FaceVertexCdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),...
0042             'CDataMapping','scaled','edgecolor','none','FaceColor','flat');
0043 %          Plots(1).handles=scatter(plotOPTS.mesh.xc,plotOPTS.mesh.yc,20,squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),'filled')
0044     catch
0045         % 2D data only (i.e. zeta etc.)
0046         Plots(1).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,...
0047             'FaceVertexCdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,aa)),...
0048             'CDataMapping','scaled','edgecolor','none','FaceColor','flat');
0049 %          Plots(1).handles=scatter(plotOPTS.mesh.xc,plotOPTS.mesh.yc,20,squeeze(FVCOM.(plotOPTS.var_plot)(:,aa)),'filled')
0050     end
0051     fprintf('Time step %i of %i\n',aa,length(plotOPTS.Time_record))
0052     display(['Time ',datestr(FVCOM.mattime(aa))])
0053     caxis(plotOPTS.clims)
0054     colorbar
0055     set(get(colorbar,'YLabel'),'String',plotOPTS.var_plot,'FontSize',14)
0056     % check if mesh elements are required
0057     if plotOPTS.do_mesh
0058         %plot vertices
0059         Plots(plotOPTS.figure).mesh=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,...
0060             'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on
0061 
0062     end
0063      tightmap
0064     %----------------------------------------------------------------------
0065     % Only in my case it needs adding 6 because proj automatically
0066     % determines a reference long in strides of 6deg while m_map doesn't
0067     %----------------------------------------------------------------------
0068 %    m_usercoast(plotOPTS.coastline_file,'patch',[0.6, 0.6, 0.6]);
0069    pause(plotOPTS.pause)
0070 %     if aa~=length(plotOPTS.Time_record)
0071 %         delete(Plots(1).handles)
0072 %     end
0073 end
0074 
0075 return
0076

Generated on Wed 10-Aug-2016 16:44:39 by m2html © 2005