/[MITgcm]/MITgcm_contrib/dgoldberg/depth_control_no_nsa/input/contourfv.m
ViewVC logotype

Contents of /MITgcm_contrib/dgoldberg/depth_control_no_nsa/input/contourfv.m

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


Revision 1.1 - (show annotations) (download)
Thu Dec 7 23:28:43 2017 UTC (7 years, 7 months ago) by dgoldberg
Branch: MAIN
CVS Tags: HEAD
*** empty log message ***

1 function [hc,hh,hcf] = contourfv(x,z,h,a,varargin)
2 % CONTOURFV(X,Z,H,A)
3 %
4 % Is the same as CONTOURF 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 CONTOURF
14 %
15 % $Header: /u/gcmpack/MITgcm/utils/matlab/contourfv.m,v 1.2 2004/06/04 17:09:11 adcroft Exp $
16
17 nx=prod(size(x,1));
18 nz=prod(size(z,2));
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 Z=zeros(nx,nz+2);
32 Z(:,2:nz+1)=z;
33 Z(:,1)=z(:,1);
34 Z(:,nz+2)=1.5*z(:,nz)-0.5*z(:,nz-1);
35
36 X=[x x(:,end-1:end)];
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 Hx = h(:)*ones(1,nz+2);
48
49 % H might be positive...
50 if min(z(:))*min(h(:)) > 0
51 Z=max(Z,Hx);
52 else
53 Z=max(Z,-Hx);
54 end
55 clear Hx
56
57 [hc hh hcf]=contourf(X,Z,A,varargin{:});

  ViewVC Help
Powered by ViewVC 1.1.22