/[MITgcm]/MITgcm_contrib/gael/profilesMatlabProcessing/profiles_stats/MITprof_stats.m
ViewVC logotype

Diff of /MITgcm_contrib/gael/profilesMatlabProcessing/profiles_stats/MITprof_stats.m

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

revision 1.2 by gforget, Fri Jul 1 18:01:54 2011 UTC revision 1.3 by gforget, Wed Dec 12 00:49:20 2012 UTC
# Line 14  function [xh,yh,zh,varargout]=MITprof_pd Line 14  function [xh,yh,zh,varargout]=MITprof_pd
14    
15  warning('off','MATLAB:dsearch:DeprecatedFunction');  warning('off','MATLAB:dsearch:DeprecatedFunction');
16    
17    gcmfaces_global;
18    
19    if ~isfield(myenv,'useDelaunayTri');
20        myenv.useDelaunayTri=~isempty(which('DelaunayTri'));
21    end;
22    
23  if nargin>4; choiceStat=varargin{1}; else; choiceStat='pdf'; end;  if nargin>4; choiceStat=varargin{1}; else; choiceStat='pdf'; end;
24  if nargin>5; z=varargin{2}; else; z=[]; end;  if nargin>5; z=varargin{2}; else; z=[]; end;
25    
# Line 59  xh=xh*ones(1,size(yh,1)); Line 65  xh=xh*ones(1,size(yh,1));
65  yh=ones(size(xh,1),1)*yh';  yh=ones(size(xh,1),1)*yh';
66    
67  %build the histogram  %build the histogram
68  TRI=delaunay(xh,yh,{'QJ'}); nxy = prod(size(xh));  if myenv.useDelaunayTri;
69  Stri=sparse(TRI(:,[1 1 2 2 3 3]),TRI(:,[2 3 1 3 1 2]),1,nxy,nxy);      %the new way, using DelaunayTri&nearestNeighbor
70        mytri.TRI=DelaunayTri(xh(:),yh(:));
71    else;
72        TRI=delaunay(xh,yh,{'QJ'}); nxy = prod(size(xh));
73        Stri=sparse(TRI(:,[1 1 2 2 3 3]),TRI(:,[2 3 1 3 1 2]),1,nxy,nxy);
74    end;
75    
76  %compute grid point vector associated with lon/lat vectors  %compute grid point vector associated with lon/lat vectors
77  if nargin>5; ii=find(~isnan(x.*y.*z)); else; ii=find(~isnan(x.*y)); end;  if nargin>5; ii=find(~isnan(x.*y.*z)); else; ii=find(~isnan(x.*y)); end;
78  x=x(ii); y=y(ii); z=z(ii);  x=x(ii); y=y(ii); z=z(ii);
79  ik=dsearch(xh,yh,TRI,x,y,Stri);  if myenv.useDelaunayTri;
80        ik = mytri.TRI.nearestNeighbor(x,y);
81    else;
82        ik = dsearch(xh,yh,TRI,x,y,Stri);
83    end;
84    
85  %compute bin sums:  %compute bin sums:
86  nh=zeros(size(xh)); if nargin>5; zh=nh; zh2=zh; end;  nh=zeros(size(xh)); if nargin>5; zh=nh; zh2=zh; end;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22