


Function to display color maps of FVCOM variables (i.e. temperature)
[Plots]=do_surface_plot(plotOPTS,FVCOM)
DESCRIPTION:
Generates maps of variables using m_map toolbox (patch
INPUT:
plotOPTS = structure array with predefined options for generating the
maps
FVCOM = data extracted from FVCOM NC file. See read_netCDF_FVCOM for
details
plotOPTS.range_lat: [50.1000 50.4000]
plotOPTS.range_lon: [-4.5000 -3.8500]
plotOPTS.fig_name: 'co2_S5_slowleak'
plotOPTS.mesh: [1x1 struct]
plotOPTS.coastline_file: '../mat/tamar3_0coast.mat'
plotOPTS.zone: 30
plotOPTS.ell: 'grs80'
plotOPTS.var_plot: 'PH'
plotOPTS.clims: [6 8]
plotOPTS.do_mesh: 0
plotOPTS.nz_plot: 1
plotOPTS.figure: 1
plotOPTS.Time_record: 7.3271e+05
plotOPTS.nz_plot_vec: 1
plotOPTS.data_dec: 5
plotOPTS.vel_sca: 5
plotOPTS.pause: 0.5000

0001 function [Plots]=do_surface_plot(plotOPTS,FVCOM) 0002 % 0003 % Function to display color maps of FVCOM variables (i.e. temperature) 0004 % 0005 % [Plots]=do_surface_plot(plotOPTS,FVCOM) 0006 % 0007 % DESCRIPTION: 0008 % Generates maps of variables using m_map toolbox (patch 0009 % 0010 % INPUT: 0011 % plotOPTS = structure array with predefined options for generating the 0012 % maps 0013 % FVCOM = data extracted from FVCOM NC file. See read_netCDF_FVCOM for 0014 % details 0015 % 0016 % plotOPTS.range_lat: [50.1000 50.4000] 0017 % plotOPTS.range_lon: [-4.5000 -3.8500] 0018 % plotOPTS.fig_name: 'co2_S5_slowleak' 0019 % plotOPTS.mesh: [1x1 struct] 0020 % plotOPTS.coastline_file: '../mat/tamar3_0coast.mat' 0021 % plotOPTS.zone: 30 0022 % plotOPTS.ell: 'grs80' 0023 % plotOPTS.var_plot: 'PH' 0024 % plotOPTS.clims: [6 8] 0025 % plotOPTS.do_mesh: 0 0026 % plotOPTS.nz_plot: 1 0027 % plotOPTS.figure: 1 0028 % plotOPTS.Time_record: 7.3271e+05 0029 % plotOPTS.nz_plot_vec: 1 0030 % plotOPTS.data_dec: 5 0031 % plotOPTS.vel_sca: 5 0032 % plotOPTS.pause: 0.5000 0033 0034 % 0035 % OUTPUT: 0036 % Plots = structure array with figure handles 0037 % 0038 % EXAMPLE USAGE 0039 % [Plots]=do_surface_plot(plotOPTS,FVCOM) 0040 % 0041 % Author(s): 0042 % Ricardo Torres and Pierre Cazenave (Plymouth Marine Laboratory) 0043 % 0044 % Revision history 0045 % 0046 %============================================================================== 0047 % 0048 m_mappath; 0049 % adds m_map to matlab paths. file is in utilities directory. 0050 % amend according to your m_map installation paths 0051 0052 figure(plotOPTS.figure);clf 0053 % generate figure with correct projection lat and lon range ellipsoid and 0054 % zone. 0055 m_proj('UTM','lon',[ plotOPTS.range_lon],'lat',[plotOPTS.range_lat],'zon',plotOPTS.zone,'ell',plotOPTS.ell) 0056 m_grid('box','fancy') 0057 % add coastline if present 0058 if (isfield(plotOPTS,'coastline_file') && ~isempty(plotOPTS.coastline_file) ) 0059 m_usercoast(plotOPTS.coastline_file,'Color','k','LineWidth',3); 0060 end 0061 0062 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,'clip','on'); 0063 %------------------------------------------------------------------------------ 0064 % Generate maps at a give level 0065 %------------------------------------------------------------------------------ 0066 0067 for aa=1:length(plotOPTS.Time_record) 0068 fprintf('Time step %i of %i\n',aa,length(plotOPTS.Time_record)); 0069 %plot map 0070 hold on 0071 Plots(plotOPTS.figure).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,... 0072 'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),'edgecolor','interp','facecolor','interp'); 0073 0074 caxis(plotOPTS.clims) 0075 colorbar 0076 % check if mesh elements are required 0077 if plotOPTS.do_mesh 0078 %plot vertices 0079 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,'clip','on'); 0080 Plots(plotOPTS.figure).mesh=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,... 0081 'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on 0082 0083 end 0084 %----------------------------------------------------------------------- 0085 % Only in my case it needs adding 6 because proj automatically determines a 0086 % reference long in strides of 6deg while m_map doesn't 0087 %------------------------------------------------------------------------ 0088 pause(.2) 0089 if aa~=length(plotOPTS.Time_record) 0090 delete(Plots(plotOPTS.figure).handles(:)) 0091 end 0092 0093 end 0094 0095 return 0096