0001 function [Plots]=do_ph_vertical_profile(plotOPTS,FVCOM,transectPoints)
0002
0003
0004
0005
0006 if isempty(plotOPTS.save_intervals)
0007 plotOPTS.save_intervals=1:length(plotOPTS.Time_record);
0008 dontSave=1;
0009 else
0010 dontSave=0;
0011 end
0012
0013 if isfield(plotOPTS,'altColours') && plotOPTS.altColours==1
0014 colourSpec=flipud(jet);
0015 else
0016 clear nColours nColourIn nColourOut colourSpec
0017
0018
0019 nColours=200;
0020 nColourIn=[1,nColours*0.15,nColours*0.6,nColours*0.75,nColours*0.9,nColours];
0021 nColourOut=1:nColours;
0022
0023 cRed=interp1(nColourIn, [0.62, 0.9, 1 , 1 , 0 , 0.46],nColourOut);
0024 cGreen=interp1(nColourIn,[0 , 0 , 0.52 , 1 , 0.8, 0.63],nColourOut);
0025 cBlue=interp1(nColourIn, [0.2 , 0.2, 0 , 0 , 0 , 0.83],nColourOut);
0026 colourSpec=[cRed;cGreen;cBlue]';
0027 end
0028
0029 dataToUse=single(FVCOM.(plotOPTS.var_plot));
0030
0031 saveInc=1;
0032 for aa=1:length(plotOPTS.Time_record)
0033
0034 verticalProfile=squeeze(dataToUse(transectPoints.trn_nodes.idx,:,plotOPTS.save_intervals(aa)));
0035
0036
0037
0038 xNorm=transectPoints.trn_nodes.x-min(transectPoints.trn_nodes.x);
0039 yNorm=transectPoints.trn_nodes.y-min(transectPoints.trn_nodes.y);
0040 xDist=sqrt(xNorm.^2+yNorm.^2);
0041 xValues=repmat(xDist,1,size(verticalProfile,2));
0042
0043 zeta=squeeze(FVCOM.zeta(transectPoints.trn_nodes.idx,plotOPTS.save_intervals(aa)));
0044 waterDepth=FVCOM.h(transectPoints.trn_nodes.idx);
0045 zValues=(zeta+waterDepth)*FVCOM.siglay(1,:);
0046
0047
0048 fprintf('Time step %i of %i\n',aa,length(plotOPTS.Time_record))
0049 figure(plotOPTS.figure); clf
0050 hold on
0051 Plots(1).handles=contourf(...
0052 xValues/1000,...
0053 zValues,...
0054 fliplr(verticalProfile),...
0055 200,'edgecolor','none');
0056
0057 xlabel('Distance along transect (km)')
0058 ylabel('Depth (m)')
0059 colormap(colourSpec)
0060 ch=colorbar;
0061 set(ch,'FontSize',10);
0062 ylabel(ch,'pH')
0063
0064 if ~isempty(plotOPTS.vlims)
0065 caxis(plotOPTS.vlims);
0066
0067 if plotOPTS.vlims(2)-plotOPTS.vlims(1)<1e-4
0068 xx=0:length(plotOPTS.vlims)-1;
0069 yy=plotOPTS.vlims;
0070 xxi=0:1/6:1;
0071 cticks=interp1(xx,yy,xxi);
0072 set(ch,'YTick',double(cticks))
0073 set(ch,'yticklabel',cticks)
0074 end
0075 end
0076
0077
0078
0079 pause(plotOPTS.pause)
0080 if plotOPTS.save_output
0081 if saveInc<=length(plotOPTS.save_intervals) && plotOPTS.save_intervals(aa)==plotOPTS.save_intervals(saveInc) && ~dontSave
0082
0083 fprintf('Saving figure... ')
0084 set(findobj(gcf,'Type','text'),'FontSize',10)
0085
0086 set(gcf,'PaperPositionMode','auto');
0087 set(gcf,'renderer','painters');
0088 print(gcf,'-dpdf','-r600',[plotOPTS.FVCOM_plot_dir,plotOPTS.var_plot,'/pdf/',plotOPTS.fig_name,'_vertical_profile_',plotOPTS.var_plot,'_',num2str(plotOPTS.save_intervals(aa)),'.pdf']);
0089
0090 saveInc=saveInc+1;
0091 fprintf('done.\n')
0092 end
0093 end
0094
0095 if aa~=length(plotOPTS.Time_record)
0096 clf
0097 end
0098 end
0099
0100 return