Warning, /utils/matlab/pcolorfv.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
df2af88df1 Alis*0001 function [hc,hh,hcf] = pcolorfv(x,z,h,a,varargin)
0002 % PCOLORFV(X,Z,H,A)
0003 %
0004 % Is the same as PCOLORFV except it automatically extends the dataset
0005 % to the depth of the topography "H". This is srictly for plotting
0006 % vertical (x,z) sections in conjuction with "partial cells" in the MITgcm.
0007 %
0008 % X is horizontal coordinate (vector)
0009 % Z is vertical coordinate (vector)
0010 % H is depth of bottom (vector)
0011 % A is field to be plotted (matrix)
0012 %
0013 % Optional arguments are passed on to PCOLOR
7f0effbc3a Jean*0014
df2af88df1 Alis*0015 nx=prod(size(x));
0016 nz=prod(size(z));
0017 %max(size(h))
0018 %prod(size(h))
0019 if max(size(h)) ~= prod(size(h)) | prod(size(h)) ~= nx
0020 error('H must have dimensions of size(X)');
0021 end
90e90d14bf Alis*0022 %ndims(squeeze(a))
0023 %size(squeeze(a))
df2af88df1 Alis*0024 if ndims(squeeze(a)) ~= 2 | sum(size(squeeze(a)) ~= [nx nz])
0025 error('A must have dimensions of size(X) x size(H)');
0026 end
0027
0028 % Create extended Z coordinate
0029 zz=zeros(1,nz+2);
0030 zz(2:nz+1)=z;
0031 zz(1)=0;
0032 zz(nz+2)=1.5*z(nz)-0.5*z(nz-1);
0033
0034 [Z,X]=meshgrid(zz,x);
0035
0036 aa=squeeze(a);
0037 au=aa(:,[1 1:nz-1]);
0038 aa(isnan(aa))=au(isnan(aa));
0039 A=zeros(nx,nz+2);
0040 A(:,2:nz+1)=aa;
0041 A(:,1)=aa(:,1);
0042 A(:,nz+2)=aa(:,nz);
0043 clear aa au
0044
0045 [Hz,Hx]=meshgrid(zz,h);
0046 clear Hz
0047
0048
0049 % H might be positive...
0050 if min(z)*min(h) > 0
0051 Z=max(Z,Hx);
0052 else
0053 Z=max(Z,-Hx);
0054 end
0055 clear Hx
0056
0057 pcolor(X,Z,A,varargin{:});