/[MITgcm]/MITgcm/utils/matlab/pcolorfv.m
ViewVC logotype

Contents of /MITgcm/utils/matlab/pcolorfv.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Fri Jun 4 17:09:11 2004 UTC (19 years, 10 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint57m_post, checkpoint57g_pre, checkpoint57s_post, checkpoint58b_post, checkpoint57b_post, checkpoint57g_post, checkpoint56b_post, checkpoint57y_post, checkpoint54d_post, checkpoint54e_post, checkpoint57r_post, checkpoint57d_post, checkpoint57i_post, checkpoint58, checkpoint55, checkpoint54, checkpoint57, checkpoint56, checkpoint58f_post, checkpoint57n_post, checkpoint58d_post, checkpoint58a_post, checkpoint57z_post, checkpoint54f_post, checkpoint58t_post, checkpoint55i_post, checkpoint58m_post, checkpoint57l_post, checkpoint57t_post, checkpoint55c_post, checkpoint57v_post, checkpoint57f_post, checkpoint53d_post, checkpoint57a_post, checkpoint57h_pre, checkpoint54b_post, checkpoint57h_post, checkpoint57y_pre, checkpoint55g_post, checkpoint58o_post, checkpoint57c_post, checkpoint58p_post, checkpoint58q_post, checkpoint55d_post, checkpoint58e_post, checkpoint54a_pre, checkpoint55d_pre, checkpoint57c_pre, checkpoint58r_post, checkpoint55j_post, checkpoint54a_post, checkpoint55h_post, checkpoint58n_post, checkpoint57e_post, checkpoint55b_post, checkpoint55f_post, checkpoint53g_post, checkpoint57p_post, checkpint57u_post, checkpoint57q_post, eckpoint57e_pre, checkpoint58k_post, checkpoint58v_post, checkpoint56a_post, checkpoint58l_post, checkpoint53f_post, checkpoint57h_done, checkpoint57j_post, checkpoint57f_pre, checkpoint58g_post, checkpoint58h_post, checkpoint56c_post, checkpoint58j_post, checkpoint57a_pre, checkpoint55a_post, checkpoint57o_post, checkpoint57k_post, checkpoint57w_post, checkpoint58i_post, checkpoint57x_post, checkpoint58c_post, checkpoint58u_post, checkpoint58s_post, checkpoint55e_post, checkpoint54c_post
Changes since 1.1: +3 -3 lines
Tidy up

1 function [hc,hh,hcf] = pcolorfv(x,z,h,a,varargin)
2 % PCOLORFV(X,Z,H,A)
3 %
4 % Is the same as PCOLORFV except it automatically extends the dataset
5 % to the depth of the topography "H". This is srictly for plotting
6 % vertical (x,z) sections in conjuction with "partial cells" in the MITgcm.
7 %
8 % X is horizontal coordinate (vector)
9 % Z is vertical coordinate (vector)
10 % H is depth of bottom (vector)
11 % A is field to be plotted (matrix)
12 %
13 % Optional arguments are passed on to PCOLOR
14 %
15 % $Header: /u/gcmpack/models/MITgcmUV/utils/matlab/pcolorfv.m,v 1.1 2001/11/21 19:18:10 adcroft Exp $
16
17 nx=prod(size(x));
18 nz=prod(size(z));
19 %max(size(h))
20 %prod(size(h))
21 if max(size(h)) ~= prod(size(h)) | prod(size(h)) ~= nx
22 error('H must have dimensions of size(X)');
23 end
24 %ndims(squeeze(a))
25 %size(squeeze(a))
26 if ndims(squeeze(a)) ~= 2 | sum(size(squeeze(a)) ~= [nx nz])
27 error('A must have dimensions of size(X) x size(H)');
28 end
29
30 % Create extended Z coordinate
31 zz=zeros(1,nz+2);
32 zz(2:nz+1)=z;
33 zz(1)=0;
34 zz(nz+2)=1.5*z(nz)-0.5*z(nz-1);
35
36 [Z,X]=meshgrid(zz,x);
37
38 aa=squeeze(a);
39 au=aa(:,[1 1:nz-1]);
40 aa(isnan(aa))=au(isnan(aa));
41 A=zeros(nx,nz+2);
42 A(:,2:nz+1)=aa;
43 A(:,1)=aa(:,1);
44 A(:,nz+2)=aa(:,nz);
45 clear aa au
46
47 [Hz,Hx]=meshgrid(zz,h);
48 clear Hz
49
50
51 % H might be positive...
52 if min(z)*min(h) > 0
53 Z=max(Z,Hx);
54 else
55 Z=max(Z,-Hx);
56 end
57 clear Hx
58
59 pcolor(X,Z,A,varargin{:});

  ViewVC Help
Powered by ViewVC 1.1.22