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

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

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


Revision 1.1 - (show annotations) (download)
Wed Nov 21 17:56:43 2001 UTC (22 years, 5 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint51k_post, checkpoint47e_post, checkpoint52l_pre, checkpoint44e_post, hrcube4, hrcube5, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, checkpoint50c_post, checkpoint46f_post, checkpoint52d_pre, checkpoint48e_post, checkpoint50c_pre, checkpoint44f_post, checkpoint46b_post, checkpoint52j_pre, checkpoint43a-release1mods, checkpoint51o_pre, checkpoint51l_post, checkpoint48i_post, checkpoint46l_pre, checkpoint52l_post, checkpoint52k_post, chkpt44d_post, checkpoint51, checkpoint50, checkpoint53, checkpoint52, checkpoint50d_post, checkpoint52f_post, checkpoint50b_pre, checkpoint44e_pre, checkpoint51f_post, checkpoint48b_post, checkpoint51d_post, checkpoint48c_pre, checkpoint47d_pre, checkpoint51t_post, checkpoint51n_post, checkpoint52i_pre, hrcube_1, hrcube_2, hrcube_3, checkpoint51s_post, checkpoint47a_post, checkpoint48d_pre, checkpoint51j_post, checkpoint47i_post, checkpoint52e_pre, checkpoint52e_post, checkpoint51n_pre, checkpoint47d_post, checkpoint46d_pre, checkpoint48d_post, release1-branch_tutorials, checkpoint48f_post, checkpoint45d_post, checkpoint52b_pre, checkpoint46j_pre, checkpoint51l_pre, checkpoint52m_post, chkpt44a_post, checkpoint44h_pre, checkpoint48h_post, checkpoint51q_post, checkpoint51b_pre, checkpoint46a_post, checkpoint47g_post, checkpoint52b_post, checkpoint52c_post, checkpoint46j_post, checkpoint51h_pre, checkpoint46k_post, chkpt44c_pre, checkpoint48a_post, checkpoint45a_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, checkpoint52f_pre, checkpoint47j_post, checkpoint53c_post, branch-exfmods-tag, checkpoint44g_post, branchpoint-genmake2, checkpoint46e_pre, checkpoint51r_post, checkpoint48c_post, checkpoint45b_post, checkpoint46b_pre, checkpoint51i_post, release1-branch-end, release1_final_v1, checkpoint51b_post, checkpoint51c_post, checkpoint46c_pre, checkpoint53a_post, checkpoint46, checkpoint47b_post, checkpoint44b_post, checkpoint46h_pre, checkpoint52d_post, checkpoint46m_post, checkpoint46a_pre, checkpoint50g_post, checkpoint45c_post, checkpoint44h_post, checkpoint46g_post, checkpoint52a_pre, checkpoint50h_post, checkpoint52i_post, checkpoint50e_pre, checkpoint50i_post, checkpoint51i_pre, checkpoint52h_pre, checkpoint52j_post, checkpoint47f_post, checkpoint50e_post, chkpt44a_pre, checkpoint46i_post, checkpoint46c_post, branch-netcdf, checkpoint50d_pre, checkpoint52n_post, checkpoint53b_pre, checkpoint46e_post, checkpoint51e_post, checkpoint44b_pre, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint46h_post, checkpoint51o_post, checkpoint51f_pre, chkpt44c_post, checkpoint48g_post, checkpoint53b_post, checkpoint47h_post, checkpoint52a_post, checkpoint44f_pre, checkpoint51g_post, ecco_c52_e35, checkpoint46d_post, checkpoint50b_post, release1-branch_branchpoint, checkpoint51m_post, checkpoint53d_pre, checkpoint51a_post, checkpoint51p_post, checkpoint51u_post
Branch point for: branch-exfmods-curt, release1_final, release1-branch, branch-genmake2, release1, branch-nonh, tg2-branch, ecco-branch, netcdf-sm0, checkpoint51n_branch
A wrapper for contourf() that plots the finite volume topography
properly.

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: $
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 [hc hh hcf]=contourf(X,Z,A,varargin{:});

  ViewVC Help
Powered by ViewVC 1.1.22