0001 function [Plots]=do_ph_max_change_plot(plotOPTS,FVCOM,startIdx)
0002
0003 m_mappath;
0004
0005
0006 if ~isfield(FVCOM,plotOPTS.var_plot)
0007 error('Need %s input to calculate change in %s.',plotOPTS.var_plot,plotOPTS.var_plot)
0008 end
0009
0010
0011
0012 nColours=200;
0013 nColourIn=[1,nColours*0.15,nColours*0.6,nColours*0.75,nColours*0.9,nColours];
0014 nColourOut=1:nColours;
0015
0016 cRed=interp1(nColourIn, [0.62, 0.9, 1 , 1 , 0 , 0.46],nColourOut);
0017 cGreen=interp1(nColourIn,[0 , 0 , 0.52 , 1 , 0.8, 0.63],nColourOut);
0018 cBlue=interp1(nColourIn, [0.2 , 0.2, 0 , 0 , 0 , 0.83],nColourOut);
0019 colourSpec=flipud([cRed;cGreen;cBlue]');
0020
0021 if isfield(plotOPTS,'altColours') && plotOPTS.altColours==1
0022 clear nColours nColourIn nColourOut colourSpec
0023
0024
0025 nColours=200;
0026 nColourIn=[1,nColours*0.1,nColours*0.2,nColours*0.3,nColours*0.4,nColours];
0027 nColourOut=1:nColours;
0028
0029 cRed=interp1(nColourIn, [0 , 0 , 0 , 0.04, 0 , 0.2 ],nColourOut);
0030 cGreen=interp1(nColourIn,[0 , 0 , 0.2 , 0.51, 0.6, 0.76 ],nColourOut);
0031 cBlue=interp1(nColourIn, [0.4 , 0.6 , 0.79, 0.78, 0.6 , 0],nColourOut);
0032 colourSpec=[cRed;cGreen;cBlue]';
0033 end
0034
0035 dataToUse=single(FVCOM.(plotOPTS.var_plot));
0036
0037
0038 if isfield(plotOPTS,'depth_average') && plotOPTS.depth_average
0039 bgPH=squeeze(mean(dataToUse(:,:,startIdx),2));
0040 else
0041 bgPH=squeeze(dataToUse(:,plotOPTS.nz_plot,startIdx));
0042 end
0043
0044
0045 if isfield(plotOPTS,'depth_average') && plotOPTS.depth_average
0046 phData=squeeze(mean(dataToUse,2));
0047 else
0048 phData=squeeze(dataToUse(:,plotOPTS.nz_plot,:));
0049 end
0050
0051 phDiff=phData-repmat(bgPH,1,size(phData,2));
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 phDiffMax=min((phDiff),[],2);
0074 figure(plotOPTS.figure); clf
0075 m_proj('UTM','lon',[plotOPTS.range_lon],'lat',[plotOPTS.range_lat],'zon',plotOPTS.zone,'ell','grs80')
0076 m_grid('box','fancy')
0077 m_usercoast(plotOPTS.coastline_file,'Color','k','LineWidth',3);
0078 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,'clip','on');
0079
0080
0081 hold on
0082 Plots(1).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,...
0083 'Cdata',phDiffMax,'edgecolor','interp','facecolor','interp');
0084 caxis(plotOPTS.clims)
0085 colormap(flipud(colourSpec))
0086 ch=colorbar;
0087 set(ch,'FontSize',10);
0088 ylabel(ch,'pH change');
0089
0090
0091 if plotOPTS.do_mesh
0092
0093 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,'clip','on');
0094 patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,...
0095 'EdgeColor',[0.6 0.6 0.6],'FaceColor','none'); hold on
0096 end
0097
0098 if plotOPTS.save_output
0099
0100 fprintf('Saving figure... ')
0101 set(findobj(gcf,'Type','text'),'FontSize',10)
0102
0103 set(gcf,'PaperPositionMode','auto');
0104 set(gcf,'renderer','painters');
0105 print(gcf,'-dpdf','-r600',[plotOPTS.FVCOM_plot_dir,plotOPTS.var_plot,'/pdf/',plotOPTS.fig_name,'_layer=',num2str(plotOPTS.nz_plot),'_',plotOPTS.var_plot,'_max_change.pdf']);
0106
0107 fprintf('done.\n')
0108 end
0109
0110
0111 return