


Function to display transect plots of FVCOM variables (i.e. temperature)
[Plots]=do_transect_plot(plotOPTS,FVCOM)
DESCRIPTION:
Generates transect plots of variables
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]
If the above exist, it will generate an m_map plot with transect
position
plotOPTS.mesh: [1x1 struct]
plotOPTS.coastline_file: '../mat/tamar3_0coast.mat'
plotOPTS.zone: 30
plotOPTS.ell: 'grs80'
plotOPTS.fig_name: 'co2_S5_slowleak'
plotOPTS.mesh: [1x1 struct]
plotOPTS.var_plot: 'PH'
plotOPTS.clims: [6 8]
plotOPTS.nz_plot: 1
plotOPTS.figure: 1
plotOPTS.Time_record: 7.3271e+05
plotOPTS.data_dec: 5
plotOPTS.vel_sca: 5
plotOPTS.pause: 0.5000

0001 function [Plots]=do_transect_plot(plotOPTS,FVCOM) 0002 % 0003 % Function to display transect plots of FVCOM variables (i.e. temperature) 0004 % 0005 % [Plots]=do_transect_plot(plotOPTS,FVCOM) 0006 % 0007 % DESCRIPTION: 0008 % Generates transect plots of variables 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 % If the above exist, it will generate an m_map plot with transect 0019 % position 0020 % plotOPTS.mesh: [1x1 struct] 0021 % plotOPTS.coastline_file: '../mat/tamar3_0coast.mat' 0022 % plotOPTS.zone: 30 0023 % plotOPTS.ell: 'grs80' 0024 % plotOPTS.fig_name: 'co2_S5_slowleak' 0025 % plotOPTS.mesh: [1x1 struct] 0026 % plotOPTS.var_plot: 'PH' 0027 % plotOPTS.clims: [6 8] 0028 % plotOPTS.nz_plot: 1 0029 % plotOPTS.figure: 1 0030 % plotOPTS.Time_record: 7.3271e+05 0031 % plotOPTS.data_dec: 5 0032 % plotOPTS.vel_sca: 5 0033 % plotOPTS.pause: 0.5000 0034 0035 % 0036 % OUTPUT: 0037 % Plots = structure array with figure handles 0038 % 0039 % EXAMPLE USAGE 0040 % [Plots]=do_transect_plot(plotOPTS,FVCOM) 0041 % 0042 % Author(s): 0043 % Ricardo Torres (Plymouth Marine Laboratory) 0044 % 0045 % Revision history 0046 % 0047 %============================================================================== 0048 figure(plotOPTS.figure); 0049 if ~(isfield(FVCOM,'zeta') | ~isfield(FVCOM,'h') | ~isfield(FVCOM,'siglay')) 0050 fprintf('You seem to be missing either zeta, h, or siglay from FVCOM variable\n'); 0051 fprintf(' Stoping. Try again\n'); 0052 Plots=[]; 0053 return 0054 end 0055 0056 % convert sigma levels to z levels 0057 nz=size(FVCOM.(plotOPTS.var_plot),2) 0058 if isfield(plotOPTS,'Time_record') 0059 nt=length(plotOPTS.Time_record) 0060 else 0061 nt=1; 0062 end 0063 0064 nxy=length(plotOPTS.trn_nodes.y) 0065 FVCOM.z=ones(nxy,nz,nt); 0066 for tt=1:nt 0067 z=FVCOM.h(:)+FVCOM.zeta(:,tt); 0068 for zz=1:nz 0069 FVCOM.z(:,zz,tt)=z+z.*FVCOM.siglay(:,zz); 0070 end 0071 end 0072 % plot animation of timeseries of transect 0073 XX=repmat(plotOPTS.trn_dis(:)',nz,1)'; 0074 for tt=1:nt 0075 YY=squeeze(FVCOM.z(:,:,tt)); 0076 ZZ=squeeze(FVCOM.(plotOPTS.var_plot)(:,:,tt)); 0077 Plots(plotOPTS.figure).handles=contourf(XX/100000,-YY,(ZZ),200,'edgecolor','none'); 0078 caxis(plotOPTS.clims); 0079 colorbar 0080 xlabel('Distance along Transect') 0081 ylabel('Depth m') 0082 ylim([-max(FVCOM.h(:)) 0]) 0083 pause(.5) 0084 end 0085 0086 0087 if isfield(plotOPTS,'range_lat') 0088 m_mappath; 0089 %plot map with transect overlaid 0090 figure(plotOPTS.figure+1);clf 0091 m_proj('UTM','lon',[ plotOPTS.range_lon],'lat',[plotOPTS.range_lat],'zon',plotOPTS.zone,'ell',plotOPTS.ell) 0092 m_grid('box','fancy') 0093 % add coastline if present 0094 if (isfield(plotOPTS,'coastline_file') && ~isempty(plotOPTS.coastline_file) ) 0095 m_usercoast(plotOPTS.coastline_file,'Color','k','LineWidth',3); 0096 end 0097 0098 %plot vertices 0099 col=0.7*[1 1 1]; 0100 if plotOPTS.do_mesh 0101 %plot vertices 0102 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,'clip','on'); 0103 Plots(plotOPTS.figure).mesh=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,... 0104 'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on 0105 0106 end 0107 % plot with matlab 0108 hold on 0109 [x,y]=m_ll2ll(plotOPTS.trn_nodes.x,plotOPTS.trn_nodes.y); 0110 [X,Y]=m_ll2xy(x+6,y,'clip','on'); 0111 plot(X,Y,'r','LineWidth',2.5) 0112 end 0113