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

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

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


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

1 function zi = griddata_fast(delau,z,method)
2 %GRIDDATA_FAST Data gridding and surface fitting.
3 % ZI = GRIDDATA_FAST(DEL,Z)
4 %
5 % See also GRIDDATA_PREPROCESS
6
7 % Based on
8 % Clay M. Thompson 8-21-95
9 % Copyright 1984-2001 The MathWorks, Inc.
10 % $Revision: 5.28 $ $Date: 2001/04/15 11:59:14 $
11
12 error(nargchk(2,3,nargin))
13
14 if nargin<3, method = 'linear'; end
15 if ~isstr(method),
16 error('METHOD must be one of ''linear'',''cubic'',''nearest'', or ''v4''.');
17 end
18
19
20 % Sort x and y so duplicate points can be averaged before passing to delaunay
21
22 switch lower(method),
23 case 'linear'
24 zi = linear(delau,z);
25 % case 'cubic'
26 % zi = cubic(x,y,z,xi,yi);
27 % case 'nearest'
28 % zi = nearest(x,y,z,xi,yi);
29 % case {'invdist','v4'}
30 % zi = gdatav4(x,y,z,xi,yi);
31 otherwise
32 error('Unknown method.');
33 end
34
35 if nargout<=1, xi = zi; end
36
37
38 %------------------------------------------------------------
39 function zi = linear(del,z)
40 %LINEAR Triangle-based linear interpolation
41
42 % Reference: David F. Watson, "Contouring: A guide
43 % to the analysis and display of spacial data", Pergamon, 1994.
44
45 z = z(:).'; % Treat z as a row so that code below involving
46 % z(tri) works even when tri is 1-by-3.
47 zi = sum(z(del.tri) .* del.w,2);
48
49 zi = reshape(zi,del.siz);
50
51 if ~isempty(del.out), zi(del.out) = NaN; end
52
53 %------------------------------------------------------------

  ViewVC Help
Powered by ViewVC 1.1.22